kadiraydinli / react-native-system-navigation-bar

React Native lets you customize the navigation bar for Android.
https://www.npmjs.com/package/react-native-system-navigation-bar
MIT License
270 stars 19 forks source link

how to toggle immersive #15

Closed tsvetann closed 2 years ago

tsvetann commented 2 years ago

What's the proper way to toggle immersive mode? I would only like to have immersive mode on a specific screen. navigationShow?

kadiraydinli commented 2 years ago

Hi, you can place the immersive mode on the screen where you want to use it, as in the example below. When you leave the screen, you can restore it with navigationShow.

React.useEffect(() => {
  SystemNavigationBar.stickyImmersive();
  return () => {
    SystemNavigationBar.navigationShow();
  };
}, []);
tsvetann commented 2 years ago

@kadiraydinli that's exactly what I ended up doing but wanted to double check if this is the best practice. Thanks for helping