I'm trying to consolidate the various issues around this into one place so it can finally be tackled. The related issues I have found are:
https://github.com/facebook/react-native/issues/3082 *
https://github.com/facebook/react-native/issues/10822
https://github.com/facebook/react-native/issues/10386
The issue is that Touchable*#onPress doesn't work on iOS devices with 3D Touch, if any pressure is applied, when the component wrapped by the Touchable* has position: 'absolute'. I think this has to do with touchmove events (or equivalent) being triggered by 3D Touch (possibly in the z direction?). A quick fix is to wrap your Touchable* in a View, giving this outer view position: 'absolute', and removing position: 'absolute' from the View inside your Touchable*.
There is a related problem about the same incorrect behaviour applying to Touchables within a ScrollView (see * above) but this involves PanResponder and becomes much more complicated. I have a feeling (totally unfounded) that fixing this bug might go some (or all the) way towards fixing that bug.
// onPress never called if 3D Touch is present and any pressure is applied
<TouchableOpacity onPress={() => {}}>
<View style={{position: 'absolute'}}>
<Text>Press me</Text>
</View>
</TouchableOpacity>
I think this is a bug and requires either:
Touchable* should not have position: 'absolute' (but the parent _can_)react-native fixIn my case, the View inside the TouchableOpacity doesn't have the position absolute style, but if you press gently enough, it does work, but if you press normally then it doesn't work.
I have seen some post in which the solution is to use onPressIn instead, and it does the trick but when you have a bunch of touchables inside a scroll view, then you can't scroll because the onPressIn is called immediately after touched
I have seen some post in which the solution is to use onPressIn instead, and it does the trick
@linoleum00 Another related reason why this solution is unsatisfactory is that if you use onPressIn, the user can't cancel their tap by moving their finger away, which is a fundamental aspect of touch interaction.
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
This is still an issue, and I have reproduced it on React Native v0.47. All the information required is in my original post above. Lack of activity !== resolution!
This is a big issue still in RN49. Actually this looks like a solution but I guess it would be better to implement that inside RN itself.
Still an issue in 0.51
Yes, its still an issue in 0.51 :(
react-native: 0.51.0 still not work
still not working in 0.53.3, no other solutions seem to work for me.
This is still an issue.
Issue still exist.
Still an issue.
issue still exists on RN 0.55.4, none of the solutions mentioned in other threads are working when TouchableOpactity is rendered inside of position: 'absolute' View.
We noticed that very few people actually use 3D Touch so we recently removed a bunch of features related to it, so I'm going to close this as wontfix.
Most helpful comment
This is still an issue, and I have reproduced it on React Native v0.47. All the information required is in my original post above. Lack of activity
!==resolution!