Merge pull request #695 from lukailun/fix/support_rn_0.77
feat: Support RN 0.77
This commit is contained in:
commit
e449cfd25c
@ -64,7 +64,7 @@ class RNCameraKitModule(private val reactContext: ReactApplicationContext) : Nat
|
||||
* Captures a photo using the camera.
|
||||
*
|
||||
* @param options The options for the capture operation.
|
||||
* @param viewTag The tag of the camera view.
|
||||
* @param tag The tag of the camera view.
|
||||
* @param promise The promise to resolve the capture result.
|
||||
*/
|
||||
@ReactMethod
|
||||
@ -74,7 +74,19 @@ class RNCameraKitModule(private val reactContext: ReactApplicationContext) : Nat
|
||||
val uiManager = UIManagerHelper.getUIManagerForReactTag(reactContext, viewTag)
|
||||
reactContext.runOnUiQueueThread {
|
||||
val camera = uiManager?.resolveView(viewTag) as CKCamera
|
||||
camera.capture(options.toHashMap(), promise)
|
||||
val optionsMap = options.toHashMap()
|
||||
.mapValues { (_, value) ->
|
||||
when (value) {
|
||||
is ReadableMap -> value.toHashMap()
|
||||
is ReadableArray -> value.toArrayList()
|
||||
else -> value
|
||||
}
|
||||
}
|
||||
.mapNotNull { (key, value) ->
|
||||
if (value != null) key to value else null
|
||||
}
|
||||
.toMap()
|
||||
camera.capture(optionsMap, promise)
|
||||
}
|
||||
} else {
|
||||
promise.reject("E_CAPTURE_FAILED", "options or/and tag arguments are null, options: $options, tag: $viewTag")
|
||||
|
||||
@ -12,10 +12,11 @@ package com.facebook.react.viewmanagers;
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.ColorPropConverter;
|
||||
import com.facebook.react.uimanager.BaseViewManager;
|
||||
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
||||
import com.facebook.react.uimanager.BaseViewManagerInterface;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
|
||||
public class CKCameraManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & CKCameraManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
||||
public class CKCameraManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & CKCameraManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
||||
public CKCameraManagerDelegate(U viewManager) {
|
||||
super(viewManager);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user