Fixed support for RN 0.76 and other older RN versions

Removed includesGeneratedCode since it's unreliable and is temporary
Added new/old arch code split for Android
This commit is contained in:
Seph Soliman 2025-09-08 18:19:18 -07:00
parent 9ef0601144
commit 84d11bfc58
58 changed files with 1548 additions and 4037 deletions

View File

@ -36,7 +36,11 @@ android {
sourceSets {
main {
java.srcDirs += 'generated'
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch']
} else {
java.srcDirs += ['src/oldarch']
}
}
}
}

View File

@ -1,48 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleJavaSpec.js
*
* @nolint
*/
package com.facebook.fbreact.specs;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class NativeCameraKitModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
public static final String NAME = "RNCameraKitModule";
public NativeCameraKitModuleSpec(ReactApplicationContext reactContext) {
super(reactContext);
}
@Override
public @Nonnull String getName() {
return NAME;
}
@ReactMethod
@DoNotStrip
public abstract void capture(@Nullable ReadableMap options, @Nullable Double tag, Promise promise);
@ReactMethod
@DoNotStrip
public abstract void requestDeviceCameraAuthorization(Promise promise);
@ReactMethod
@DoNotStrip
public abstract void checkDeviceCameraAuthorizationStatus(Promise promise);
}

View File

@ -1,97 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ColorPropConverter;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.LayoutShadowNode;
public class CKCameraManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & CKCameraManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public CKCameraManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "flashMode":
mViewManager.setFlashMode(view, value == null ? null : (String) value);
break;
case "focusMode":
mViewManager.setFocusMode(view, value == null ? null : (String) value);
break;
case "maxPhotoQualityPrioritization":
mViewManager.setMaxPhotoQualityPrioritization(view, value == null ? null : (String) value);
break;
case "zoomMode":
mViewManager.setZoomMode(view, value == null ? null : (String) value);
break;
case "zoom":
mViewManager.setZoom(view, value == null ? -1f : ((Double) value).doubleValue());
break;
case "maxZoom":
mViewManager.setMaxZoom(view, value == null ? -1f : ((Double) value).doubleValue());
break;
case "torchMode":
mViewManager.setTorchMode(view, value == null ? null : (String) value);
break;
case "cameraType":
mViewManager.setCameraType(view, value == null ? null : (String) value);
break;
case "scanBarcode":
mViewManager.setScanBarcode(view, value == null ? false : (boolean) value);
break;
case "showFrame":
mViewManager.setShowFrame(view, value == null ? false : (boolean) value);
break;
case "laserColor":
mViewManager.setLaserColor(view, ColorPropConverter.getColor(value, view.getContext()));
break;
case "frameColor":
mViewManager.setFrameColor(view, ColorPropConverter.getColor(value, view.getContext()));
break;
case "ratioOverlay":
mViewManager.setRatioOverlay(view, value == null ? null : (String) value);
break;
case "ratioOverlayColor":
mViewManager.setRatioOverlayColor(view, ColorPropConverter.getColor(value, view.getContext()));
break;
case "resetFocusTimeout":
mViewManager.setResetFocusTimeout(view, value == null ? -1 : ((Double) value).intValue());
break;
case "resetFocusWhenMotionDetected":
mViewManager.setResetFocusWhenMotionDetected(view, value == null ? false : (boolean) value);
break;
case "resizeMode":
mViewManager.setResizeMode(view, value == null ? null : (String) value);
break;
case "scanThrottleDelay":
mViewManager.setScanThrottleDelay(view, value == null ? -1 : ((Double) value).intValue());
break;
case "barcodeFrameSize":
mViewManager.setBarcodeFrameSize(view, (ReadableMap) value);
break;
case "shutterPhotoSound":
mViewManager.setShutterPhotoSound(view, value == null ? false : (boolean) value);
break;
case "shutterAnimationDuration":
mViewManager.setShutterAnimationDuration(view, value == null ? -1 : ((Double) value).intValue());
break;
case "outputPath":
mViewManager.setOutputPath(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@ -1,40 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface CKCameraManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setFlashMode(T view, @Nullable String value);
void setFocusMode(T view, @Nullable String value);
void setMaxPhotoQualityPrioritization(T view, @Nullable String value);
void setZoomMode(T view, @Nullable String value);
void setZoom(T view, double value);
void setMaxZoom(T view, double value);
void setTorchMode(T view, @Nullable String value);
void setCameraType(T view, @Nullable String value);
void setScanBarcode(T view, boolean value);
void setShowFrame(T view, boolean value);
void setLaserColor(T view, @Nullable Integer value);
void setFrameColor(T view, @Nullable Integer value);
void setRatioOverlay(T view, @Nullable String value);
void setRatioOverlayColor(T view, @Nullable Integer value);
void setResetFocusTimeout(T view, int value);
void setResetFocusWhenMotionDetected(T view, boolean value);
void setResizeMode(T view, @Nullable String value);
void setScanThrottleDelay(T view, int value);
void setBarcodeFrameSize(T view, @Nullable ReadableMap value);
void setShutterPhotoSound(T view, boolean value);
void setShutterAnimationDuration(T view, int value);
void setOutputPath(T view, @Nullable String value);
}

View File

@ -1,45 +0,0 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/rncamerakit_specs/*.cpp)
add_library(
react_codegen_rncamerakit_specs
OBJECT
${react_codegen_SRCS}
)
target_include_directories(react_codegen_rncamerakit_specs PUBLIC . react/renderer/components/rncamerakit_specs)
target_link_libraries(
react_codegen_rncamerakit_specs
fbjni
jsi
# We need to link different libraries based on whether we are building rncore or not, that's necessary
# because we want to break a circular dependency between react_codegen_rncore and reactnative
reactnative
)
# Fix crash on startup on RN 0.81 or newer due to broken codegen (it always uses target_compile_options)
# Do not commit the change where the if-statement is removed unless they fix Codegen
# See https://github.com/software-mansion/react-native-screens/pull/3114/commits/b4d283c8fc65e36ec60726fd7513735ccc7e1fe9
# See https://github.com/react-native-maps/react-native-maps/issues/5699
# (commit https://github.com/react-native-maps/react-native-maps/commit/c587f30b8499b79a2266687c641bfed10b3ecc2c)
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 80)
target_compile_reactnative_options(react_codegen_rncamerakit_specs PRIVATE)
else()
target_compile_options(
react_codegen_rncamerakit_specs
PRIVATE
-DLOG_TAG=\"ReactNative\"
-fexceptions
-frtti
-std=c++20
-Wall
)
endif()

View File

@ -1,22 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateComponentDescriptorCpp.js
*/
#include "ComponentDescriptors.h"
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
namespace facebook::react {
void rncamerakit_specs_registerComponentDescriptorsFromCodegen(
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
registry->add(concreteComponentDescriptorProvider<CKCameraComponentDescriptor>());
}
} // namespace facebook::react

View File

@ -1,24 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateComponentDescriptorH.js
*/
#pragma once
#include "ShadowNodes.h"
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
namespace facebook::react {
using CKCameraComponentDescriptor = ConcreteComponentDescriptor<CKCameraShadowNode>;
void rncamerakit_specs_registerComponentDescriptorsFromCodegen(
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
} // namespace facebook::react

View File

@ -1,79 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateEventEmitterCpp.js
*/
#include "EventEmitters.h"
namespace facebook::react {
void CKCameraEventEmitter::onOrientationChange(OnOrientationChange $event) const {
dispatchEvent("orientationChange", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "orientation", $event.orientation);
return $payload;
});
}
void CKCameraEventEmitter::onZoom(OnZoom $event) const {
dispatchEvent("zoom", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "zoom", $event.zoom);
return $payload;
});
}
void CKCameraEventEmitter::onError(OnError $event) const {
dispatchEvent("error", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "errorMessage", $event.errorMessage);
return $payload;
});
}
void CKCameraEventEmitter::onReadCode(OnReadCode $event) const {
dispatchEvent("readCode", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "codeStringValue", $event.codeStringValue);
$payload.setProperty(runtime, "codeFormat", $event.codeFormat);
return $payload;
});
}
void CKCameraEventEmitter::onCaptureButtonPressIn(OnCaptureButtonPressIn $event) const {
dispatchEvent("captureButtonPressIn", [](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
return $payload;
});
}
void CKCameraEventEmitter::onCaptureButtonPressOut(OnCaptureButtonPressOut $event) const {
dispatchEvent("captureButtonPressOut", [](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
return $payload;
});
}
void CKCameraEventEmitter::onPictureTaken(OnPictureTaken $event) const {
dispatchEvent("pictureTaken", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "uri", $event.uri);
return $payload;
});
}
} // namespace facebook::react

