appandflow / appandflow/react-native-safe-area-context

Add documentation to enable notch on android

未關閉
#216 5 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
good first issue help wanted Platform: 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 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。