1.npm i react-native-system-navigation-bar
2.在App.js或App.tsx引入
import SystemNavigationBar from 'react-native-system-navigation-bar';
调用SystemNavigationBar.fullScreen(true);
3.在项目中找到文件/android/app/src/main/res/values/styles.xml
添加
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
如图所示
最后重启项目即可