View File

@ -1,62 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateEventEmitterH.js
*/
#pragma once
#include <react/renderer/components/view/ViewEventEmitter.h>
namespace facebook::react {
class CKCameraEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
struct OnOrientationChange {
int orientation;
};
struct OnZoom {
double zoom;
};
struct OnError {
std::string errorMessage;
};
struct OnReadCode {
std::string codeStringValue;
std::string codeFormat;
};
struct OnCaptureButtonPressIn {
};
struct OnCaptureButtonPressOut {
};
struct OnPictureTaken {
std::string uri;
};
void onOrientationChange(OnOrientationChange value) const;
void onZoom(OnZoom value) const;
void onError(OnError value) const;
void onReadCode(OnReadCode value) const;
void onCaptureButtonPressIn(OnCaptureButtonPressIn value) const;
void onCaptureButtonPressOut(OnCaptureButtonPressOut value) const;
void onPictureTaken(OnPictureTaken value) const;
};
} // namespace facebook::react

View File

@ -1,46 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsCpp.js
*/
#include "Props.h"
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/core/propsConversions.h>
namespace facebook::react {
CKCameraProps::CKCameraProps(
const PropsParserContext &context,
const CKCameraProps &sourceProps,
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
flashMode(convertRawProp(context, rawProps, "flashMode", sourceProps.flashMode, {})),
focusMode(convertRawProp(context, rawProps, "focusMode", sourceProps.focusMode, {})),
maxPhotoQualityPrioritization(convertRawProp(context, rawProps, "maxPhotoQualityPrioritization", sourceProps.maxPhotoQualityPrioritization, {})),
zoomMode(convertRawProp(context, rawProps, "zoomMode", sourceProps.zoomMode, {})),
zoom(convertRawProp(context, rawProps, "zoom", sourceProps.zoom, {-1.0})),
maxZoom(convertRawProp(context, rawProps, "maxZoom", sourceProps.maxZoom, {-1.0})),
torchMode(convertRawProp(context, rawProps, "torchMode", sourceProps.torchMode, {})),
cameraType(convertRawProp(context, rawProps, "cameraType", sourceProps.cameraType, {})),
scanBarcode(convertRawProp(context, rawProps, "scanBarcode", sourceProps.scanBarcode, {false})),
showFrame(convertRawProp(context, rawProps, "showFrame", sourceProps.showFrame, {false})),
laserColor(convertRawProp(context, rawProps, "laserColor", sourceProps.laserColor, {})),
frameColor(convertRawProp(context, rawProps, "frameColor", sourceProps.frameColor, {})),
ratioOverlay(convertRawProp(context, rawProps, "ratioOverlay", sourceProps.ratioOverlay, {})),
ratioOverlayColor(convertRawProp(context, rawProps, "ratioOverlayColor", sourceProps.ratioOverlayColor, {})),
resetFocusTimeout(convertRawProp(context, rawProps, "resetFocusTimeout", sourceProps.resetFocusTimeout, {-1})),
resetFocusWhenMotionDetected(convertRawProp(context, rawProps, "resetFocusWhenMotionDetected", sourceProps.resetFocusWhenMotionDetected, {false})),
resizeMode(convertRawProp(context, rawProps, "resizeMode", sourceProps.resizeMode, {})),
scanThrottleDelay(convertRawProp(context, rawProps, "scanThrottleDelay", sourceProps.scanThrottleDelay, {-1})),
barcodeFrameSize(convertRawProp(context, rawProps, "barcodeFrameSize", sourceProps.barcodeFrameSize, {})),
shutterPhotoSound(convertRawProp(context, rawProps, "shutterPhotoSound", sourceProps.shutterPhotoSound, {false})),
shutterAnimationDuration(convertRawProp(context, rawProps, "shutterAnimationDuration", sourceProps.shutterAnimationDuration, {-1})),
outputPath(convertRawProp(context, rawProps, "outputPath", sourceProps.outputPath, {}))
{}
} // namespace facebook::react

View File

@ -1,71 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsH.js
*/
#pragma once
#include <react/renderer/components/view/ViewProps.h>
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/graphics/Color.h>
namespace facebook::react {
struct CKCameraBarcodeFrameSizeStruct {
Float width{300.0};
Float height{150.0};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, CKCameraBarcodeFrameSizeStruct &result) {
auto map = (std::unordered_map<std::string, RawValue>)value;
auto tmp_width = map.find("width");
if (tmp_width != map.end()) {
fromRawValue(context, tmp_width->second, result.width);
}
auto tmp_height = map.find("height");
if (tmp_height != map.end()) {
fromRawValue(context, tmp_height->second, result.height);
}
}
static inline std::string toString(const CKCameraBarcodeFrameSizeStruct &value) {
return "[Object CKCameraBarcodeFrameSizeStruct]";
}
class CKCameraProps final : public ViewProps {
public:
CKCameraProps() = default;
CKCameraProps(const PropsParserContext& context, const CKCameraProps &sourceProps, const RawProps &rawProps);
#pragma mark - Props
std::string flashMode{};
std::string focusMode{};
std::string maxPhotoQualityPrioritization{};
std::string zoomMode{};
double zoom{-1.0};
double maxZoom{-1.0};
std::string torchMode{};
std::string cameraType{};
bool scanBarcode{false};
bool showFrame{false};
SharedColor laserColor{};
SharedColor frameColor{};
std::string ratioOverlay{};
SharedColor ratioOverlayColor{};
int resetFocusTimeout{-1};
bool resetFocusWhenMotionDetected{false};
std::string resizeMode{};
int scanThrottleDelay{-1};
CKCameraBarcodeFrameSizeStruct barcodeFrameSize{};
bool shutterPhotoSound{false};
int shutterAnimationDuration{-1};
std::string outputPath{};
};
} // namespace facebook::react

View File

@ -1,17 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateShadowNodeCpp.js
*/
#include "ShadowNodes.h"
namespace facebook::react {
extern const char CKCameraComponentName[] = "CKCamera";
} // namespace facebook::react

View File

@ -1,32 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateShadowNodeH.js
*/
#pragma once
#include "EventEmitters.h"
#include "Props.h"
#include "States.h"
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <jsi/jsi.h>
namespace facebook::react {
JSI_EXPORT extern const char CKCameraComponentName[];
/*
* `ShadowNode` for <CKCamera> component.
*/
using CKCameraShadowNode = ConcreteViewShadowNode<
CKCameraComponentName,
CKCameraProps,
CKCameraEventEmitter,
CKCameraState>;
} // namespace facebook::react

View File

@ -1,16 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateStateCpp.js
*/
#include "States.h"
namespace facebook::react {
} // namespace facebook::react

View File

@ -1,29 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateStateH.js
*/
#pragma once
#ifdef ANDROID
#include <folly/dynamic.h>
#endif
namespace facebook::react {
class CKCameraState {
public:
CKCameraState() = default;
#ifdef ANDROID
CKCameraState(CKCameraState const &previousState, folly::dynamic data){};
folly::dynamic getDynamic() const {
return {};
};
#endif
};
} // namespace facebook::react

View File

@ -1,40 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleCpp.js
*/
#include "rncamerakit_specsJSI.h"
namespace facebook::react {
static jsi::Value __hostFunction_NativeCameraKitModuleCxxSpecJSI_capture(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<NativeCameraKitModuleCxxSpecJSI *>(&turboModule)->capture(
rt,
count <= 0 || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asObject(rt)),
count <= 1 || args[1].isUndefined() ? std::nullopt : std::make_optional(args[1].asNumber())
);
}
static jsi::Value __hostFunction_NativeCameraKitModuleCxxSpecJSI_requestDeviceCameraAuthorization(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<NativeCameraKitModuleCxxSpecJSI *>(&turboModule)->requestDeviceCameraAuthorization(
rt
);
}
static jsi::Value __hostFunction_NativeCameraKitModuleCxxSpecJSI_checkDeviceCameraAuthorizationStatus(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<NativeCameraKitModuleCxxSpecJSI *>(&turboModule)->checkDeviceCameraAuthorizationStatus(
rt
);
}
NativeCameraKitModuleCxxSpecJSI::NativeCameraKitModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule("RNCameraKitModule", jsInvoker) {
methodMap_["capture"] = MethodMetadata {2, __hostFunction_NativeCameraKitModuleCxxSpecJSI_capture};
methodMap_["requestDeviceCameraAuthorization"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleCxxSpecJSI_requestDeviceCameraAuthorization};
methodMap_["checkDeviceCameraAuthorizationStatus"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleCxxSpecJSI_checkDeviceCameraAuthorizationStatus};
}
} // namespace facebook::react

