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

Add documentation to enable notch on android

Ouverte
#216 5 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
good first issue help wanted Platform: Android
Langage dominant
TypeScript
Étoiles
2.8k
Forks
258
Merge moyen
3 j 1 h
PR mergées (30 j)
2

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.