react-native-unistyles 2.5.3 → 2.5.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -48,7 +48,7 @@ class UnistylesInsets(private val reactApplicationContext: ReactApplicationConte
|
|
48
48
|
|
49
49
|
// available from Android 6.0
|
50
50
|
val window = reactApplicationContext.currentActivity?.window ?: return Insets(0, 0, 0, 0)
|
51
|
-
val systemInsets = window.decorView.rootWindowInsets
|
51
|
+
val systemInsets = window.decorView.rootWindowInsets ?: return Insets(0, 0, 0, 0)
|
52
52
|
|
53
53
|
val top = (systemInsets.systemWindowInsetTop / density).roundToInt()
|
54
54
|
val bottom = (systemInsets.systemWindowInsetBottom / density).roundToInt()
|
@@ -67,13 +67,14 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
67
67
|
|
68
68
|
@Deprecated("Deprecated in Java")
|
69
69
|
override fun onCatalystInstanceDestroy() {
|
70
|
-
val activity = currentActivity ?: return
|
71
|
-
|
72
70
|
this.stopLayoutListener()
|
73
71
|
reactApplicationContext.unregisterReceiver(configurationChangeReceiver)
|
74
72
|
runnable?.let { drawHandler.removeCallbacks(it) }
|
75
73
|
reactApplicationContext.removeLifecycleEventListener(this)
|
76
|
-
|
74
|
+
|
75
|
+
if (this.isCxxReady) {
|
76
|
+
this.nativeDestroy()
|
77
|
+
}
|
77
78
|
}
|
78
79
|
|
79
80
|
//endregion
|
@@ -144,7 +145,9 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
144
145
|
|
145
146
|
false
|
146
147
|
} catch (e: Exception) {
|
147
|
-
false
|
148
|
+
this.isCxxReady = false
|
149
|
+
|
150
|
+
return false
|
148
151
|
}
|
149
152
|
}
|
150
153
|
|
@@ -240,7 +243,6 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
240
243
|
override fun onHostResume() {
|
241
244
|
if (isCxxReady) {
|
242
245
|
this.onConfigChange()
|
243
|
-
this.onLayoutConfigChange()
|
244
246
|
}
|
245
247
|
|
246
248
|
this.setupLayoutListener()
|