Skip to content

Commit ea364c2

Browse files
authored
Fix crash due to java2kotlin refactor (#8095) (#8099)
1 parent 1ed07f4 commit ea364c2

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ import androidx.core.view.WindowInsetsControllerCompat
1212
import kotlin.math.abs
1313
import kotlin.math.ceil
1414

15-
1615
object SystemUiUtils {
1716
private const val STATUS_BAR_HEIGHT_M = 24
1817
internal const val STATUS_BAR_HEIGHT_TRANSLUCENCY = 0.65f
1918
private var statusBarHeight = -1
2019
var navigationBarDefaultColor = -1
2120
private set
2221

23-
2422
@JvmStatic
2523
fun getStatusBarHeight(activity: Activity?): Int {
2624
val res = if (statusBarHeight > 0) {
@@ -167,4 +165,4 @@ object SystemUiUtils {
167165
}
168166
}
169167

170-
}
168+
}

lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/statusbar/StatusBarPresenter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ class StatusBarPresenter private constructor(
120120

121121
private fun setStatusBarVisible(viewController: ViewController<*>, visible: Bool) {
122122
val window = window.get() ?: return
123-
val view = if (viewController.view != null) viewController.view else window.decorView
123+
val view = viewController.peekView() ?: window.decorView
124+
124125
if (visible.isFalse) {
125126
hideStatusBar(window, view)
126127
} else {

lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ public void attachView(ViewGroup parent, int index) {
254254
if (view.getParent() == null) parent.addView(view, index);
255255
}
256256

257+
@Nullable
258+
public T peekView() {
259+
return view;
260+
}
261+
257262
public String getId() {
258263
return id;
259264
}

0 commit comments

Comments
 (0)