fix: Fix issue with resolving camera view in Modal (#928)
* Fix issue with resolving camera view from frame processor for react-native Modal * Add missing import of UIManagerHelper
This commit is contained in:
parent
65d4d46f6a
commit
bea4aa8bb6
@ -6,6 +6,7 @@ import com.facebook.jni.HybridData
|
|||||||
import com.facebook.proguard.annotations.DoNotStrip
|
import com.facebook.proguard.annotations.DoNotStrip
|
||||||
import com.facebook.react.bridge.ReactApplicationContext
|
import com.facebook.react.bridge.ReactApplicationContext
|
||||||
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl
|
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl
|
||||||
|
import com.facebook.react.uimanager.UIManagerHelper
|
||||||
import com.mrousavy.camera.CameraView
|
import com.mrousavy.camera.CameraView
|
||||||
import com.mrousavy.camera.ViewNotFoundError
|
import com.mrousavy.camera.ViewNotFoundError
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
@ -60,7 +61,8 @@ class FrameProcessorRuntimeManager(context: ReactApplicationContext, frameProces
|
|||||||
@Keep
|
@Keep
|
||||||
fun findCameraViewById(viewId: Int): CameraView {
|
fun findCameraViewById(viewId: Int): CameraView {
|
||||||
Log.d(TAG, "Finding view $viewId...")
|
Log.d(TAG, "Finding view $viewId...")
|
||||||
val view = mContext?.get()?.currentActivity?.findViewById<CameraView>(viewId)
|
val ctx = mContext?.get()
|
||||||
|
val view = if (ctx != null) UIManagerHelper.getUIManager(ctx, viewId)?.resolveView(viewId) as CameraView? else null
|
||||||
Log.d(TAG, if (view != null) "Found view $viewId!" else "Couldn't find view $viewId!")
|
Log.d(TAG, if (view != null) "Found view $viewId!" else "Couldn't find view $viewId!")
|
||||||
return view ?: throw ViewNotFoundError(viewId)
|
return view ?: throw ViewNotFoundError(viewId)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user