简体   繁体   English

React Native 列表视图 TouchableHighlight

[英]React Native List View TouchableHighlight

I am having an issue with ListView and TouchableHighlight I followed this tutorial https://rnplay.org/apps/M4tiAQ Everything is perfect.我在使用 ListView 和 TouchableHighlight 时遇到了问题,我遵循了本教程https://rnplay.org/apps/M4tiAQ一切都很完美。 My problem is when I try to select row data of list view.我的问题是当我尝试选择列表视图的行数据时。 It doesnt give me anything.它不给我任何东西。 I want to change the scene, while selecting row data.我想改变场景,同时选择行数据。 Here is sample of what I did in renderAdress function这是我在 renderAdress 函数中所做的示例

      renderAdress = (adress) => {
    return (
<TouchableHighlight  onPress = { this._onPressAddressList(rowData)} underlayColor = 'white' >
      <View>
        <Text>{adress.street}, {adress.city}, {adress.country}</Text>
      </View>
</TouchableHighlight>
    );
  };

What I want is whenever user selects one of the row data from list, the scene changes and row value is passed to other scene.我想要的是每当用户从列表中选择行数据之一时,场景就会发生变化并将行值传递给其他场景。 I really appreciate the help.我真的很感谢你的帮助。 Thanks谢谢

It seems the problem with onPress function.似乎是 onPress 函数的问题。 Try changing it to onPress = { this._onPressAddressList.bind(this, rowData)}尝试将其更改为onPress = { this._onPressAddressList.bind(this, rowData)}

      renderAdress = (adress) => {
    return (
<TouchableHighlight  onPress = { this._onPressAddressList.bind(this, rowData)} underlayColor = 'white' >
      <View>
        <Text>{adress.street}, {adress.city}, {adress.country}</Text>
      </View>
</TouchableHighlight>
    );
  };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用 Icon 和 TouchableHighlight 反应原生工具提示? - React Native Tooltip with Icon and TouchableHighlight? React Native TouchableHighlight onPress 不起作用 - React Native TouchableHighlight onPress not working React Native TouchableHighlight 字体颜色文本更改 - React Native TouchableHighlight Font Color Text Change 在按下本机时反应本机TouchableHighlight打开另一个屏幕 - React native TouchableHighlight on press open another screen react-native:触发TouchableHighlight onPress()事件的InputText活动 - react-native: InputText activity firing TouchableHighlight onPress() events 反应原生TouchableHighlight如何更改箭头功能中的覆盖颜色 - react native TouchableHighlight how change overlay color in arrow function React Native - State 在按钮按下时无法正确更改(TouchableHighlight) - React Native - State doesn't change correctly on button press (TouchableHighlight) 使用TouchableHighlight在React Native中按下时如何更改按钮颜色? - How to change button color when pressed in React Native using TouchableHighlight? TouchableHighlight反应本机按钮图像正在显示,但未被点击 - TouchableHighlight react native button image is being displayed but its not getting clicked React-Native更新列表视图数据源 - React-Native Updating List View DataSource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM