0

I am using react-native-navigtion and have 4 tabs. Tab 1 is the home screen, tabs 2-4 have a navigation stack in each. Tabs 2-4 are made up of a re-usable component so, there is no clear root component. When in the root screen of tabs 2-4, I want the android back button to take me to tab 1. I have found how to hook into the android back button, but I need to know if I am at the navigation root before sending a person to tab 1 (home).

Thanks in advance

Michael Campsall
  • 4,325
  • 11
  • 37
  • 52
  • 1
    Maybe a little off topic. Are you forced to use react-native-navigation? I switched to react-navigation and I can tell you it is much more flexible, easy and all JS so no need to link and you can do what you want since you have an index and reset stack options. – sebastianf182 Feb 10 '19 at 16:35
  • I miss this feature too in RNN, though one bit bad way of handling is with Navigation.events().registerComponentDidAppearListener(({ componentId, componentName }) => { //and here hold which view is on top and handle accordingly, either with redux store or whatever, so that other views can access this information }); – angelos_lex Feb 10 '19 at 22:11
  • @sfratini, When I made the decision to use RNN I had implemented both and much preferred RNN. I like the native animations and UI, and I found the API to be easier to use, particularly when passing props. – Michael Campsall Feb 11 '19 at 19:28
  • @angelos_lex I was hoping that RNN would be able to tell me this =( I might try this if I found no other solution...thanks. – Michael Campsall Feb 11 '19 at 19:29
  • react-navigation is way way better – Sarin Suriyakoon Jan 22 '20 at 02:04
  • react-navigation works fine if your views are simple, but once your views get more complex, you really need to move away from everything running in JS and have truly native views (at least that's what I've seen on my projects) – David Jones Oct 23 '20 at 13:02

0 Answers0