Search code examples
reactjsreact-nativeeventspointer-events

React Native events do not fire


This is the body of my render() method. Why are none of these events firing?

return (
  <View
    style={{flex:1}}
    onPointerDown={e => this._events.emit("pointerdown", e)}
    onPointerUp  ={e => this._events.emit("pointerup",   e)}
    onPointerMove={e => this._events.emit("pointermove", e)}
  >
      ...
  </View>
);

This is inside my App.js file. I've tried replacing the event bodies with {console.log} and nothing is printed in my terminal or the web debug page.


Solution

  • These event are not firing because: onPointerUp, onPointerDown and onPointerMove aren't part of react-native's View props.

    If you want to handle touches, check those:

    https://facebook.github.io/react-native/docs/handling-touches

    or

    https://facebook.github.io/react-native/docs/view.html#synthetic-touch-events