From e87c14a4375d47a03447716b1920608855df5d8d Mon Sep 17 00:00:00 2001 From: Krzysztof Moch Date: Sun, 31 Mar 2024 19:15:14 +0200 Subject: [PATCH] fix(android): update ui manager getter (#3634) --- .../com/brentvatne/react/VideoManagerModule.kt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/com/brentvatne/react/VideoManagerModule.kt b/android/src/main/java/com/brentvatne/react/VideoManagerModule.kt index 2680756b..e3adcd50 100644 --- a/android/src/main/java/com/brentvatne/react/VideoManagerModule.kt +++ b/android/src/main/java/com/brentvatne/react/VideoManagerModule.kt @@ -7,7 +7,8 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule import com.facebook.react.bridge.ReactMethod import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.UiThreadUtil -import com.facebook.react.uimanager.UIManagerModule +import com.facebook.react.uimanager.UIManagerHelper +import com.facebook.react.uimanager.common.UIManagerType import kotlin.math.roundToInt class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextBaseJavaModule(reactContext) { @@ -17,14 +18,12 @@ class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextB private fun performOnPlayerView(reactTag: Int, callback: (ReactExoplayerView?) -> Unit) { UiThreadUtil.runOnUiThread { - val view = if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { - reactApplicationContext.fabricUIManager?.resolveView( - reactTag - ) - } else { - val uiManager = reactApplicationContext.getNativeModule(UIManagerModule::class.java) - uiManager?.resolveView(reactTag) - } + val uiManager = UIManagerHelper.getUIManager( + reactApplicationContext, + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) UIManagerType.FABRIC else UIManagerType.DEFAULT + ) + + val view = uiManager?.resolveView(reactTag) if (view is ReactExoplayerView) { callback(view)