fix(android): update ui manager getter (#3634)

This commit is contained in:
Krzysztof Moch 2024-03-31 19:15:14 +02:00 committed by GitHub
parent 0fa0086a39
commit e87c14a437
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,8 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.UiThreadUtil 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 import kotlin.math.roundToInt
class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextBaseJavaModule(reactContext) { class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextBaseJavaModule(reactContext) {
@ -17,14 +18,12 @@ class VideoManagerModule(reactContext: ReactApplicationContext?) : ReactContextB
private fun performOnPlayerView(reactTag: Int, callback: (ReactExoplayerView?) -> Unit) { private fun performOnPlayerView(reactTag: Int, callback: (ReactExoplayerView?) -> Unit) {
UiThreadUtil.runOnUiThread { UiThreadUtil.runOnUiThread {
val view = if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { val uiManager = UIManagerHelper.getUIManager(
reactApplicationContext.fabricUIManager?.resolveView( reactApplicationContext,
reactTag if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) UIManagerType.FABRIC else UIManagerType.DEFAULT
) )
} else {
val uiManager = reactApplicationContext.getNativeModule(UIManagerModule::class.java) val view = uiManager?.resolveView(reactTag)
uiManager?.resolveView(reactTag)
}
if (view is ReactExoplayerView) { if (view is ReactExoplayerView) {
callback(view) callback(view)