@@ -5,20 +5,21 @@ import androidx.annotation.UiThread
5
5
import com.facebook.react.bridge.ReactContext
6
6
import com.facebook.react.bridge.WritableMap
7
7
import com.facebook.react.bridge.WritableNativeMap
8
- import com.facebook.react.uimanager.FabricViewStateManager
9
8
import com.facebook.react.uimanager.PixelUtil
9
+ import com.facebook.react.uimanager.StateWrapper
10
10
import kotlin.math.abs
11
11
12
- abstract class FabricEnabledViewGroup constructor (
12
+ abstract class FabricEnabledViewGroup (
13
13
context : ReactContext ? ,
14
- ) : ViewGroup(context),
15
- FabricViewStateManager .HasFabricViewStateManager {
16
- private val mFabricViewStateManager: FabricViewStateManager = FabricViewStateManager ()
14
+ ) : ViewGroup(context) {
15
+ private var mStateWrapper: StateWrapper ? = null
17
16
18
17
private var lastSetWidth = 0f
19
18
private var lastSetHeight = 0f
20
19
21
- override fun getFabricViewStateManager (): FabricViewStateManager = mFabricViewStateManager
20
+ fun setStateWrapper (wrapper : StateWrapper ? ) {
21
+ mStateWrapper = wrapper
22
+ }
22
23
23
24
protected fun updateScreenSizeFabric (
24
25
width : Int ,
@@ -48,14 +49,11 @@ abstract class FabricEnabledViewGroup constructor(
48
49
49
50
lastSetWidth = realWidth
50
51
lastSetHeight = realHeight
51
-
52
- mFabricViewStateManager.setState {
53
- val map: WritableMap = WritableNativeMap ()
54
- map.putDouble(" frameWidth" , realWidth.toDouble())
55
- map.putDouble(" frameHeight" , realHeight.toDouble())
56
- map.putDouble(" contentOffsetX" , 0.0 )
57
- map.putDouble(" contentOffsetY" , headerHeight)
58
- map
59
- }
52
+ val map: WritableMap = WritableNativeMap ()
53
+ map.putDouble(" frameWidth" , realWidth.toDouble())
54
+ map.putDouble(" frameHeight" , realHeight.toDouble())
55
+ map.putDouble(" contentOffsetX" , 0.0 )
56
+ map.putDouble(" contentOffsetY" , headerHeight)
57
+ mStateWrapper?.updateState(map)
60
58
}
61
59
}
0 commit comments