touchablehighlight

How to pass props from FlatList item to Modal?

橙三吉。 提交于 2021-02-18 15:24:30
问题 I have implemented a View component containing a FlatList, which renders TouchableHighlights. Also I have implemented a Modal component, which I'd like to import at various places including the component that renders the FlatList. I have already managed to open the modal from outside (via handing over a prop for visibility, accessing it via nextProps and setting modals state value "modalVisible" to this) and closing it from inside (simply via changing it's state value "modalVisible"). BUT: I

Child of TouchableHighlight loses opacity styling on press

て烟熏妆下的殇ゞ 提交于 2019-12-10 18:39:10
问题 When a child of a TouchableHighlight has an opacity, its opacity disappears (is set to 1) after the TouchableHighlight is pressed. Running example here: https://rnplay.org/apps/c0NIjQ Minimal example: <TouchableHighlight onPress={() => {}}> <Text style={{ opacity: 0.5 }}> Press me! </Text> </TouchableHighlight> Is there a way to mend this, or is it a bug in React Native? 回答1: TouchableOpacity works as I would have expected for TouchableHighlight (live code sample), so using TouchableOpacity