View File

@ -1,177 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleH.js
*/
#pragma once
#include <ReactCommon/TurboModule.h>
#include <react/bridging/Bridging.h>
namespace facebook::react {
#pragma mark - NativeCameraKitModuleCaptureData
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
struct NativeCameraKitModuleCaptureData {
P0 uri;
P1 name;
P2 height;
P3 width;
P4 id;
P5 path;
P6 size;
bool operator==(const NativeCameraKitModuleCaptureData &other) const {
return uri == other.uri && name == other.name && height == other.height && width == other.width && id == other.id && path == other.path && size == other.size;
}
};
template <typename T>
struct NativeCameraKitModuleCaptureDataBridging {
static T types;
static T fromJs(
jsi::Runtime &rt,
const jsi::Object &value,
const std::shared_ptr<CallInvoker> &jsInvoker) {
T result{
bridging::fromJs<decltype(types.uri)>(rt, value.getProperty(rt, "uri"), jsInvoker),
bridging::fromJs<decltype(types.name)>(rt, value.getProperty(rt, "name"), jsInvoker),
bridging::fromJs<decltype(types.height)>(rt, value.getProperty(rt, "height"), jsInvoker),
bridging::fromJs<decltype(types.width)>(rt, value.getProperty(rt, "width"), jsInvoker),
bridging::fromJs<decltype(types.id)>(rt, value.getProperty(rt, "id"), jsInvoker),
bridging::fromJs<decltype(types.path)>(rt, value.getProperty(rt, "path"), jsInvoker),
bridging::fromJs<decltype(types.size)>(rt, value.getProperty(rt, "size"), jsInvoker)};
return result;
}
#ifdef DEBUG
static jsi::String uriToJs(jsi::Runtime &rt, decltype(types.uri) value) {
return bridging::toJs(rt, value);
}
static jsi::String nameToJs(jsi::Runtime &rt, decltype(types.name) value) {
return bridging::toJs(rt, value);
}
static int heightToJs(jsi::Runtime &rt, decltype(types.height) value) {
return bridging::toJs(rt, value);
}
static int widthToJs(jsi::Runtime &rt, decltype(types.width) value) {
return bridging::toJs(rt, value);
}
static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) {
return bridging::toJs(rt, value);
}
static jsi::String pathToJs(jsi::Runtime &rt, decltype(types.path) value) {
return bridging::toJs(rt, value);
}
static int sizeToJs(jsi::Runtime &rt, decltype(types.size) value) {
return bridging::toJs(rt, value);
}
#endif
static jsi::Object toJs(
jsi::Runtime &rt,
const T &value,
const std::shared_ptr<CallInvoker> &jsInvoker) {
auto result = facebook::jsi::Object(rt);
result.setProperty(rt, "uri", bridging::toJs(rt, value.uri, jsInvoker));
result.setProperty(rt, "name", bridging::toJs(rt, value.name, jsInvoker));
result.setProperty(rt, "height", bridging::toJs(rt, value.height, jsInvoker));
result.setProperty(rt, "width", bridging::toJs(rt, value.width, jsInvoker));
if (value.id) {
result.setProperty(rt, "id", bridging::toJs(rt, value.id.value(), jsInvoker));
}
if (value.path) {
result.setProperty(rt, "path", bridging::toJs(rt, value.path.value(), jsInvoker));
}
if (value.size) {
result.setProperty(rt, "size", bridging::toJs(rt, value.size.value(), jsInvoker));
}
return result;
}
};
class JSI_EXPORT NativeCameraKitModuleCxxSpecJSI : public TurboModule {
protected:
NativeCameraKitModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
public:
virtual jsi::Value capture(jsi::Runtime &rt, std::optional<jsi::Object> options, std::optional<double> tag) = 0;
virtual jsi::Value requestDeviceCameraAuthorization(jsi::Runtime &rt) = 0;
virtual jsi::Value checkDeviceCameraAuthorizationStatus(jsi::Runtime &rt) = 0;
};
template <typename T>
class JSI_EXPORT NativeCameraKitModuleCxxSpec : public TurboModule {
public:
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
return delegate_.create(rt, propName);
}
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}
static constexpr std::string_view kModuleName = "RNCameraKitModule";
protected:
NativeCameraKitModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule(std::string{NativeCameraKitModuleCxxSpec::kModuleName}, jsInvoker),
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
private:
class Delegate : public NativeCameraKitModuleCxxSpecJSI {
public:
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
NativeCameraKitModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
}
jsi::Value capture(jsi::Runtime &rt, std::optional<jsi::Object> options, std::optional<double> tag) override {
static_assert(
bridging::getParameterCount(&T::capture) == 3,
"Expected capture(...) to have 3 parameters");
return bridging::callFromJs<jsi::Value>(
rt, &T::capture, jsInvoker_, instance_, std::move(options), std::move(tag));
}
jsi::Value requestDeviceCameraAuthorization(jsi::Runtime &rt) override {
static_assert(
bridging::getParameterCount(&T::requestDeviceCameraAuthorization) == 1,
"Expected requestDeviceCameraAuthorization(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
rt, &T::requestDeviceCameraAuthorization, jsInvoker_, instance_);
}
jsi::Value checkDeviceCameraAuthorizationStatus(jsi::Runtime &rt) override {
static_assert(
bridging::getParameterCount(&T::checkDeviceCameraAuthorizationStatus) == 1,
"Expected checkDeviceCameraAuthorizationStatus(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
rt, &T::checkDeviceCameraAuthorizationStatus, jsInvoker_, instance_);
}
private:
friend class NativeCameraKitModuleCxxSpec;
T *instance_;
};
Delegate delegate_;
};
} // namespace facebook::react

View File

@ -1,44 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleJniCpp.js
*/
#include "rncamerakit_specs.h"
namespace facebook::react {
static facebook::jsi::Value __hostFunction_NativeCameraKitModuleSpecJSI_capture(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
static jmethodID cachedMethodId = nullptr;
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "capture", "(Lcom/facebook/react/bridge/ReadableMap;Ljava/lang/Double;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
}
static facebook::jsi::Value __hostFunction_NativeCameraKitModuleSpecJSI_requestDeviceCameraAuthorization(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
static jmethodID cachedMethodId = nullptr;
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "requestDeviceCameraAuthorization", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
}
static facebook::jsi::Value __hostFunction_NativeCameraKitModuleSpecJSI_checkDeviceCameraAuthorizationStatus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
static jmethodID cachedMethodId = nullptr;
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "checkDeviceCameraAuthorizationStatus", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
}
NativeCameraKitModuleSpecJSI::NativeCameraKitModuleSpecJSI(const JavaTurboModule::InitParams &params)
: JavaTurboModule(params) {
methodMap_["capture"] = MethodMetadata {2, __hostFunction_NativeCameraKitModuleSpecJSI_capture};
methodMap_["requestDeviceCameraAuthorization"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleSpecJSI_requestDeviceCameraAuthorization};
methodMap_["checkDeviceCameraAuthorizationStatus"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleSpecJSI_checkDeviceCameraAuthorizationStatus};
}
std::shared_ptr<TurboModule> rncamerakit_specs_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
if (moduleName == "RNCameraKitModule") {
return std::make_shared<NativeCameraKitModuleSpecJSI>(params);
}
return nullptr;
}
} // namespace facebook::react

View File

@ -1,31 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleJniH.js
*/
#pragma once
#include <ReactCommon/JavaTurboModule.h>
#include <ReactCommon/TurboModule.h>
#include <jsi/jsi.h>
namespace facebook::react {
/**
* JNI C++ class for module 'NativeCameraKitModule'
*/
class JSI_EXPORT NativeCameraKitModuleSpecJSI : public JavaTurboModule {
public:
NativeCameraKitModuleSpecJSI(const JavaTurboModule::InitParams &params);
};
JSI_EXPORT
std::shared_ptr<TurboModule> rncamerakit_specs_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
} // namespace facebook::react

View File

@ -9,12 +9,11 @@ import com.facebook.react.module.model.ReactModuleInfoProvider
import com.facebook.react.uimanager.ViewManager
import java.util.*
@ReactModuleList(nativeModules = [RNCameraKitModule::class])
class RNCameraKitPackage : TurboReactPackage() {
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
val viewManagers: MutableList<ViewManager<*, *>> = ArrayList()
viewManagers.add(CKCameraManager())
viewManagers.add(CKCameraManager(reactContext))
return viewManagers
}

