1

I'm using the NativeEventEmitter in both the parent and child to handle the same specific keyboard event (when F6 is pressed) in the parent and the child components. They both have their own, different callbacks to handle when this when this key is pressed.

When it's pressed in the child, I don't want the parent's listener to fire. There isn't a stopPropogation method in React Native like there is in standard React.

<Parent>
    <Child/>
</Parent>

1 Answers1

-2

stopPropagation is a built in javascript function in the event API MDN Event.stopPropagation. So that should be available on a native event.

Alternatively, you can check the target of the event and return false from the parent handler if the target is the child.

varontron
  • 1,120
  • 7
  • 21