In the android emulator, the following RN code does nothing (no log, no handler called)
<Pressable style={[styles.fullscreenContainer]}
onPressIn={()=> {console.log("onPress");this.props.touchHandler()}}>
However, if I insert a onPress
handler, in otherwise exactly the same code, both logs appear and both handlers are called when the component is pressed.
<Pressable style={[styles.fullscreenContainer]}
onPress= {()=> {console.log("onPress"); this.props.touchHandler()}}
onPressIn={()=> {console.log("onPressIn");this.props.touchHandler()}}>
Why does onPressIn
not work on its own?
FYI onPressIn
works correctly on iOS in the expo client
onPressIn
is followed byonPress
, but if you haven't givenonPress
any logic to perform, then nothing will happen. You'll only get anonPressIn
response, even thoughonPress
is technically still triggered behind the scenes. (It's just a blankonPress
).