【问题标题】:How can I make my card view littile circular in react native如何在本机反应中使我的卡视图小圆形
【发布时间】:2020-01-06 06:52:28
【问题描述】:
//

在下面的代码中,我试图根据我的 ux 设计在 ui 上制作。但是我面临的一个问题是无法在 ux 中制作类似的卡片,在 ux 中它的某些循环,但在我的代码中它没有出现。它也尝试使用边界半径。请提出我错在哪里

 <View style={{ marginBottom: 10, marginLeft: 5, marginRight: 5, borderRadius: 2, padding: 10 }} >
                      <Card >
                        <CardItem header style={{ flexDirection: 'row', backgroundColor: '#fff', width: '100%', justifyContent: 'space-between', borderBottomColor: '#f1f1f1', borderBottomWidth: 1,borderRadius: 80 }}>
                          <View style={{paddingTop:10 }}>
                              <RegularText text={`${'Wallet Balance'}`} textColor='grey'style={{ fontWeight: 'bold', flexWrap: 'wrap',color:'grey' }} />
                          </View>

                            <View style = {{ width : wp('10%'),height: wp('10%'),backgroundColor : '#E091C9' ,borderRadius : hp('1%'), margin : 8,flexDirection :'row',justifyContent :'center',alignItems : 'center'}}>
                           <SvgCss xml={WALLET} width={15} height={15} />
                             </View>

                            <View style={{
                            flexDirection: 'column',
                            height: 25, paddingRight: 10, paddingLeft: 10, paddingTop: 5,paddingBottom:30}}>
                            <SmallText text={'MUR 110.00'} textColor='red' />
                            <SmallText text={'Add Money'} textColor='blue' />
                            </View>

                        </CardItem>
                        <View style = {{flexDirection : 'row',paddingLeft:24,paddingRight:24}}>
                        {info.tecnologies.map(
                          (data, index) => {
                              return (
                                <View>
                                  <View style = {{width : wp('14%'),height: wp('14%'),backgroundColor : 'rgb(163, 153, 233)',borderRadius : hp('2%'), margin : 10,flexDirection :'row',justifyContent :'center',alignItems : 'center'}}>
                                <SvgCss xml={PAY_BILL} width={15} height={15} />
                                  </View>
                                  <View style={{paddingLeft:15,paddingBottom:15}}>
                                  <SmallText text={'Pay Bill'} textColor='grey' />

                                  </View>
                                </View>
                              )
                          }
                      )}
                      </View>
                      </Card>
                    </View>

【问题讨论】:

  • 你可以使用borderRadius
  • 在顶视图组件中尝试borderRadius:50

标签: javascript reactjs react-native


【解决方案1】:

你应该试试这个:

<View style={{ marginBottom: 10, marginLeft: 5, marginRight: 5, borderRadius: 2, padding: 10 }} >
                      <Card style={{ borderRadius: 8 }}>
                        <CardItem header style={{ flexDirection: 'row', backgroundColor: '#fff', width: '100%', justifyContent: 'space-between', borderBottomColor: '#f1f1f1', borderBottomWidth: 1,borderRadius: 80 }}>
                          <View style={{paddingTop:10 }}>
                              <RegularText text={`${'Wallet Balance'}`} textColor='grey'style={{ fontWeight: 'bold', flexWrap: 'wrap',color:'grey' }} />
                          </View>

                            <View style = {{ width : wp('10%'),height: wp('10%'),backgroundColor : '#E091C9' ,borderRadius : hp('1%'), margin : 8,flexDirection :'row',justifyContent :'center',alignItems : 'center'}}>
                           <SvgCss xml={WALLET} width={15} height={15} />
                             </View>

                            <View style={{
                            flexDirection: 'column',
                            height: 25, paddingRight: 10, paddingLeft: 10, paddingTop: 5,paddingBottom:30}}>
                            <SmallText text={'MUR 110.00'} textColor='red' />
                            <SmallText text={'Add Money'} textColor='blue' />
                            </View>

                        </CardItem>
                        <View style = {{flexDirection : 'row',paddingLeft:24,paddingRight:24}}>
                        {info.tecnologies.map(
                          (data, index) => {
                              return (
                                <View>
                                  <View style = {{width : wp('14%'),height: wp('14%'),backgroundColor : 'rgb(163, 153, 233)',borderRadius : hp('2%'), margin : 10,flexDirection :'row',justifyContent :'center',alignItems : 'center'}}>
                                <SvgCss xml={PAY_BILL} width={15} height={15} />
                                  </View>
                                  <View style={{paddingLeft:15,paddingBottom:15}}>
                                  <SmallText text={'Pay Bill'} textColor='grey' />

                                  </View>
                                </View>
                              )
                          }
                      )}
                      </View>
                      </Card>
                    </View>

【讨论】:

  • 谢谢...请您帮忙...在carditeam中有钱包余额,然后是图标钱包,然后是Add Money'和Mur 100 ..它不正确
【解决方案2】:

关于你的另一个问题:

<View style={{ marginBottom: 10, marginLeft: 5, marginRight: 5, borderRadius: 2, padding: 10 }} >
                      <Card style={{ borderRadius: 8 }}>
                        <CardItem header style={{ flexDirection: 'row', backgroundColor: '#fff', width: '100%', justifyContent: 'space-between', borderBottomColor: '#f1f1f1', borderBottomWidth: 1,borderRadius: 80 }}>
                          <View style={{paddingTop:10 }}>
                              <RegularText text={`${'Wallet Balance'}`} textColor='grey'style={{ fontWeight: 'bold', flexWrap: 'wrap',color:'grey' }} />
                          </View>

                            <View style = {{ width : wp('10%'),height: wp('10%'),backgroundColor : '#E091C9' ,borderRadius : hp('1%'), margin : 8,flexDirection :'row',justifyContent :'center',alignItems : 'center', alignSelf : 'flex-end'}}>
                           <SvgCss xml={WALLET} width={15} height={15} />

                <View style={{
                                flexDirection: 'column',
                                height: 25, paddingRight: 10, paddingLeft: 10, paddingTop: 5,paddingBottom:30}}>
                                <SmallText text={'MUR 110.00'} textColor='red' />
                                <SmallText text={'Add Money'} textColor='blue' />
                            </View>
                             </View>



                        </CardItem>
                        <View style = {{flexDirection : 'row',paddingLeft:24,paddingRight:24}}>
                        {info.tecnologies.map(
                          (data, index) => {
                              return (
                                <View>
                                  <View style = {{width : wp('14%'),height: wp('14%'),backgroundColor : 'rgb(163, 153, 233)',borderRadius : hp('2%'), margin : 10,flexDirection :'row',justifyContent :'center',alignItems : 'center'}}>
                                <SvgCss xml={PAY_BILL} width={15} height={15} />
                                  </View>
                                  <View style={{paddingLeft:15,paddingBottom:15}}>
                                  <SmallText text={'Pay Bill'} textColor='grey' />

                                  </View>
                                </View>
                              )
                          }
                      )}
                      </View>
                      </Card>
                    </View>

【讨论】:

  • 在这里解释一下你做了什么,不要只是粘贴一堆代码
  • 我刚刚将列放在行的第二个元素内,并将第二个元素对齐在正确的位置
  • 我的意思是你应该在答案本身中解释你所做的事情,而不是在 cmets 中。只是一个友好的建议,如何让你的答案更清楚:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-06-01
  • 2023-01-03
  • 1970-01-01
  • 2018-02-14
  • 2018-04-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多