View File

@ -4,6 +4,7 @@ import android.graphics.Color
import android.util.Log
import android.util.Size
import androidx.annotation.ColorInt
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.ReadableType
@ -15,10 +16,10 @@ import com.facebook.react.uimanager.ViewManagerDelegate
import com.facebook.react.uimanager.annotations.ReactProp
import com.facebook.react.viewmanagers.CKCameraManagerDelegate
import com.facebook.react.viewmanagers.CKCameraManagerInterface
import com.rncamerakit.events.*
class CKCameraManager : SimpleViewManager<CKCamera>(), CKCameraManagerInterface<CKCamera> {
class CKCameraManager(context: ReactApplicationContext) : SimpleViewManager<CKCamera>(), CKCameraManagerInterface<CKCamera> {
private val delegate: ViewManagerDelegate<CKCamera> = CKCameraManagerDelegate(this)
override fun getDelegate(): ViewManagerDelegate<CKCamera> = delegate

View File

@ -2,7 +2,8 @@ package com.rncamerakit
import com.facebook.react.bridge.*
import com.facebook.react.uimanager.UIManagerHelper
import com.facebook.fbreact.specs.NativeCameraKitModuleSpec
import com.rncamerakit.NativeCameraKitModuleSpec
/**
* Native module for interacting with the camera in React Native applications.

View File

@ -0,0 +1,158 @@
package com.rncamerakit
import android.graphics.Color
import android.util.Log
import android.util.Size
import androidx.annotation.ColorInt
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.ReadableType
import com.facebook.react.common.MapBuilder
import com.facebook.react.common.ReactConstants.TAG
import com.facebook.react.uimanager.SimpleViewManager
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.ViewManagerDelegate
import com.facebook.react.uimanager.annotations.ReactProp
import com.rncamerakit.events.*
class CKCameraManager(var context: ReactApplicationContext) : SimpleViewManager<CKCamera>() {
override fun getName() : String {
return "CKCamera"
}
override fun createViewInstance(context: ThemedReactContext): CKCamera {
return CKCamera(context)
}
override fun receiveCommand(view: CKCamera, commandId: String?, args: ReadableArray?) {
var logCommand = "CameraManager received command $commandId("
for (i in 0..(args?.size() ?: 0)) {
if (i > 0) {
logCommand += ", "
}
logCommand += when (args?.getType(0)) {
ReadableType.Null -> "Null"
ReadableType.Array -> "Array"
ReadableType.Boolean -> "Boolean"
ReadableType.Map -> "Map"
ReadableType.Number -> "Number"
ReadableType.String -> "String"
else -> ""
}
}
logCommand += ")"
Log.d(TAG, logCommand)
}
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> {
return MapBuilder.of(
OrientationChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", "onOrientationChange"),
ReadCodeEvent.EVENT_NAME, MapBuilder.of("registrationName", "onReadCode"),
PictureTakenEvent.EVENT_NAME, MapBuilder.of("registrationName", "onPictureTaken"),
ZoomEvent.EVENT_NAME, MapBuilder.of("registrationName", "onZoom"),
ErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onError"),
CaptureButtonPressInEvent.EVENT_NAME, MapBuilder.of("registrationName", "onCaptureButtonPressIn"),
CaptureButtonPressOutEvent.EVENT_NAME, MapBuilder.of("registrationName", "onCaptureButtonPressOut")
)
}
@ReactProp(name = "cameraType")
fun setCameraType(view: CKCamera, type: String?) {
view.setCameraType(type ?: "back")
}
@ReactProp(name = "flashMode")
fun setFlashMode(view: CKCamera, mode: String?) {
view.setFlashMode(mode)
}
@ReactProp(name = "torchMode")
fun setTorchMode(view: CKCamera, mode: String?) {
view.setTorchMode(mode)
}
@ReactProp(name = "focusMode")
fun setFocusMode(view: CKCamera, mode: String?) {
view.setAutoFocus(mode ?: "on")
}
@ReactProp(name = "zoomMode")
fun setZoomMode(view: CKCamera, mode: String?) {
view.setZoomMode(mode)
}
@ReactProp(name = "zoom", defaultDouble = -1.0)
fun setZoom(view: CKCamera, factor: Double) {
view.setZoom(if (factor == -1.0) null else factor)
}
@ReactProp(name = "maxZoom", defaultDouble = 420.0)
fun setMaxZoom(view: CKCamera, factor: Double) {
view.setMaxZoom(factor)
}
@ReactProp(name = "scanBarcode")
fun setScanBarcode(view: CKCamera, enabled: Boolean) {
view.setScanBarcode(enabled)
}
@ReactProp(name = "showFrame")
fun setShowFrame(view: CKCamera, enabled: Boolean) {
view.setShowFrame(enabled)
}
@ReactProp(name = "laserColor", defaultInt = Color.RED)
fun setLaserColor(view: CKCamera, @ColorInt color: Int?) {
view.setLaserColor(color ?: Color.RED)
}
@ReactProp(name = "frameColor", defaultInt = Color.GREEN)
fun setFrameColor(view: CKCamera, @ColorInt color: Int?) {
view.setFrameColor(color ?: Color.GREEN)
}
@ReactProp(name = "barcodeFrameSize")
fun setBarcodeFrameSize(view: CKCamera, frameSize: ReadableMap?) {
if (frameSize == null || !frameSize.hasKey("width") || !frameSize.hasKey("height")) {
return
}
val width = frameSize.getInt("width")
val height = frameSize.getInt("height")
view.setBarcodeFrameSize(Size(width, height))
}
@ReactProp(name = "outputPath")
fun setOutputPath(view: CKCamera, path: String?) {
view.setOutputPath(path ?: "")
}
@ReactProp(name = "shutterAnimationDuration")
fun setShutterAnimationDuration(view: CKCamera, duration: Int) {
view.setShutterAnimationDuration(duration)
}
@ReactProp(name = "shutterPhotoSound")
fun setShutterPhotoSound(view: CKCamera, enabled: Boolean) {
view.setShutterPhotoSound(enabled);
}
@ReactProp(name = "scanThrottleDelay")
fun setScanThrottleDelay(view: CKCamera?, value: Int) {
view?.setScanThrottleDelay(value)
}
// Methods only available on iOS
fun setRatioOverlay(view: CKCamera?, value: String?) = Unit
fun setRatioOverlayColor(view: CKCamera?, value: Int?) = Unit
fun setResetFocusTimeout(view: CKCamera?, value: Int) = Unit
fun setResetFocusWhenMotionDetected(view: CKCamera?, value: Boolean) = Unit
fun setResizeMode(view: CKCamera?, value: String?) = Unit
fun setMaxPhotoQualityPrioritization(view: CKCamera?, value: String?) = Unit
}

View File

@ -0,0 +1,95 @@
package com.rncamerakit
import com.facebook.react.bridge.*
import com.facebook.react.uimanager.UIManagerHelper
/**
* Native module for interacting with the camera in React Native applications.
*
* This module provides methods to capture photos using the camera and constants
* related to camera orientation.
*
* @param reactContext The application's ReactApplicationContext.
*/
class RNCameraKitModule(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
companion object {
// Constants for camera orientation
/**
* Represents the portrait orientation with the top of the device up.
*/
const val PORTRAIT = 0 // ⬆️
/**
* Represents the landscape orientation with the left side of the device up.
*/
const val LANDSCAPE_LEFT = 1 // ⬅️
/**
* Represents the portrait orientation with the bottom of the device up.
*/
const val PORTRAIT_UPSIDE_DOWN = 2 // ⬇️
/**
* Represents the landscape orientation with the right side of the device up.
*/
const val LANDSCAPE_RIGHT = 3 // ➡️
const val REACT_CLASS = "RNCameraKitModule"
}
override fun getName(): String {
return REACT_CLASS
}
/**
* Provides constants related to camera orientation.
*
* @return A map containing camera orientation constants.
*/
override fun getConstants(): Map<String, Any> {
return hashMapOf(
"PORTRAIT" to PORTRAIT,
"PORTRAIT_UPSIDE_DOWN" to PORTRAIT_UPSIDE_DOWN,
"LANDSCAPE_LEFT" to LANDSCAPE_LEFT,
"LANDSCAPE_RIGHT" to LANDSCAPE_RIGHT
)
}
fun requestDeviceCameraAuthorization(promise: Promise?) = Unit
fun checkDeviceCameraAuthorizationStatus(promise: Promise?) = Unit
/**
* Captures a photo using the camera.
*
* @param options The options for the capture operation.
* @param tag The tag of the camera view.
* @param promise The promise to resolve the capture result.
*/
@ReactMethod
fun capture(options: ReadableMap?, tag: Double?, promise: Promise) {
val viewTag = tag?.toInt()
if (viewTag != null && options != null) {
val uiManager = UIManagerHelper.getUIManagerForReactTag(reactContext, viewTag)
reactContext.runOnUiQueueThread {
val camera = uiManager?.resolveView(viewTag) as CKCamera
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")
}
}
}

View File

@ -1,3 +1,5 @@
# ENV['RCT_NEW_ARCH_ENABLED'] = '0'
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(

View File

@ -2223,7 +2223,7 @@ PODS:
- React-perflogger (= 0.81.0)
- React-utils (= 0.81.0)
- SocketRocket
- ReactNativeCameraKit (16.0.0):
- ReactNativeCameraKit (16.0.1):
- boost
- DoubleConversion
- fast_float
@ -2528,14 +2528,14 @@ SPEC CHECKSUMS:
React-performancetimeline: 1f86dc9782e3fe78727c5fbb3e2178b9fd1aa6fd
React-RCTActionSheet: 550c9c6c2e7dcd85a51954dc08e2f3837a148e7c
React-RCTAnimation: 19d4bb6d2190983d1354b096b7b65dbd591924da
React-RCTAppDelegate: 6c71d16eef920831a312ff363355fc3b99c02a98
React-RCTAppDelegate: 4512132c26eb717a81d4a0b6516f178639e9abf0
React-RCTBlob: b81a0cffe1a083bcf9d8aa9f27f4d37864579e90
React-RCTFabric: 01005d2fa799bba6e21aae18820498f56fe0be5f
React-RCTFBReactNativeSpec: 5adb84a81c4ed7a1f2661835d166e4b2c4320cd4
React-RCTFabric: e256e79bdab3d2c4bb6e5975224484d0f42131f3
React-RCTFBReactNativeSpec: 8442e61116ea32de3fc3664651f7a78da11c6ba0
React-RCTImage: 607e5e373fb56d72417464bd82e8046af81ab502
React-RCTLinking: 301434c7bf1100458be5a3866326ba33491e3687
React-RCTNetwork: a118a47bd123ac96c9877e04f5731a1d6545aba5
React-RCTRuntime: 85fdbf469fe8a12c4db6c836731b190efc33d11d
React-RCTRuntime: b1e67bc601a330d1f72c71246557541efbc121a4
React-RCTSettings: 5a5aa2cf9ac40f7a8897cc0f9d945ac803886604
React-RCTText: e6e00bee9847a8af1218079b73c8bfed16c75b8d
React-RCTVibration: 5a05fa0ef05ee73d074a3314e57586afc969f1ba
@ -2552,10 +2552,10 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: c91900fa724baee992f01c05eeb4c9e01a807f78
ReactCodegen: a55799cae416c387aeaae3aabc1bc0289ac19cee
ReactCommon: 116d6ee71679243698620d8cd9a9042541e44aa6
ReactNativeCameraKit: a3c0a0166ce9580f572831eefcc50fb480a3555e
ReactNativeCameraKit: 29206675814ffb96b09a200b999ad5fa9b858a08
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 00013dd9cde63a2d98e8002fcc4f5ddb66c10782
PODFILE CHECKSUM: a8c2ea2a626cba074156986b04202d8ab0a3eb7d
PODFILE CHECKSUM: 2a7cb4991754518b63a1c5b884f5861886abdce4
COCOAPODS: 1.15.2

View File

@ -7,10 +7,10 @@
#import <React/RCTFabricComponentsPlugins.h>
#import <folly/dynamic.h>
#import "../generated/rncamerakit_specs/ComponentDescriptors.h"
#import "../generated/rncamerakit_specs/EventEmitters.h"
#import "../generated/rncamerakit_specs/Props.h"
#import "../generated/rncamerakit_specs/RCTComponentViewHelpers.h"
#import <react/renderer/components/NativeCameraKitSpec/ComponentDescriptors.h>
#import <react/renderer/components/NativeCameraKitSpec/EventEmitters.h>
#import <react/renderer/components/NativeCameraKitSpec/Props.h>
#import <react/renderer/components/NativeCameraKitSpec/RCTComponentViewHelpers.h>
#import "ReactNativeCameraKit-Swift.pre.h"

View File

@ -2,7 +2,7 @@
#import <UIKit/UIKit.h>
#ifdef RCT_NEW_ARCH_ENABLED
#import "../generated/rncamerakit_specs/rncamerakit_specs.h"
#import <NativeCameraKitSpec/NativeCameraKitSpec.h>
#else
#import <React/RCTBridge.h>
#endif

View File

@ -1,25 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
#import <React-RCTAppDelegate/RCTDependencyProvider.h>
#elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
#import <React_RCTAppDelegate/RCTDependencyProvider.h>
#else
#import "RCTDependencyProvider.h"
#endif
NS_ASSUME_NONNULL_BEGIN
@interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
@end
NS_ASSUME_NONNULL_END

View File

@ -1,35 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTAppDependencyProvider.h"
#import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
#import <ReactCodegen/RCTModuleProviders.h>
@implementation RCTAppDependencyProvider
- (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
return RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
}
- (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
return RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
}
- (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
return RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
}
- (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
return RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
}
- (nonnull NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders {
return RCTModuleProviders.moduleProviders;
}
@end

View File

@ -1,16 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
@protocol RCTModuleProvider;
@interface RCTModuleProviders: NSObject
+ (NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders;
@end

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "RCTModuleProviders.h"
#import <ReactCommon/RCTTurboModule.h>
#import <React/RCTLog.h>
@implementation RCTModuleProviders
+ (NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders
{
static NSDictionary<NSString *, id<RCTModuleProvider>> *providers = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSDictionary<NSString *, NSString *> * moduleMapping = @{
};
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:moduleMapping.count];
for (NSString *key in moduleMapping) {
NSString * moduleProviderName = moduleMapping[key];
Class klass = NSClassFromString(moduleProviderName);
if (!klass) {
RCTLogError(@"Module provider %@ cannot be found in the runtime", moduleProviderName);
continue;
}
id instance = [klass new];
if (![instance respondsToSelector:@selector(getTurboModule:)]) {
RCTLogError(@"Module provider %@ does not conform to RCTModuleProvider", moduleProviderName);
continue;
}
[dict setObject:instance forKey:key];
}
providers = dict;
});
return providers;
}
@end

View File

@ -1,18 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
@interface RCTModulesConformingToProtocolsProvider: NSObject
+(NSArray<NSString *> *)imageURLLoaderClassNames;
+(NSArray<NSString *> *)imageDataDecoderClassNames;
+(NSArray<NSString *> *)URLRequestHandlerClassNames;
@end

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTModulesConformingToProtocolsProvider.h"
@implementation RCTModulesConformingToProtocolsProvider
+(NSArray<NSString *> *)imageURLLoaderClassNames
{
static NSArray<NSString *> *classNames = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
classNames = @[
];
});
return classNames;
}
+(NSArray<NSString *> *)imageDataDecoderClassNames
{
static NSArray<NSString *> *classNames = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
classNames = @[
];
});
return classNames;
}
+(NSArray<NSString *> *)URLRequestHandlerClassNames
{
static NSArray<NSString *> *classNames = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
classNames = @[
];
});
return classNames;
}
@end

