2 Answers2

0

You have to use this code to hide the navigation bar:

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            mActivity.getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
                    View.SYSTEM_UI_FLAG_FULLSCREEN |
                    View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
                    //View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

With fullscreen options you can hide status bar too and with Immersive sticky you can get the navigation and status bar again sliding your finger.

To remove this options use the following code:

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            View decorView = mActivity.getWindow().getDecorView();
            int uiOptions = decorView.getSystemUiVisibility();

            uiOptions  &= ~View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
            uiOptions  &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
            uiOptions  &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
            uiOptions  &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

            decorView.setSystemUiVisibility(uiOptions);
}
0

you can use react-native-full-screen which provide full screen control You can put that on componentDidmount or useeffect method with FullScreen.onFullScreen();

Mayank Pandav
  • 425
  • 5
  • 20