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)) } }