-
Notifications
You must be signed in to change notification settings - Fork 1.8k
TouchableOpacity triggering <input> and <TextInput> #1164
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
Comments
i think this is caused by my solution is to disable the if ('ontouchstart' in window) {
let stop = e => {
return e.stopPropagation();
};
document.body.addEventListener('mousemove', stop, true);
document.body.addEventListener('mousedown', stop, true);
document.body.addEventListener('mouseup', stop, true);
}
and if app is runnning on pc, |
There are PC with touch screen so the single window check is not safe |
ok, but it works indeed. the problem is that if touch is supported on a device, then ignore mouse event; otherwise, use mouse event. |
I'm having a similar issue I think, where the onPress doesn't get called, most of the time, but in my case it doesn't matter what the first child is, and it happens if I'm in chrome desktop, but not in chrome mobile (responsive) neither in safari. related to #1124 |
Closing this issue so we can coordinate findings and solutions in #1219 |
The problem
On safari mobile, TouchableOpacity will trigger another component at the same location when changing views (if second component is an
"<input>"
or"<TextInput>"
).<input>
example provided below. Similar behavior for a TextInput at same location; however, unable to reproduce succinctly in sandbox (using Redux Form for this implementation).How to reproduce
https://codesandbox.io/s/6njwzqojnr
(I tried to minimize redux / router code).
If you load on mobile safari on iPhone and click the upper left of the first component (i.e.TouchableOpacity, blue) it will trigger the second component (i.e.
<input>
, red).Steps to reproduce:
Expected behavior
Expected touchstart and touchend events only.
(Using safari devtools hooked up to my iPhone, recorded events are: touchstart, touchend, mouseover, mousemove, mousedown, mouseup, and click (<-- targets the input file). In my app, the final click gets fired twice, even.
RNW: 0.9.6
RN: 0.57.4
Browser: Safari (iOS12, iPhone 7)
The text was updated successfully, but these errors were encountered: