|
@@ -2,6 +2,7 @@ package com.th3rdwave.safeareacontext;
|
2
|
2
|
|
3
|
3
|
import android.app.Activity;
|
4
|
4
|
import android.content.Context;
|
|
5
|
+import android.view.View;
|
5
|
6
|
import android.view.WindowManager;
|
6
|
7
|
|
7
|
8
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
@@ -66,9 +67,18 @@ public class SafeAreaViewManager extends ViewGroupManager<SafeAreaView> {
|
66
|
67
|
return null;
|
67
|
68
|
}
|
68
|
69
|
|
69
|
|
- EdgeInsets insets = SafeAreaUtils.getSafeAreaInsets(mWindowManager, activity.getWindow().getDecorView());
|
|
70
|
+ View decorView = activity.getWindow().getDecorView();
|
|
71
|
+ if (decorView == null) {
|
|
72
|
+ return null;
|
|
73
|
+ }
|
|
74
|
+
|
|
75
|
+ EdgeInsets insets = SafeAreaUtils.getSafeAreaInsets(mWindowManager, decorView);
|
|
76
|
+ if (insets == null) {
|
|
77
|
+ return null;
|
|
78
|
+ }
|
70
|
79
|
return MapBuilder.<String, Object>of(
|
71
|
80
|
"initialWindowSafeAreaInsets",
|
72
|
81
|
SafeAreaUtils.edgeInsetsToJavaMap(insets));
|
|
82
|
+
|
73
|
83
|
}
|
74
|
84
|
}
|