diff --git a/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt b/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt index 5d92778f65..8c70876ef4 100644 --- a/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +++ b/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt @@ -4,6 +4,8 @@ import com.facebook.react.bridge.JSApplicationIllegalArgumentException import com.facebook.react.bridge.ReadableMap import com.facebook.react.common.MapBuilder import com.facebook.react.module.annotations.ReactModule +import com.facebook.react.uimanager.ReactStylesDiffMap +import com.facebook.react.uimanager.StateWrapper import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.ViewGroupManager import com.facebook.react.uimanager.ViewManagerDelegate @@ -35,6 +37,18 @@ class ScreenViewManager : ViewGroupManager(), RNSScreenManagerInterface< setActivityState(view, activityState.toInt()) } + override fun updateState( + view: Screen, + props: ReactStylesDiffMap?, + stateWrapper: StateWrapper? + ): Any? { + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // fabricViewStateManager should never be null in Fabric. The null check is only for Paper's empty impl. + view.fabricViewStateManager?.setStateWrapper(stateWrapper) + } + return super.updateState(view, props, stateWrapper) + } + @ReactProp(name = "activityState") fun setActivityState(view: Screen, activityState: Int) { if (activityState == -1) { diff --git a/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt b/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt index 106638858d..6c1c238bd6 100644 --- a/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +++ b/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt @@ -2,8 +2,12 @@ package com.swmansion.rnscreens import android.view.ViewGroup import com.facebook.react.bridge.ReactContext +import com.facebook.react.uimanager.FabricViewStateManager abstract class FabricEnabledViewGroup constructor(context: ReactContext?) : ViewGroup(context) { + + val fabricViewStateManager get() = null as FabricViewStateManager? + protected fun updateScreenSizeFabric(width: Int, height: Int) { // do nothing }