Last active
June 11, 2019 02:58
-
-
Save mykltronn/55da0eb5d7895204ada93be3680b16df to your computer and use it in GitHub Desktop.
Globally disable Android software navigation bar in React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.myApp; | |
. . . | |
// imports | |
. . . | |
public class MainActivity extends ReactActivity { | |
@Override | |
protected String getMainComponentName() { | |
return "MyApp"; | |
} | |
+ @Override | |
+ public void onWindowFocusChanged(boolean hasFocus) { | |
+ super.onWindowFocusChanged(hasFocus); | |
+ if (hasFocus) { | |
+ hideNavigationBar(); | |
+ } | |
+ } | |
. . . | |
private void hideNavigationBar() { | |
getWindow().getDecorView().setSystemUiVisibility( | |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | |
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_FULLSCREEN | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment