LocationX, locationY behaves differently on Android vs iOS
Sharcoux opened this issue · comments
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
On Android, GestureEvent
location seem to be relative to the View the event is currently above, and not the component the listener is attached to. On iOS it is the opposite.
Note that the web implementation seems to follow the iOS behavior.
React Native version:
Run react-native info
in your terminal and copy the results here.
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Create a View with a padding of 100
- Within this view, create a View with
onMoveShouldSetResponder={() => true}
and listenonResponderMove={event => console.log(event.nativeEvent.locationX)}
- Move through the inner View vertically.
Expected Results
The value of locationX should not change when crossing the inner View vertically
Actual Results
When outside the inner View, the location of the event is relative to the outer View. The event is changing its reference. This is probably not the expected behavior because:
- iOS works as expected
- react-native-web works as expected
- Working with an event that can change of referential mid-way would be very troublesome for devs.
Snack, code example, screenshot, or link to a repository:
same issue
I'm also encountering the same problem.
I think that the error resides within this file. The x and y coordinates should be translated from the target of the touch event to the target of the event listener.
Can confirm this issue still exists...