React Native render()里面写js和迭代


{(this.state.helps!==null&&this.state.helps!=undefined&&this.state.helps.length>=1)?
                                  this.state.helps.map( (item,index,input) => {return (

                                    <View key={index} style={{
                                        flex:1,
                                        flexDirection: 'column',
                                        alignItems: 'center',
                                        backgroundColor: '#fff',
                                        paddingTop:10,
                                        paddingBottom:10,
                                        marginTop:10,
                                      }}>
                                      <View style={{flex:1,flexDirection:'row',}}>
                                        <View style={{flex:2,alignItems:'flex-end',}} >
                                            <Text style={{color:'gray', fontSize: 16}}>{item.type===1?'问需内容':'个案内容'}:  </Text>
                                        </View>
                                        <View style={{flex:3,alignItems:'flex-start', }}>
                                            <Text style={{color:'gray', paddingRight:10, fontSize: 16}}>{StringUtils.isEmpty(item.content)?'未知':item.content}</Text>
                                        </View>
                                        </View>




                                        

                                      </View>

                                    )} )



                                      :

                                      <View style={{
                                          flex:1,
                                          flexDirection: 'column',
                                          alignItems: 'center',
                                          backgroundColor: '#fff',
                                          alignItems:'center',
                                          paddingTop:10,
                                          paddingBottom:10,
                                          marginTop:10,
                                          marginBottom:10,
                                        }}>
                                            <Text style={{color:'gray', fontSize: 16}}>暂无</Text>
                                        </View>

                                        }

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容