我需要以列表格式返回ParcelId的文本。我尝试将View旁边的Text更改为ListItem,或者我没有得到输出或者样式不得到支持。我不确定如何将文本包装成列表类型,需要帮助。谢谢。
码:
<View style={styles.MainContainerView}>
<View style={styles.ChildView}>
<TouchableOpacity activeOpacity={0.7}
onPress={this.expand_collapse_Function}>
<Icon name="ios-arrow-dropdown"/>
</TouchableOpacity>
<View style={{ height: this.state.updatedHeight, overflow: 'hidden' }}>
<Text style={styles.ExpandViewInsideText}
onLayout={(value) => this.getHeight(value.nativeEvent.layout.height)}>
{
this.props.parcels.map((list,j) => {
console.log(" Parcel Id:"+list.parcelId)
return(
<Text key={j}> {" Parcel Id:" + list.parcelId} </Text>
)
})
}
</Text>
</View>
</View>
</View>
最佳答案
我会做这样的事情,请注意我还没有测试过这个片段。
const listOfParcel = this.props.parcels;
return(
<div>
{listOfParcel.map((list,j) => {
<li key={j}>{list.parcelId}</li>
})}
</div>
)