View File

@ -1,16 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
@protocol RCTComponentViewProtocol;
@interface RCTThirdPartyComponentsProvider: NSObject
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
@end

View File

@ -1,30 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import "RCTThirdPartyComponentsProvider.h"
#import <React/RCTComponentViewProtocol.h>
@implementation RCTThirdPartyComponentsProvider
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
{
static NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *thirdPartyComponents = nil;
static dispatch_once_t nativeComponentsToken;
dispatch_once(&nativeComponentsToken, ^{
thirdPartyComponents = @{
@"CKCamera": NSClassFromString(@"CKCameraViewComponentView"), // react-native-camera-kit
};
});
return thirdPartyComponents;
}
@end

View File

@ -1,14 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
@interface RCTUnstableModulesRequiringMainQueueSetupProvider: NSObject
+(NSArray<NSString *> *)modules;
@end

View File

@ -1,19 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTUnstableModulesRequiringMainQueueSetupProvider.h"
@implementation RCTUnstableModulesRequiringMainQueueSetupProvider
+(NSArray<NSString *> *)modules
{
return @[
];
}
@end

View File

@ -1,34 +0,0 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
version = "0.79.0"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which were presumably in.
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
Pod::Spec.new do |s|
s.name = "ReactAppDependencyProvider"
s.version = version
s.summary = "The third party dependency provider for the app"
s.homepage = "https://reactnative.dev/"
s.documentation_url = "https://reactnative.dev/"
s.license = "MIT"
s.author = "Meta Platforms, Inc. and its affiliates"
s.platforms = min_supported_versions
s.source = source
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
s.pod_target_xcconfig = {
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
"DEFINES_MODULE" => "YES"
}
s.dependency "ReactCodegen"
end

