-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TouchableWithoutFeedback does not fire onPress like other Touchable Components #23740
Comments
Repro Snack: https://snack.expo.io/@jkcooper/rn23740-touchablewithoutfeedback-wrapping-custom-component Seems to affect both iOS and android |
@haddow777 you are right. Other touchable components wraps child content to another |
Should there be a View inside a TouchableWithoutFeedback element? Im not sure what effect that would have on existing usages |
Dear @haddow777 and @radeno |
Using latest react-native (0.59.5), I can't make a No issues with Opacity/Highlight touchable components. eg: <FlatList
data={data}
renderItem={({item, separators}) => (
<TouchableNativeFeedback
onPress={() => onPress(item.key)}
>
<View style={{flex: 1}}>
<Text>FooBar</Text>
</View>
</TouchableNativeFeedback>
)}
/> |
Hello there 👋 by using the repro / the list of steps to reproduce, we can't actually see the reported bug on RN 0.59.5 so we'll close this issue. It may have something to do with your local setup, please double check that you are using the correct version of Android Studio / XCode / Android NDK / Yarn / etc. |
I'm on 0.59.8 and I can confirm that this issue is present. My |
🐛 Bug Report
Same as closed bug #18611
TouchableWithoutFeedback does not call the onPress handler unless it's direct child is a View Component. This is counter to the fact that other touchable components will allow custom components as their child.
To Reproduce
Expected Behavior
I would think that the expected behavior would be that the onPress event would be fired no matter what child component the TouchableWithoutFeedback component
Code Example
https://github.com/haddow777/tech_stack
Specifically look at the file ./src/components/ListItem.js. That is where the TouchableWithoutFeedback component is used. In it's current state, the event does not fire. If I encapsulate the current children in a View component tag, the event will fire. I changed the TouchableWithoutFeedback with a TouchableOpacity component without the View component child, and the onPress fires. It seems they should both work the same.
Environment
Android Emulator api 27
The text was updated successfully, but these errors were encountered: