react-navigation.github.io icon indicating copy to clipboard operation
react-navigation.github.io copied to clipboard

Open a modal from a tab bar

Open brentvatne opened this issue 6 years ago • 15 comments

Moved over from https://github.com/react-navigation/react-navigation/issues/3003 @spencercarli came up with this solution: https://snack.expo.io/SyJKMkFUM We might need to change the API a bit to make it cleaner but we can document this approach for now!


  • If you're suggesting a change/improvement, tell us how it should work

It would be great to get documentation done for this "open modal from tab bar" layout. I've seen it asked a bunch of times in different places as it's a very common/popular requirement.

While not as helpful as writing documentation myself, here are some of the places this was asked, to show it would be useful to have it in the official docs:

  • https://stackoverflow.com/questions/46725173/react-navigation-tabnavigator-show-modal
  • https://stackoverflow.com/questions/42731093/how-to-push-a-modal-screen-using-reactnavigation
  • https://stackoverflow.com/questions/45520898/react-navigation-and-modal-tab-item
  • https://stackoverflow.com/questions/46725173/react-navigation-tabnavigator-show-modal
  • https://stackoverflow.com/questions/46106117/tabnavigator-with-a-modal-popup-with-react-navigation-like-instagram
  • https://stackoverflow.com/questions/42398911/how-do-i-make-a-tabnavigator-button-push-a-modal-screen-with-react-navigation
  • https://github.com/react-community/react-navigation/pull/525
  • https://github.com/react-community/react-navigation/issues/314
  • https://github.com/react-community/react-navigation/issues/1059
  • https://github.com/react-community/react-navigation/issues/1576
  • https://github.com/react-community/react-navigation/issues/2259
  • https://github.com/react-community/react-navigation/issues/1734
  • https://github.com/react-community/react-navigation/issues/770

@TomAtterton seems to have a solution in this issue

https://github.com/react-community/react-navigation/issues/1576

He also left the same comment here:

https://stackoverflow.com/questions/42398911/how-do-i-make-a-tabnavigator-button-push-a-modal-screen-with-react-navigation

Anyway, best practice or not, Tom seems to have the only solution? Maybe he could give a slightly longer form answer and that can be used for docs? @spencercarli

I will try to write something up potentially.

brentvatne avatar Feb 07 '18 20:02 brentvatne