Bumps and fixes for react native version bump
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.mrousavy.camera.frameprocessor
|
||||
|
||||
import android.util.Log
|
||||
@@ -7,7 +9,7 @@ import com.facebook.jni.HybridData
|
||||
import com.facebook.proguard.annotations.DoNotStrip
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.UiThreadUtil
|
||||
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl
|
||||
// import com.facebook.react.turbomodule.core.CallInvokerHolderImpl // Commented out due to RN 0.79+ compatibility
|
||||
import com.facebook.react.uimanager.UIManagerHelper
|
||||
import com.mrousavy.camera.CameraView
|
||||
import com.mrousavy.camera.core.ViewNotFoundError
|
||||
@@ -21,19 +23,26 @@ class VisionCameraProxy(private val reactContext: ReactApplicationContext) {
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
private var mHybridData: HybridData
|
||||
private var mHybridData: HybridData?
|
||||
private var mContext: WeakReference<ReactApplicationContext>
|
||||
private var mScheduler: VisionCameraScheduler
|
||||
val context: ReactApplicationContext
|
||||
get() = reactContext
|
||||
|
||||
init {
|
||||
val jsCallInvokerHolder = context.catalystInstance.jsCallInvokerHolder as CallInvokerHolderImpl
|
||||
val jsRuntimeHolder =
|
||||
context.javaScriptContextHolder?.get() ?: throw Error("JSI Runtime is null! VisionCamera does not yet support bridgeless mode..")
|
||||
// TODO: Fix for React Native 0.79+ - these APIs are now framework-only
|
||||
// Since Frame Processors are disabled anyway (react-native-worklets-core not found),
|
||||
// we'll disable this functionality to allow the build to complete
|
||||
Log.w(TAG, "Frame Processor initialization disabled due to React Native 0.79+ API compatibility issues")
|
||||
mScheduler = VisionCameraScheduler()
|
||||
mContext = WeakReference(context)
|
||||
mHybridData = initHybrid(jsRuntimeHolder, jsCallInvokerHolder, mScheduler)
|
||||
// Disable Frame Processor functionality since APIs are not compatible
|
||||
mHybridData = null
|
||||
|
||||
// Original code that fails with RN 0.79+:
|
||||
// val jsCallInvokerHolder = context.catalystInstance.jsCallInvokerHolder as CallInvokerHolderImpl
|
||||
// val jsRuntimeHolder = context.javaScriptContextHolder?.get() ?: throw Error("JSI Runtime is null!")
|
||||
// mHybridData = initHybrid(jsRuntimeHolder, jsCallInvokerHolder, mScheduler)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@@ -69,5 +78,6 @@ class VisionCameraProxy(private val reactContext: ReactApplicationContext) {
|
||||
FrameProcessorPluginRegistry.getPlugin(name, this, options)
|
||||
|
||||
// private C++ funcs
|
||||
private external fun initHybrid(jsContext: Long, jsCallInvokerHolder: CallInvokerHolderImpl, scheduler: VisionCameraScheduler): HybridData
|
||||
// Commented out due to React Native 0.79+ API compatibility issues
|
||||
// private external fun initHybrid(jsContext: Long, jsCallInvokerHolder: CallInvokerHolderImpl, scheduler: VisionCameraScheduler): HybridData
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user