Skip to content
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

[Gestures] PanResponder blocking child Touchable on 6s and 6s plus #3082

Closed
deanmcpherson opened this issue Sep 28, 2015 · 40 comments · Fixed by maxs15/react-native-modalbox#20
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@deanmcpherson
Copy link
Contributor

I'm trying to fix an issue in a library (dancormier/react-native-swipeout#38) that appears to be broken on the 6s and 6s plus. The pan responder doesn't appear to allow touchable children to be pressed.

The library works on older devices with the same version of iOS, which makes me think that this has something to do with the new 3d touch hardware.

As noted in the other issue also, the library works in the emulator, but not the actual devices.

@ide ide changed the title PanResponder blocking child Touchable on 6s and 6s plus [Gestures] PanResponder blocking child Touchable on 6s and 6s plus Sep 28, 2015
@ide ide added the Platform: iOS iOS applications. label Sep 28, 2015
@aprilzero
Copy link

+1 – We're also experiencing this problem on new 3d touch phones.

The nested touchable highlights don't react visually to touch, and aren't clickable, but tapping quickly a few times often ends up working.

@aprilzero
Copy link

Could it be related to this iOS9 bug?

https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-9.1/#//apple_ref/doc/uid/TP40016570-CH1-DontLinkElementID_25 — "touch pressure changes cause touchesMoved: to be called"

@aprilzero
Copy link

Is this affecting anyone else? Or is PanResponder not really used often?

I'm worried that our app has become pretty much unusable for anyone with a new iPhone. Would love to find some sort of solution to this.

@myusuf3
Copy link
Contributor

myusuf3 commented Sep 30, 2015

+1 we are seeing the same thing here! @a2 @nicklockwood ideas?

@meznaric
Copy link

meznaric commented Oct 1, 2015

We had a same problem, fortunately only on a few places so we could easily fix it by checking if dy/ dx is not 0 before granting a PanResponder in onMoveShouldSetPanResponder.

On the bottom of the page @aprilzero linked is written:

Apps should be prepared to receive touch move events with no change in the x/y coordinates.

I guess from now on we will just have to check for actual movement before granting.

@aprilzero
Copy link

@meznaric 👏 thanks! That seems to fix the problem for us.

@jsierles
Copy link
Contributor

jsierles commented Oct 6, 2015

Same issue here - but with Navigator. A button close to the edge of the screen stops working. I've tried setting 'gestures: null' the routes sceneConfig, but this actually stops taps from working at all (only force touch works).

@ide ide mentioned this issue Oct 8, 2015
9 tasks
@tadeuzagallo
Copy link
Contributor

I tried the Navigator and react-native-swipeout and everything seemed to work as expected, can any of you guys provide a sample or more detailed repro steps?

@jsierles
Copy link
Contributor

jsierles commented Oct 9, 2015

My issue is actually different. A button which is normally easy to tap has its tappable area shifted off to its left edge. Kust got an iPhone 6s now and will post more info soon.

@chirag04
Copy link
Contributor

chirag04 commented Oct 9, 2015

I think our flashcards are broken(not tappable) on 6s because of this. This is just a higher level guess will debug today.

@jsierles
Copy link
Contributor

jsierles commented Oct 9, 2015

I solved my problem: I had a TouchableOpacity with a nested wrapper view, and both the touchable and nested view had been set to position: absolute. I'm not sure yet why this would work on iPhone6 and not 6s - but will debug further and see if I can isolate a test case.

For now, here's a gist with the broken and fixed component:

https://gist.github.com/jsierles/6ea15850dab3c65dceeb

More details:

logging in Touchable.js touchableHandleResponderMove, the touchState for the broken component, when doing a single tap, always looks like this:

2015-10-09 18:29:53.204 [info][tid:com.facebook.React.JavaScript] 'RESPONDER_ACTIVE_PRESS_IN'
2015-10-09 18:29:53.222 [info][tid:com.facebook.React.JavaScript] 'RESPONDER_ACTIVE_PRESS_OUT'

The fixed component only sets RESPONDER_ACTIVE_PRESS_IN.

@jsierles
Copy link
Contributor

I haven't had time to fully debug, but here's an example TouchableOpacity element that works on the iPhone6 but not 6s. You have to use a real device, not the simulator, to reproduce. Tapping on the large square fails ~80% of the time.

https://github.com/jsierles/RNiPhone6sTest

I fixed this by removing the redundant 'position: absolute' on the child view.

Maybe this can help get to the bottom of the issue.

@chirag04
Copy link
Contributor

I just tried to debug this on 6s(had to buy a new one).

This is definitely a problem with position: absolute in child views. I have a setup like this:

<TouchableWithoutFeedback>
    <View>
        <View style={position: absolute}  />
        <View style={position: absolute}  />
    </View>
