appandflow / appandflow/react-native-safe-area-context
Add documentation to enable notch on android
- 主要語言
- TypeScript
- 星號
- 2.8k
- 分支
- 258
- 平均合併
- 3 天 1 小時
- 30 天內合併 PR
- 2
描述
It might be convenient to include the needed android config to enable notches here
Add these lines to MainActivity.java
```
import android.view.WindowManager;
import android.os.Build;
import android.os.Bundle;
...
protected void onCreate(Bundle savedInstanceState) { <-- existing
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
getWindow().setAttributes(layoutParams);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
super.onCreate(savedInstanceState); <-- existing
...
```
Credit:
https://dev.to/brunolemos/adding-notch-support-to-your-react-native-android-app-3ci3
https://stackoverflow.com/a/29311321
貢獻指南
評估
這個 Issue 還沒有評估資料。