View File

@ -1,113 +0,0 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
version = "0.79.0"
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which were presumably in.
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
use_frameworks = ENV['USE_FRAMEWORKS'] != nil
folly_compiler_flags = Helpers::Constants.folly_config[:compiler_flags]
boost_compiler_flags = Helpers::Constants.boost_config[:compiler_flags]
header_search_paths = [
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"$(PODS_ROOT)/DoubleConversion\"",
"\"$(PODS_ROOT)/fast_float/include\"",
"\"$(PODS_ROOT)/fmt/include\"",
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
"\"$(PODS_TARGET_SRCROOT)\"",
]
framework_search_paths = []
if use_frameworks
ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"])
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", []))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"]))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"]))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", []))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", []))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", []))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", []))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", []))
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", []))
.each { |search_path|
header_search_paths << "\"#{search_path}\""
}
end
Pod::Spec.new do |s|
s.name = "ReactCodegen"
s.version = version
s.summary = 'Temp pod for generated files for React Native'
s.homepage = 'https://facebook.com/'
s.license = 'Unlicense'
s.authors = 'Facebook'
s.compiler_flags = "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++20"
s.source = { :git => '' }
s.header_mappings_dir = './'
s.platforms = min_supported_versions
s.source_files = "**/*.{h,mm,cpp}"
s.exclude_files = "RCTAppDependencyProvider.{h,mm}" # these files are generated in the same codegen path but needs to belong to a different pod
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
"FRAMEWORK_SEARCH_PATHS" => framework_search_paths,
"OTHER_CPLUSPLUSFLAGS" => "$(inherited) #{folly_compiler_flags} #{boost_compiler_flags}"
}
s.dependency "React-jsiexecutor"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "React-Core"
s.dependency "React-jsi"
s.dependency "ReactCommon/turbomodule/bridging"
s.dependency "ReactCommon/turbomodule/core"
s.dependency "React-NativeModulesApple"
s.dependency "glog"
s.dependency "DoubleConversion"
s.dependency 'React-graphics'
s.dependency 'React-rendererdebug'
s.dependency 'React-Fabric'
s.dependency 'React-FabricImage'
s.dependency 'React-debug'
s.dependency 'React-utils'
s.dependency 'React-featureflags'
s.dependency 'React-RCTAppDelegate'
depend_on_js_engine(s)
s.script_phases = {
'name' => 'Generate Specs',
'execution_position' => :before_compile,
'input_files' => ["${PODS_ROOT}/../../../src/specs/CameraNativeComponent.ts",
"${PODS_ROOT}/../../../src/specs/NativeCameraKitModule.ts"],
'show_env_vars_in_log' => true,
'output_files' => ["${DERIVED_FILE_DIR}/react-codegen.log"],
'script': <<-SCRIPT
pushd "$PODS_ROOT/../" > /dev/null
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
popd >/dev/null
export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../../node_modules/react-native"
export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../.."
export RCT_SCRIPT_OUTPUT_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT"
export RCT_SCRIPT_TYPE="withCodegenDiscovery"
SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh"
WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh"
/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT"
SCRIPT
}
end

View File

@ -1,22 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateComponentDescriptorCpp.js
*/
#include "ComponentDescriptors.h"
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
namespace facebook::react {
void rncamerakit_specs_registerComponentDescriptorsFromCodegen(
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
registry->add(concreteComponentDescriptorProvider<CKCameraComponentDescriptor>());
}
} // namespace facebook::react

View File

@ -1,24 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateComponentDescriptorH.js
*/
#pragma once
#include "ShadowNodes.h"
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
namespace facebook::react {
using CKCameraComponentDescriptor = ConcreteComponentDescriptor<CKCameraShadowNode>;
void rncamerakit_specs_registerComponentDescriptorsFromCodegen(
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
} // namespace facebook::react

View File

@ -1,79 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateEventEmitterCpp.js
*/
#include "EventEmitters.h"
namespace facebook::react {
void CKCameraEventEmitter::onOrientationChange(OnOrientationChange $event) const {
dispatchEvent("orientationChange", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "orientation", $event.orientation);
return $payload;
});
}
void CKCameraEventEmitter::onZoom(OnZoom $event) const {
dispatchEvent("zoom", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "zoom", $event.zoom);
return $payload;
});
}
void CKCameraEventEmitter::onError(OnError $event) const {
dispatchEvent("error", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "errorMessage", $event.errorMessage);
return $payload;
});
}
void CKCameraEventEmitter::onReadCode(OnReadCode $event) const {
dispatchEvent("readCode", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "codeStringValue", $event.codeStringValue);
$payload.setProperty(runtime, "codeFormat", $event.codeFormat);
return $payload;
});
}
void CKCameraEventEmitter::onCaptureButtonPressIn(OnCaptureButtonPressIn $event) const {
dispatchEvent("captureButtonPressIn", [](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
return $payload;
});
}
void CKCameraEventEmitter::onCaptureButtonPressOut(OnCaptureButtonPressOut $event) const {
dispatchEvent("captureButtonPressOut", [](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
return $payload;
});
}
void CKCameraEventEmitter::onPictureTaken(OnPictureTaken $event) const {
dispatchEvent("pictureTaken", [$event=std::move($event)](jsi::Runtime &runtime) {
auto $payload = jsi::Object(runtime);
$payload.setProperty(runtime, "uri", $event.uri);
return $payload;
});
}
} // namespace facebook::react

View File

@ -1,62 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateEventEmitterH.js
*/
#pragma once
#include <react/renderer/components/view/ViewEventEmitter.h>
namespace facebook::react {
class CKCameraEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
struct OnOrientationChange {
int orientation;
};
struct OnZoom {
double zoom;
};
struct OnError {
std::string errorMessage;
};
struct OnReadCode {
std::string codeStringValue;
std::string codeFormat;
};
struct OnCaptureButtonPressIn {
};
struct OnCaptureButtonPressOut {
};
struct OnPictureTaken {
std::string uri;
};
void onOrientationChange(OnOrientationChange value) const;
void onZoom(OnZoom value) const;
void onError(OnError value) const;
void onReadCode(OnReadCode value) const;
void onCaptureButtonPressIn(OnCaptureButtonPressIn value) const;
void onCaptureButtonPressOut(OnCaptureButtonPressOut value) const;
void onPictureTaken(OnPictureTaken value) const;
};
} // namespace facebook::react

View File

