Skip to content

Commit b401ae2

Browse files
committed
Merge branch 'main' into v4
2 parents 688acd8 + 5223f5b commit b401ae2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

package/android/src/main/java/com/mrousavy/camera/CameraViewModule.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.facebook.react.module.annotations.ReactModule
99
import com.facebook.react.modules.core.PermissionAwareActivity
1010
import com.facebook.react.modules.core.PermissionListener
1111
import com.facebook.react.uimanager.UIManagerHelper
12+
import com.facebook.react.uimanager.common.UIManagerType
1213
import com.mrousavy.camera.core.CameraError
1314
import com.mrousavy.camera.core.CameraQueues
1415
import com.mrousavy.camera.core.ViewNotFoundError
@@ -53,12 +54,11 @@ class CameraViewModule(reactContext: ReactApplicationContext) : ReactContextBase
5354
Log.d(TAG, "Finding view $viewId...")
5455
val context = reactApplicationContext ?: throw Error("React Context was null!")
5556

56-
val view = UIManagerHelper.getUIManager(
57-
context,
58-
viewId
59-
)?.resolveView(viewId) as CameraView?
60-
Log.d(TAG, if (view != null) "Found view $viewId!" else "Couldn't find view $viewId!")
61-
if (view == null) throw ViewNotFoundError(viewId)
57+
val uiManagerType = if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) UIManagerType.FABRIC else UIManagerType.DEFAULT
58+
val uiManager = UIManagerHelper.getUIManager(context, uiManagerType) ?: throw Error("UIManager not found!")
59+
60+
val view = uiManager.resolveView(viewId) as? CameraView ?: throw ViewNotFoundError(viewId)
61+
Log.d(TAG, "Found view $viewId!")
6262
return@runOnUiThreadAndWait view
6363
}
6464

0 commit comments

Comments
 (0)