2

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

Ken
  • 4,367
  • 4
  • 28
  • 41

1 Answers1

0

onPressIn is followed by onPress, but if you haven't given onPress any logic to perform, then nothing will happen. You'll only get an onPressIn response, even though onPress is technically still triggered behind the scenes. (It's just a blank onPress).