@ -1,46 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsCpp.js
*/
#include "Props.h"
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/core/propsConversions.h>
namespace facebook::react {
CKCameraProps::CKCameraProps(
const PropsParserContext &context,
const CKCameraProps &sourceProps,
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
flashMode(convertRawProp(context, rawProps, "flashMode", sourceProps.flashMode, {})),
focusMode(convertRawProp(context, rawProps, "focusMode", sourceProps.focusMode, {})),
maxPhotoQualityPrioritization(convertRawProp(context, rawProps, "maxPhotoQualityPrioritization", sourceProps.maxPhotoQualityPrioritization, {})),
zoomMode(convertRawProp(context, rawProps, "zoomMode", sourceProps.zoomMode, {})),
zoom(convertRawProp(context, rawProps, "zoom", sourceProps.zoom, {-1.0})),
maxZoom(convertRawProp(context, rawProps, "maxZoom", sourceProps.maxZoom, {-1.0})),
torchMode(convertRawProp(context, rawProps, "torchMode", sourceProps.torchMode, {})),
cameraType(convertRawProp(context, rawProps, "cameraType", sourceProps.cameraType, {})),
scanBarcode(convertRawProp(context, rawProps, "scanBarcode", sourceProps.scanBarcode, {false})),
showFrame(convertRawProp(context, rawProps, "showFrame", sourceProps.showFrame, {false})),
laserColor(convertRawProp(context, rawProps, "laserColor", sourceProps.laserColor, {})),
frameColor(convertRawProp(context, rawProps, "frameColor", sourceProps.frameColor, {})),
ratioOverlay(convertRawProp(context, rawProps, "ratioOverlay", sourceProps.ratioOverlay, {})),
ratioOverlayColor(convertRawProp(context, rawProps, "ratioOverlayColor", sourceProps.ratioOverlayColor, {})),
resetFocusTimeout(convertRawProp(context, rawProps, "resetFocusTimeout", sourceProps.resetFocusTimeout, {-1})),
resetFocusWhenMotionDetected(convertRawProp(context, rawProps, "resetFocusWhenMotionDetected", sourceProps.resetFocusWhenMotionDetected, {false})),
resizeMode(convertRawProp(context, rawProps, "resizeMode", sourceProps.resizeMode, {})),
scanThrottleDelay(convertRawProp(context, rawProps, "scanThrottleDelay", sourceProps.scanThrottleDelay, {-1})),
barcodeFrameSize(convertRawProp(context, rawProps, "barcodeFrameSize", sourceProps.barcodeFrameSize, {})),
shutterPhotoSound(convertRawProp(context, rawProps, "shutterPhotoSound", sourceProps.shutterPhotoSound, {false})),
shutterAnimationDuration(convertRawProp(context, rawProps, "shutterAnimationDuration", sourceProps.shutterAnimationDuration, {-1})),
outputPath(convertRawProp(context, rawProps, "outputPath", sourceProps.outputPath, {}))
{}
} // namespace facebook::react

View File

@ -1,71 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsH.js
*/
#pragma once
#include <react/renderer/components/view/ViewProps.h>
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/graphics/Color.h>
namespace facebook::react {
struct CKCameraBarcodeFrameSizeStruct {
Float width{300.0};
Float height{150.0};
};
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, CKCameraBarcodeFrameSizeStruct &result) {
auto map = (std::unordered_map<std::string, RawValue>)value;
auto tmp_width = map.find("width");
if (tmp_width != map.end()) {
fromRawValue(context, tmp_width->second, result.width);
}
auto tmp_height = map.find("height");
if (tmp_height != map.end()) {
fromRawValue(context, tmp_height->second, result.height);
}
}
static inline std::string toString(const CKCameraBarcodeFrameSizeStruct &value) {
return "[Object CKCameraBarcodeFrameSizeStruct]";
}
class CKCameraProps final : public ViewProps {
public:
CKCameraProps() = default;
CKCameraProps(const PropsParserContext& context, const CKCameraProps &sourceProps, const RawProps &rawProps);
#pragma mark - Props
std::string flashMode{};
std::string focusMode{};
std::string maxPhotoQualityPrioritization{};
std::string zoomMode{};
double zoom{-1.0};
double maxZoom{-1.0};
std::string torchMode{};
std::string cameraType{};
bool scanBarcode{false};
bool showFrame{false};
SharedColor laserColor{};
SharedColor frameColor{};
std::string ratioOverlay{};
SharedColor ratioOverlayColor{};
int resetFocusTimeout{-1};
bool resetFocusWhenMotionDetected{false};
std::string resizeMode{};
int scanThrottleDelay{-1};
CKCameraBarcodeFrameSizeStruct barcodeFrameSize{};
bool shutterPhotoSound{false};
int shutterAnimationDuration{-1};
std::string outputPath{};
};
} // namespace facebook::react

View File

@ -1,20 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateComponentHObjCpp.js
*/
#import <Foundation/Foundation.h>
#import <React/RCTDefines.h>
#import <React/RCTLog.h>
NS_ASSUME_NONNULL_BEGIN
@protocol RCTCKCameraViewProtocol <NSObject>
@end
NS_ASSUME_NONNULL_END

View File

@ -1,17 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateShadowNodeCpp.js
*/
#include "ShadowNodes.h"
namespace facebook::react {
extern const char CKCameraComponentName[] = "CKCamera";
} // namespace facebook::react

View File

@ -1,32 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateShadowNodeH.js
*/
#pragma once
#include "EventEmitters.h"
#include "Props.h"
#include "States.h"
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <jsi/jsi.h>
namespace facebook::react {
JSI_EXPORT extern const char CKCameraComponentName[];
/*
* `ShadowNode` for <CKCamera> component.
*/
using CKCameraShadowNode = ConcreteViewShadowNode<
CKCameraComponentName,
CKCameraProps,
CKCameraEventEmitter,
CKCameraState>;
} // namespace facebook::react

View File

@ -1,16 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateStateCpp.js
*/
#include "States.h"
namespace facebook::react {
} // namespace facebook::react

View File

@ -1,29 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateStateH.js
*/
#pragma once
#ifdef ANDROID
#include <folly/dynamic.h>
#endif
namespace facebook::react {
class CKCameraState {
public:
CKCameraState() = default;
#ifdef ANDROID
CKCameraState(CKCameraState const &previousState, folly::dynamic data){};
folly::dynamic getDynamic() const {
return {};
};
#endif
};
} // namespace facebook::react

View File

@ -1,53 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleObjCpp
*
* We create an umbrella header (and corresponding implementation) here since
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
* must have a single output. More files => more genrule()s => slower builds.
*/
#import "rncamerakit_specs.h"
@implementation NativeCameraKitModuleSpecBase
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
{
_eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
}
@end
namespace facebook::react {
static facebook::jsi::Value __hostFunction_NativeCameraKitModuleSpecJSI_capture(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "capture", @selector(capture:tag:resolve:reject:), args, count);
}
static facebook::jsi::Value __hostFunction_NativeCameraKitModuleSpecJSI_requestDeviceCameraAuthorization(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "requestDeviceCameraAuthorization", @selector(requestDeviceCameraAuthorization:reject:), args, count);
}
static facebook::jsi::Value __hostFunction_NativeCameraKitModuleSpecJSI_checkDeviceCameraAuthorizationStatus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "checkDeviceCameraAuthorizationStatus", @selector(checkDeviceCameraAuthorizationStatus:reject:), args, count);
}
NativeCameraKitModuleSpecJSI::NativeCameraKitModuleSpecJSI(const ObjCTurboModule::InitParams &params)
: ObjCTurboModule(params) {
methodMap_["capture"] = MethodMetadata {2, __hostFunction_NativeCameraKitModuleSpecJSI_capture};
methodMap_["requestDeviceCameraAuthorization"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleSpecJSI_requestDeviceCameraAuthorization};
methodMap_["checkDeviceCameraAuthorizationStatus"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleSpecJSI_checkDeviceCameraAuthorizationStatus};
}
} // namespace facebook::react

View File

@ -1,69 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleObjCpp
*
* We create an umbrella header (and corresponding implementation) here since
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
* must have a single output. More files => more genrule()s => slower builds.
*/
#ifndef __cplusplus
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
#endif
// Avoid multiple includes of rncamerakit_specs symbols
#ifndef rncamerakit_specs_H
#define rncamerakit_specs_H
#import <Foundation/Foundation.h>
#import <RCTRequired/RCTRequired.h>
#import <RCTTypeSafety/RCTConvertHelpers.h>
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTCxxConvert.h>
#import <React/RCTManagedPointer.h>
#import <ReactCommon/RCTTurboModule.h>
#import <optional>
#import <vector>
NS_ASSUME_NONNULL_BEGIN
@protocol NativeCameraKitModuleSpec <RCTBridgeModule, RCTTurboModule>
- (void)capture:(NSDictionary *)options
tag:(NSNumber *)tag
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject;
- (void)requestDeviceCameraAuthorization:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject;
- (void)checkDeviceCameraAuthorizationStatus:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject;
@end
@interface NativeCameraKitModuleSpecBase : NSObject {
@protected
facebook::react::EventEmitterCallback _eventEmitterCallback;
}
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
@end
namespace facebook::react {
/**
* ObjC++ class for module 'NativeCameraKitModule'
*/
class JSI_EXPORT NativeCameraKitModuleSpecJSI : public ObjCTurboModule {
public:
NativeCameraKitModuleSpecJSI(const ObjCTurboModule::InitParams &params);
};
} // namespace facebook::react
NS_ASSUME_NONNULL_END
#endif // rncamerakit_specs_H

View File

