react-native-system-bars 라이브러리 활용하니 깔끔하게 바로 적용 됩니다.
yarn add react-native-system-bars
아래의 코드 index.js에 넣어줍니다.
import AndroidSystemBars from "react-native-system-bars";
// Go immersive (i.e. hide status bar and nav bar)
AndroidSystemBars.setSystemUIVisibility(
'SYSTEM_UI_FLAG_IMMERSIVE',
'SYSTEM_UI_FLAG_FULLSCREEN',
'SYSTEM_UI_FLAG_HIDE_NAVIGATION'
);
// Show status bar and nav bar
AndroidSystemBars.setSystemUIVisibility('SYSTEM_UI_FLAG_VISIBLE');
AndroidSystemBars.clearFlags();
AndroidSystemBars.setContentBehindSystemBars();
AndroidSystemBars.dimSystemBars();
AndroidSystemBars.hideStatusBar();
AndroidSystemBars.hideNavigationBar();
AndroidSystemBars.hideStatusAndNavigationBars();
AndroidSystemBars.enableFullScreenMode('immersive', /*preventResizing (optional)*/true);
AndroidSystemBars.enableFullScreenMode('sticky-immersive', /*preventResizing (optional)*/true);
AndroidSystemBars.enableFullScreenMode('lean-back', /*preventResizing (optional)*/true);