如何从touchable上获取数据而没有onPressfeedback

时间:2018-09-25 13:39:39

标签: react-native

我正在从API解析数据,我只希望在单击主体部分时显示某些部分。我首先尝试提醒它,但是它显示为空,但是所有其他数据都在工作,我敢肯定item.description 可用,但不适用于onPress。

我只想在有人按下项目本身的最后<Text>中对该描述进行说明。

     <FlatList
      data={this.state.data.articles}
      renderItem={
      ({item}) =>

        <TouchableWithoutFeedback onPress={ () => { alert( item.description ) } }>
          <View>
            <Text style={styles.item}>{item.title}</Text>
            <Text style={styles.source}> {item.source.name} </Text>
            <Text> Description should be here and only showed when item clicked </Text>
          </View>
        </TouchableWithoutFeedback>

      }
    />

0 个答案:

没有答案