diff --git a/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt b/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt index 7fa727671c..b6891248b4 100644 --- a/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +++ b/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt @@ -14,6 +14,7 @@ import com.facebook.react.ReactRootView import com.facebook.react.bridge.ReactContext import com.facebook.react.modules.core.ChoreographerCompat import com.facebook.react.modules.core.ReactChoreographer +import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.UIManagerHelper import com.swmansion.rnscreens.Screen.ActivityState import com.swmansion.rnscreens.events.ScreenDismissedEvent @@ -318,7 +319,7 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) { // The exception to this rule is `updateImmediately` which is triggered by actions // not connected to React view hierarchy changes, but rather internal events needsUpdate = true - (context.applicationContext as? ReactContext)?.runOnUiQueueThread { + (context as ThemedReactContext).reactApplicationContext.runOnUiQueueThread { // We schedule the update here because LayoutAnimations of `react-native-reanimated` // sometimes attach/detach screens after the layout block of `ScreensShadowNode` has // already run, and we want to update the container then too. In the other cases, @@ -326,6 +327,7 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) { // will already be false. performUpdates() } + } protected fun performUpdatesNow() {