@ -1,40 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleCpp.js
*/
#include "rncamerakit_specsJSI.h"
namespace facebook::react {
static jsi::Value __hostFunction_NativeCameraKitModuleCxxSpecJSI_capture(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<NativeCameraKitModuleCxxSpecJSI *>(&turboModule)->capture(
rt,
count <= 0 || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asObject(rt)),
count <= 1 || args[1].isUndefined() ? std::nullopt : std::make_optional(args[1].asNumber())
);
}
static jsi::Value __hostFunction_NativeCameraKitModuleCxxSpecJSI_requestDeviceCameraAuthorization(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<NativeCameraKitModuleCxxSpecJSI *>(&turboModule)->requestDeviceCameraAuthorization(
rt
);
}
static jsi::Value __hostFunction_NativeCameraKitModuleCxxSpecJSI_checkDeviceCameraAuthorizationStatus(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<NativeCameraKitModuleCxxSpecJSI *>(&turboModule)->checkDeviceCameraAuthorizationStatus(
rt
);
}
NativeCameraKitModuleCxxSpecJSI::NativeCameraKitModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule("RNCameraKitModule", jsInvoker) {
methodMap_["capture"] = MethodMetadata {2, __hostFunction_NativeCameraKitModuleCxxSpecJSI_capture};
methodMap_["requestDeviceCameraAuthorization"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleCxxSpecJSI_requestDeviceCameraAuthorization};
methodMap_["checkDeviceCameraAuthorizationStatus"] = MethodMetadata {0, __hostFunction_NativeCameraKitModuleCxxSpecJSI_checkDeviceCameraAuthorizationStatus};
}
} // namespace facebook::react

View File

@ -1,177 +0,0 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleH.js
*/
#pragma once
#include <ReactCommon/TurboModule.h>
#include <react/bridging/Bridging.h>
namespace facebook::react {
#pragma mark - NativeCameraKitModuleCaptureData
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
struct NativeCameraKitModuleCaptureData {
P0 uri;
P1 name;
P2 height;
P3 width;
P4 id;
P5 path;
P6 size;
bool operator==(const NativeCameraKitModuleCaptureData &other) const {
return uri == other.uri && name == other.name && height == other.height && width == other.width && id == other.id && path == other.path && size == other.size;
}
};
template <typename T>
struct NativeCameraKitModuleCaptureDataBridging {
static T types;
static T fromJs(
jsi::Runtime &rt,
const jsi::Object &value,
const std::shared_ptr<CallInvoker> &jsInvoker) {
T result{
bridging::fromJs<decltype(types.uri)>(rt, value.getProperty(rt, "uri"), jsInvoker),
bridging::fromJs<decltype(types.name)>(rt, value.getProperty(rt, "name"), jsInvoker),
bridging::fromJs<decltype(types.height)>(rt, value.getProperty(rt, "height"), jsInvoker),
bridging::fromJs<decltype(types.width)>(rt, value.getProperty(rt, "width"), jsInvoker),
bridging::fromJs<decltype(types.id)>(rt, value.getProperty(rt, "id"), jsInvoker),
bridging::fromJs<decltype(types.path)>(rt, value.getProperty(rt, "path"), jsInvoker),
bridging::fromJs<decltype(types.size)>(rt, value.getProperty(rt, "size"), jsInvoker)};
return result;
}
#ifdef DEBUG
static jsi::String uriToJs(jsi::Runtime &rt, decltype(types.uri) value) {
return bridging::toJs(rt, value);
}
static jsi::String nameToJs(jsi::Runtime &rt, decltype(types.name) value) {
return bridging::toJs(rt, value);
}
static int heightToJs(jsi::Runtime &rt, decltype(types.height) value) {
return bridging::toJs(rt, value);
}
static int widthToJs(jsi::Runtime &rt, decltype(types.width) value) {
return bridging::toJs(rt, value);
}
static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) {
return bridging::toJs(rt, value);
}
static jsi::String pathToJs(jsi::Runtime &rt, decltype(types.path) value) {
return bridging::toJs(rt, value);
}
static int sizeToJs(jsi::Runtime &rt, decltype(types.size) value) {
return bridging::toJs(rt, value);
}
#endif
static jsi::Object toJs(
jsi::Runtime &rt,
const T &value,
const std::shared_ptr<CallInvoker> &jsInvoker) {
auto result = facebook::jsi::Object(rt);
result.setProperty(rt, "uri", bridging::toJs(rt, value.uri, jsInvoker));
result.setProperty(rt, "name", bridging::toJs(rt, value.name, jsInvoker));
result.setProperty(rt, "height", bridging::toJs(rt, value.height, jsInvoker));
result.setProperty(rt, "width", bridging::toJs(rt, value.width, jsInvoker));
if (value.id) {
result.setProperty(rt, "id", bridging::toJs(rt, value.id.value(), jsInvoker));
}
if (value.path) {
result.setProperty(rt, "path", bridging::toJs(rt, value.path.value(), jsInvoker));
}
if (value.size) {
result.setProperty(rt, "size", bridging::toJs(rt, value.size.value(), jsInvoker));
}
return result;
}
};
class JSI_EXPORT NativeCameraKitModuleCxxSpecJSI : public TurboModule {
protected:
NativeCameraKitModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
public:
virtual jsi::Value capture(jsi::Runtime &rt, std::optional<jsi::Object> options, std::optional<double> tag) = 0;
virtual jsi::Value requestDeviceCameraAuthorization(jsi::Runtime &rt) = 0;
virtual jsi::Value checkDeviceCameraAuthorizationStatus(jsi::Runtime &rt) = 0;
};
template <typename T>
class JSI_EXPORT NativeCameraKitModuleCxxSpec : public TurboModule {
public:
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
return delegate_.create(rt, propName);
}
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
return delegate_.getPropertyNames(runtime);
}
static constexpr std::string_view kModuleName = "RNCameraKitModule";
protected:
NativeCameraKitModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule(std::string{NativeCameraKitModuleCxxSpec::kModuleName}, jsInvoker),
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
private:
class Delegate : public NativeCameraKitModuleCxxSpecJSI {
public:
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
NativeCameraKitModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
}
jsi::Value capture(jsi::Runtime &rt, std::optional<jsi::Object> options, std::optional<double> tag) override {
static_assert(
bridging::getParameterCount(&T::capture) == 3,
"Expected capture(...) to have 3 parameters");
return bridging::callFromJs<jsi::Value>(
rt, &T::capture, jsInvoker_, instance_, std::move(options), std::move(tag));
}
jsi::Value requestDeviceCameraAuthorization(jsi::Runtime &rt) override {
static_assert(
bridging::getParameterCount(&T::requestDeviceCameraAuthorization) == 1,
"Expected requestDeviceCameraAuthorization(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
rt, &T::requestDeviceCameraAuthorization, jsInvoker_, instance_);
}
jsi::Value checkDeviceCameraAuthorizationStatus(jsi::Runtime &rt) override {
static_assert(
bridging::getParameterCount(&T::checkDeviceCameraAuthorizationStatus) == 1,
"Expected checkDeviceCameraAuthorizationStatus(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
rt, &T::checkDeviceCameraAuthorizationStatus, jsInvoker_, instance_);
}
private:
friend class NativeCameraKitModuleCxxSpec;
T *instance_;
};
Delegate delegate_;
};
} // namespace facebook::react

View File

@ -20,7 +20,7 @@
"release:beta": "yarn clean && yarn build && yarn publish --tag beta --verbose",
"release:local": "yarn clean && yarn build && tmp=$(mktemp) && yarn pack --filename $tmp.tar.gz && open -R $tmp.tar.gz",
"start": "watchman watch-del-all && node node_modules/react-native/local-cli/cli.js start",
"codegen": "react-native codegen --verbose --path . --platform ios --source library --outputPath ios/generated && react-native codegen --verbose --path . --platform android --source library --outputPath android/generated",
"codegen": "react-native codegen --verbose --path . --platform ios --source library && react-native codegen --verbose --path . --platform android --source library",
"bootstrap": "cd example/ && bundle install && yarn && cd ios/ && bundle exec pod install",
"bootstrap-linux": "cd example/ && yarn"
},
@ -59,13 +59,8 @@
"node": ">=18"
},
"codegenConfig": {
"name": "rncamerakit_specs",
"name": "NativeCameraKitSpec",
"type": "all",
"outputDir": {
"ios": "ios/generated",
"android": "android/generated"
},
"includesGeneratedCode": true,
"jsSrcsDir": "src/specs",
"android": {
"javaPackageName": "com.rncamerakit"

View File

@ -12,7 +12,6 @@ module.exports = {
dependency: {
platforms: {
android: {
cmakeListsPath: 'generated/jni/CMakeLists.txt',
},
},
},

3177
yarn.lock

File diff suppressed because it is too large Load Diff