</TouchableWithoutFeedback>

Changing it to this fixes it:

<TouchableWithoutFeedback>
    <View>
        <View  />
        <View style={position: absolute}  />
    </View>
</TouchableWithoutFeedback>

Note: touchesMove is always called on 6s while it's not always called for iphone < 6.

cc @tadeuzagallo above setup should help debug. It works on simulator, you need a 6s to reproduce it.

@deanmcpherson
Copy link
Contributor Author

My issue was resolved by @meznaric's comment

@h3l
Copy link

h3l commented Nov 18, 2015

i just find a not beautiful but convenient way to solve this problem(maxs15/react-native-modalbox#19)
just use onPressIn not onPress in Touchable.*

@neciu
Copy link
Contributor

neciu commented Dec 1, 2015

@meznaric's #3082 (comment) fixed the issue in my case.

I have side drawer with TouchableOpacity buttons and this PanResponder rule fixed the problem on iPhone 6s:

onMoveShouldSetPanResponderCapture: (evt, gestureState) => {
    return Math.abs(gestureState.dx) > 5;
},

👍 👏

@ceichinger
Copy link

@neciu it also solved it for me

@spacesuitdiver
Copy link

onMoveShouldSetPanResponderCapture: (evt, gestureState) => {
     return gestureState.dx != 0 && gestureState.dy != 0;
},

Worked for me (we are building a music player that drags up), the solution above with > 5 seemed to make the dragging action not sensitive enough.

@skleest
Copy link

skleest commented Mar 13, 2016

Worked--thanks everyone!

@jawish
Copy link

jawish commented Mar 21, 2016

Ran into this issue on a Note 5 running Android 5.1. Doesn't occur in the emulator but kills all Touchables when running on actual device.

@meznaric and @neciu solution fixed it right up. Thanks!

@WeIio
Copy link

WeIio commented Mar 23, 2017

@meznaric,Good suggestion!

@phanngoc
Copy link

phanngoc commented Mar 28, 2017

In my suitation, i need to set on both function:

onStartShouldSetPanResponderCapture: (evt, gestureState) => {
        console.log("onStartShouldSetPanResponderCapture", gestureState.dx,
          gestureState.dy);
        return gestureState.dx != 0 && gestureState.dy != 0;
      },
onMoveShouldSetPanResponderCapture: (evt, gestureState) => {
        console.log("onMoveShouldSetPanResponderCapture", gestureState.dx,
          gestureState.dy);
        return gestureState.dx != 0 && gestureState.dy != 0;
      },

But it make touch effect (blur) on start pharse of move touch although it don't init onPress function

@ghost
Copy link

ghost commented Apr 1, 2017

@phanngoc thx~

@benadamstyles
Copy link

This is still an issue and the proposed solution doesn't always work. Could it be re-opened? It doesn't seem like it should be expected behaviour...

@beau6183
Copy link

beau6183 commented Apr 3, 2017

Agreed, I'm seeing it as well.

@ericvicenti
Copy link
Contributor

Re-opening because this seems like a real issue.

Does it also happen on an iPhone 7?

A fix would be appreciated for this, if anybody can figure it out!

@ericvicenti ericvicenti reopened this Apr 3, 2017
@albinhubsch
Copy link

@ericvicenti yes this happens on iPhone 7 as well!

@benadamstyles
Copy link

Just an FYI – you can test whether this issue is happening in the simulator by clicking and holding on the touchable, moving your mouse away, then moving it back over the touchable. If the touchable appears pressed again (i.e. TouchableOpacity goes transparent or TouchableHighlight goes highlighted), you will not have the 3D Touch issue. If it doesn't, you will have this bug.

mannybatth pushed a commit to mannybatth/react-native-image-zoom that referenced this issue Jun 9, 2017
mannybatth pushed a commit to mannybatth/react-native-image-zoom that referenced this issue Jun 9, 2017
mannybatth pushed a commit to mannybatth/react-native-image-zoom that referenced this issue Jun 12, 2017
mannybatth pushed a commit to mannybatth/react-native-image-zoom that referenced this issue Jun 12, 2017
mannybatth pushed a commit to mannybatth/react-native-image-zoom that referenced this issue Jun 12, 2017
@hramos hramos added the Icebox label Jul 20, 2017
@hramos
Copy link
Contributor

hramos commented Jul 20, 2017

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:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

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.

@c-goettert
Copy link

Strange enough, @spacesuitdiver's fix wasn't working for me until I switched from TouchableWithoutFeedback to TouchableOpacity, then it worked..

@jbalakrishna
Copy link

@meznaric Your hack worked like a charm 🥇

@wcandillon
Copy link
Contributor

@meznaric thank you 💚Not sure why this issue is closed.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.