Can NavigatorIOS notify that a “back” happened?

Not sure if I’m missing something, but does NavigatorIOS have a way of notifying its owner that there is a new top route because the “<” back button was pressed? Otherwise, to get that functionality, the removed component would have to itself notify during componentWillUnmount, and that just feels weird.

2 thoughts on “Can NavigatorIOS notify that a “back” happened?

  1. @phpfalcon basically, there is a singleton that is imported to all components that are views needing to have “onBack” event. The singleton is named “onBackStack” which is just a simple array.

    Each component needing an “onBack” would then push themselves into the onBackStack on their own componentWillMount. On componentWillUnmount, they remove themselves off the stack but then call the method of the last item in the list’s onBack() so to fire the event of the component it is going back to. It’s kind of like a cooperative chaining of components to accomplish this.

    This can be put into a component class then inherited from which is probably a way better idea. I just made it very quickly as I don’t care to make it more robust or friendly for what I am doing.

  2. Pingback: 메이저놀이터

Comments are closed.