Skip to content

Commit fa48878

Browse files
authored
fix: Avoid calling getJSModule in init on Android (#3623)
sendAvailableDevicesChangedEvent() calls getJSModule from init, causing IllegalStateException: "getJSModule should only happen once initialize() has been called".
1 parent 82148d1 commit fa48878

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

package/android/src/main/java/com/mrousavy/camera/react/CameraDevicesManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ class CameraDevicesManager(private val reactContext: ReactApplicationContext) :
7171
} catch (error: Throwable) {
7272
Log.e(TAG, "Failed to initialize ProcessCameraProvider/ExtensionsManager! Error: ${error.message}", error)
7373
}
74-
sendAvailableDevicesChangedEvent()
7574
}
7675
}
7776

7877
// Note: initialize() will be called after getConstants on new arch!
7978
override fun initialize() {
8079
super.initialize()
8180
cameraManager.registerAvailabilityCallback(callback, null)
81+
sendAvailableDevicesChangedEvent()
8282
}
8383

8484
override fun invalidate() {

0 commit comments

Comments
 (0)