From 530686ca823a1ade19481922033fbb22b59f95bf Mon Sep 17 00:00:00 2001 From: Seyed Mostafa Hasani Date: Wed, 3 Jul 2024 00:10:25 +0330 Subject: [PATCH] fix(android): build issue on the latest react-native version (#3963) --- .../main/java/com/brentvatne/react/ReactVideoPackage.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt b/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt index 99aed985..8db41eea 100644 --- a/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt +++ b/android/src/main/java/com/brentvatne/react/ReactVideoPackage.kt @@ -9,7 +9,7 @@ import com.facebook.react.bridge.NativeModule import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.uimanager.ViewManager -class ReactVideoPackage @JvmOverloads constructor(private var config: ReactExoplayerConfig? = null) : ReactPackage { +class ReactVideoPackage(private val config: ReactExoplayerConfig? = null) : ReactPackage { override fun createNativeModules(reactContext: ReactApplicationContext): List = listOf( @@ -21,9 +21,7 @@ class ReactVideoPackage @JvmOverloads constructor(private var config: ReactExopl fun createJSModules(): List> = emptyList() override fun createViewManagers(reactContext: ReactApplicationContext): List> { - if (config == null) { - config = DefaultReactExoplayerConfig(reactContext) - } - return listOf(ReactExoplayerViewManager(config!!)) + val effectiveConfig = config ?: DefaultReactExoplayerConfig(reactContext) + return listOf(ReactExoplayerViewManager(effectiveConfig)) } }