Skip to content

Commit

Permalink
fix(android): update ui manager getter (TheWidlarzGroup#3634)
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch authored Mar 31, 2024
1 parent 0fa0086 commit e87c14a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions android/src/main/java/com/brentvatne/react/VideoManagerModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit e87c14a

Please sign in to comment.