@symbiote-native/camera 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +254 -2
- package/build/angular/camera-view/index.d.ts +43 -0
- package/build/angular/camera-view/index.js +101 -0
- package/build/angular/index.d.ts +3 -0
- package/build/angular/index.js +4 -0
- package/build/angular/services/camera-permissions.service.d.ts +8 -0
- package/build/angular/services/camera-permissions.service.js +82 -0
- package/build/core/android-barcode.d.ts +50 -0
- package/build/core/android-barcode.js +2 -0
- package/build/core/camera-api.d.ts +35 -0
- package/build/core/camera-api.js +68 -0
- package/build/core/camera-view-events.d.ts +3 -0
- package/build/core/camera-view-events.js +60 -0
- package/build/core/camera-view-handle.d.ts +26 -0
- package/build/core/camera-view-handle.js +46 -0
- package/build/core/camera-view.d.ts +12 -0
- package/build/core/camera-view.js +38 -0
- package/build/core/constants.d.ts +6 -0
- package/build/core/constants.js +7 -0
- package/build/core/index.d.ts +9 -0
- package/build/core/index.js +5 -0
- package/build/core/native-module.d.ts +28 -0
- package/build/core/native-module.js +3 -0
- package/build/core/picture-options.d.ts +9 -0
- package/build/core/picture-options.js +29 -0
- package/build/core/picture-ref.d.ts +2 -0
- package/build/core/picture-ref.js +3 -0
- package/build/core/props.d.ts +4 -0
- package/build/core/props.js +26 -0
- package/build/core/types.d.ts +170 -0
- package/build/core/types.js +1 -0
- package/build/react/camera-view.d.ts +8 -0
- package/build/react/camera-view.js +6 -0
- package/build/react/index.d.ts +5 -0
- package/build/react/index.js +4 -0
- package/build/react/use-camera-permissions.d.ts +9 -0
- package/build/react/use-camera-permissions.js +5 -0
- package/build/solid/camera-view.d.ts +33 -0
- package/build/solid/camera-view.js +4 -0
- package/build/solid/index.d.ts +4 -0
- package/build/solid/index.js +4 -0
- package/build/solid/use-camera-permissions.d.ts +10 -0
- package/build/solid/use-camera-permissions.js +5 -0
- package/build/svelte/camera-view.svelte +32 -0
- package/build/svelte/camera-view.svelte.d.ts +22 -0
- package/build/svelte/index.d.ts +4 -0
- package/build/svelte/index.js +4 -0
- package/build/svelte/use-camera-permissions.svelte.d.ts +9 -0
- package/build/svelte/use-camera-permissions.svelte.js +5 -0
- package/build/vue/camera-view.d.ts +2 -0
- package/build/vue/camera-view.js +4 -0
- package/build/vue/index.d.ts +4 -0
- package/build/vue/index.js +4 -0
- package/build/vue/use-camera-permissions.d.ts +10 -0
- package/build/vue/use-camera-permissions.js +5 -0
- package/build-ngc/angular/camera-view/index.d.ts +46 -0
- package/build-ngc/angular/camera-view/index.js +60 -0
- package/build-ngc/angular/camera-view/index.js.map +1 -0
- package/build-ngc/angular/index.d.ts +3 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/services/camera-permissions.service.d.ts +13 -0
- package/build-ngc/angular/services/camera-permissions.service.js +28 -0
- package/build-ngc/angular/services/camera-permissions.service.js.map +1 -0
- package/build-ngc/core/android-barcode.d.ts +50 -0
- package/build-ngc/core/android-barcode.js +3 -0
- package/build-ngc/core/android-barcode.js.map +1 -0
- package/build-ngc/core/camera-api.d.ts +35 -0
- package/build-ngc/core/camera-api.js +69 -0
- package/build-ngc/core/camera-api.js.map +1 -0
- package/build-ngc/core/camera-view-events.d.ts +3 -0
- package/build-ngc/core/camera-view-events.js +61 -0
- package/build-ngc/core/camera-view-events.js.map +1 -0
- package/build-ngc/core/camera-view-handle.d.ts +26 -0
- package/build-ngc/core/camera-view-handle.js +47 -0
- package/build-ngc/core/camera-view-handle.js.map +1 -0
- package/build-ngc/core/camera-view.d.ts +12 -0
- package/build-ngc/core/camera-view.js +39 -0
- package/build-ngc/core/camera-view.js.map +1 -0
- package/build-ngc/core/constants.d.ts +6 -0
- package/build-ngc/core/constants.js +8 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/index.d.ts +9 -0
- package/build-ngc/core/index.js +6 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +28 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/picture-options.d.ts +9 -0
- package/build-ngc/core/picture-options.js +30 -0
- package/build-ngc/core/picture-options.js.map +1 -0
- package/build-ngc/core/picture-ref.d.ts +2 -0
- package/build-ngc/core/picture-ref.js +4 -0
- package/build-ngc/core/picture-ref.js.map +1 -0
- package/build-ngc/core/props.d.ts +4 -0
- package/build-ngc/core/props.js +27 -0
- package/build-ngc/core/props.js.map +1 -0
- package/build-ngc/core/types.d.ts +170 -0
- package/build-ngc/core/types.js +2 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +22 -0
- package/package.json +144 -3
- package/src/angular/camera-view/index.ts +95 -0
- package/src/angular/index.ts +8 -0
- package/src/angular/services/camera-permissions.service.ts +28 -0
- package/src/core/android-barcode.ts +51 -0
- package/src/core/camera-api.ts +99 -0
- package/src/core/camera-view-events.ts +108 -0
- package/src/core/camera-view-handle.ts +105 -0
- package/src/core/camera-view.ts +56 -0
- package/src/core/constants.ts +11 -0
- package/src/core/index.ts +57 -0
- package/src/core/native-module.ts +58 -0
- package/src/core/picture-options.ts +46 -0
- package/src/core/picture-ref.ts +4 -0
- package/src/core/props.ts +31 -0
- package/src/core/types.ts +212 -0
- package/src/react/camera-view.ts +17 -0
- package/src/react/index.ts +10 -0
- package/src/react/use-camera-permissions.ts +21 -0
- package/src/solid/camera-view.ts +9 -0
- package/src/solid/index.ts +9 -0
- package/src/solid/use-camera-permissions.ts +22 -0
- package/src/svelte/camera-view.svelte +32 -0
- package/src/svelte/index.ts +9 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +6 -0
- package/src/svelte/use-camera-permissions.svelte.ts +19 -0
- package/src/vue/camera-view.ts +8 -0
- package/src/vue/index.ts +9 -0
- package/src/vue/use-camera-permissions.ts +22 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
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gBAClB,IAAI,OAAO,aAAa,KAAK,UAAU;oBAAE,aAAa,EAAE,CAAC;YAC3D,CAAC;YACD,YAAY,EAAE,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,YAAY,CAAC;YAC1D,gBAAgB,EACd,OAAO,gBAAgB,KAAK,UAAU;gBACpC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBACnD,CAAC,CAAC,SAAS;YACf,wBAAwB,EAAE,OAAO,CAC/B,KAAK,EACL,0BAA0B,EAC1B,QAAQ,CACT;YACD,8BAA8B,EAAE,OAAO,CACrC,KAAK,EACL,gCAAgC,EAChC,aAAa,CACd;YACD,cAAc,EAAE,CAAC,KAAqB,EAAQ,EAAE;gBAC9C,IAAI,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;oBACtC,kBAAkB,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ISymbioteNode } from '@symbiote-native/engine';
|
|
2
|
+
import type { ICameraPictureRef } from './native-module';
|
|
3
|
+
import type { ICameraCapturedPicture, ICameraPictureOptions, ICameraRecordingOptions, ICameraSupportedFeatures } from './types';
|
|
4
|
+
export type ICameraViewHandle = {
|
|
5
|
+
/** Waits for `onCameraReady` first. With `pictureRef` it resolves to a native image reference */
|
|
6
|
+
takePictureAsync(options: ICameraPictureOptions & {
|
|
7
|
+
pictureRef: true;
|
|
8
|
+
}): Promise<ICameraPictureRef | undefined>;
|
|
9
|
+
takePictureAsync(options?: ICameraPictureOptions): Promise<ICameraCapturedPicture | undefined>;
|
|
10
|
+
/** Resolves when `stopRecording` runs, a limit is reached or the preview stops */
|
|
11
|
+
recordAsync(options?: ICameraRecordingOptions): Promise<{
|
|
12
|
+
uri: string;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
/** Pauses or resumes the recording, iOS 18 and later on iOS */
|
|
15
|
+
toggleRecordingAsync(): Promise<void>;
|
|
16
|
+
stopRecording(): void;
|
|
17
|
+
pausePreview(): Promise<void>;
|
|
18
|
+
resumePreview(): Promise<void>;
|
|
19
|
+
getAvailablePictureSizesAsync(): Promise<string[]>;
|
|
20
|
+
/** Lenses exist on iOS only */
|
|
21
|
+
getAvailableLensesAsync(): Promise<string[]>;
|
|
22
|
+
getSupportedFeatures(): ICameraSupportedFeatures;
|
|
23
|
+
/** The host node of the mounted view, `createCameraTextureAsync` of a GL view takes it */
|
|
24
|
+
getHostNode(): ISymbioteNode | null;
|
|
25
|
+
};
|
|
26
|
+
export declare function createCameraViewHandle(getNode: () => ISymbioteNode | null | undefined): ICameraViewHandle;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Platform, requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
import { defineExpoViewMethods, getNativeTag } from '@symbiote-native/engine';
|
|
3
|
+
import { CAMERA_MODULE_NAME } from './constants';
|
|
4
|
+
import { expoCamera } from './native-module';
|
|
5
|
+
import { ensurePictureOptions, ensureRecordingOptions, } from './picture-options';
|
|
6
|
+
const callViewFunction = defineExpoViewMethods(requireNativeModule, CAMERA_MODULE_NAME);
|
|
7
|
+
export function createCameraViewHandle(getNode) {
|
|
8
|
+
// Like upstream's `ref.current?.`, a view that has not committed yet answers nothing
|
|
9
|
+
function call(method, args = []) {
|
|
10
|
+
const node = getNode();
|
|
11
|
+
if (!node || getNativeTag(node) === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
return callViewFunction(node, method, args);
|
|
14
|
+
}
|
|
15
|
+
async function takePictureAsync(options) {
|
|
16
|
+
const pictureOptions = ensurePictureOptions(options);
|
|
17
|
+
// The picture ref is an iOS feature, Android answers a plain picture
|
|
18
|
+
if (Platform.select({ ios: Boolean(options?.pictureRef), default: false })) {
|
|
19
|
+
return call('takePictureRef', [
|
|
20
|
+
pictureOptions,
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
return call('takePicture', [
|
|
24
|
+
pictureOptions,
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
takePictureAsync,
|
|
29
|
+
recordAsync: async (options) => call('record', [
|
|
30
|
+
ensureRecordingOptions(options),
|
|
31
|
+
]),
|
|
32
|
+
toggleRecordingAsync: async () => call('toggleRecording'),
|
|
33
|
+
stopRecording: () => {
|
|
34
|
+
call('stopRecording');
|
|
35
|
+
},
|
|
36
|
+
pausePreview: async () => call('pausePreview'),
|
|
37
|
+
resumePreview: async () => call('resumePreview'),
|
|
38
|
+
getAvailablePictureSizesAsync: async () => (await call('getAvailablePictureSizes')) ?? [],
|
|
39
|
+
getAvailableLensesAsync: async () => (await call('getAvailableLenses')) ?? [],
|
|
40
|
+
getSupportedFeatures: () => ({
|
|
41
|
+
isModernBarcodeScannerAvailable: expoCamera.isModernBarcodeScannerAvailable,
|
|
42
|
+
toggleRecordingAsyncAvailable: expoCamera.toggleRecordingAsyncAvailable,
|
|
43
|
+
}),
|
|
44
|
+
getHostNode: () => getNode() ?? null,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=camera-view-handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-view-handle.js","sourceRoot":"","sources":["../../src/core/camera-view-handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAiC3B,MAAM,g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AA6B,EAAE,KAAK,IAAI,EAAE,CACxC,CAAC,MAAM,IAAI,CAAoB,0BAA0B,CAAC,CAAC,IAAI,EAAE;QACnE,uBAAuB,EAAE,KAAK,IAAI,EAAE,CAClC,CAAC,MAAM,IAAI,CAAoB,oBAAoB,CAAC,CAAC,IAAI,EAAE;QAC7D,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC;YAC3B,+BAA+B,EAC7B,UAAU,CAAC,+BAA+B;YAC5C,6BAA6B,EAAE,UAAU,CAAC,6BAA6B;SACxE,CAAC;QACF,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,IAAI;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IDescriptor } from '@symbiote-native/components';
|
|
2
|
+
import type { ISymbioteNode } from '@symbiote-native/engine';
|
|
3
|
+
import type { ICameraViewHandle } from './camera-view-handle';
|
|
4
|
+
export declare const cameraViewName: () => string;
|
|
5
|
+
export declare const ensureCameraViewRegistered: () => boolean;
|
|
6
|
+
export type ICameraView = {
|
|
7
|
+
handle: ICameraViewHandle;
|
|
8
|
+
/** `null` means the view cannot register and the caller renders nothing */
|
|
9
|
+
render(props: object): IDescriptor | null;
|
|
10
|
+
};
|
|
11
|
+
/** One per mounted view, `getNode` answers the host node once it exists */
|
|
12
|
+
export declare function createCameraView(getNode: () => ISymbioteNode | null | undefined): ICameraView;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Ядро `CameraView`: нативный view камеры, чьи функции вызываются через `ViewPrototypes`
|
|
2
|
+
import { requireNativeViewManager } from 'expo-modules-core';
|
|
3
|
+
import { el } from '@symbiote-native/components';
|
|
4
|
+
import { defineExpoNativeView, isDevBuild } from '@symbiote-native/engine';
|
|
5
|
+
import { createCameraViewEvents } from './camera-view-events';
|
|
6
|
+
import { createCameraViewHandle } from './camera-view-handle';
|
|
7
|
+
import { CAMERA_MODULE_NAME } from './constants';
|
|
8
|
+
import { ensureNativeProps } from './props';
|
|
9
|
+
// Регистрация идёт при рендере: побочный эффект барреля теряется в release
|
|
10
|
+
const cameraView = defineExpoNativeView(requireNativeViewManager, CAMERA_MODULE_NAME);
|
|
11
|
+
export const cameraViewName = cameraView.name;
|
|
12
|
+
export const ensureCameraViewRegistered = cameraView.ensureRegistered;
|
|
13
|
+
// What upstream's `defaultProps` gave the class component
|
|
14
|
+
const DEFAULT_VIEW_PROPS = {
|
|
15
|
+
zoom: 0,
|
|
16
|
+
facing: 'back',
|
|
17
|
+
enableTorch: false,
|
|
18
|
+
mode: 'picture',
|
|
19
|
+
flash: 'off',
|
|
20
|
+
};
|
|
21
|
+
/** One per mounted view, `getNode` answers the host node once it exists */
|
|
22
|
+
export function createCameraView(getNode) {
|
|
23
|
+
const toEvents = createCameraViewEvents();
|
|
24
|
+
return {
|
|
25
|
+
handle: createCameraViewHandle(getNode),
|
|
26
|
+
render: props => {
|
|
27
|
+
if (!ensureCameraViewRegistered()) {
|
|
28
|
+
if (isDevBuild())
|
|
29
|
+
console.warn("'CameraView' is not available.");
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return el(cameraViewName(), {
|
|
33
|
+
...ensureNativeProps({ ...DEFAULT_VIEW_PROPS, ...props }),
|
|
34
|
+
...toEvents(props),
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=camera-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-view.js","sourceRoot":"","sources":["../../src/core/camera-view.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,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
3
|
+
export declare const CAMERA_PACKAGE_NAME = "expo-camera";
|
|
4
|
+
/** Equal barcode events of one type inside this window are dropped */
|
|
5
|
+
export declare const BARCODE_EVENT_THROTTLE_MS = 500;
|
|
6
|
+
export declare const MODERN_SCANNER_EVENT = "onModernBarcodeScanned";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Apart from `native-module`, which resolves the module on import: the view needs the name too
|
|
2
|
+
export const CAMERA_MODULE_NAME = 'ExpoCamera';
|
|
3
|
+
/** The label upstream puts into its `UnavailabilityError` */
|
|
4
|
+
export const CAMERA_PACKAGE_NAME = 'expo-camera';
|
|
5
|
+
/** Equal barcode events of one type inside this window are dropped */
|
|
6
|
+
export const BARCODE_EVENT_THROTTLE_MS = 500;
|
|
7
|
+
export const MODERN_SCANNER_EVENT = 'onModernBarcodeScanned';
|
|
8
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE/C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEjD,sEAAsE;AACtE,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Camera, cameraPermissionMethods, dismissScanner, getAvailableVideoCodecsAsync, isCameraAvailableAsync, isModernBarcodeScannerAvailable, launchScanner, microphonePermissionMethods, onModernBarcodeScanned, scanFromURLAsync, } from './camera-api';
|
|
2
|
+
export { cameraViewName, createCameraView, ensureCameraViewRegistered, type ICameraView, } from './camera-view';
|
|
3
|
+
export type { ICameraViewHandle } from './camera-view-handle';
|
|
4
|
+
export { CAMERA_MODULE_NAME } from './constants';
|
|
5
|
+
export type { ICameraPictureRef } from './native-module';
|
|
6
|
+
export { PictureRef } from './picture-ref';
|
|
7
|
+
export type { IAndroidBarcode } from './android-barcode';
|
|
8
|
+
export type { ICameraAvailableLenses, ICameraBarcodeBounds, ICameraBarcodePoint, ICameraBarcodeScanningResult, ICameraBarcodeSettings, ICameraBarcodeType, ICameraCapturedPicture, ICameraFlashMode, ICameraFocusMode, ICameraMode, ICameraMountError, ICameraOrientation, ICameraPhotoResult, ICameraPictureOptions, ICameraRatio, ICameraRecordingOptions, ICameraResponsiveOrientation, ICameraSavePictureOptions, ICameraScanningOptions, ICameraScanningResult, ICameraSupportedFeatures, ICameraType, ICameraVideoCodec, ICameraVideoQuality, ICameraVideoStabilization, ICameraViewProps, } from './types';
|
|
9
|
+
export { PermissionStatus, type EventSubscription, type PermissionExpiration, type PermissionResponse, } from 'expo-modules-core';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Camera, cameraPermissionMethods, dismissScanner, getAvailableVideoCodecsAsync, isCameraAvailableAsync, isModernBarcodeScannerAvailable, launchScanner, microphonePermissionMethods, onModernBarcodeScanned, scanFromURLAsync, } from './camera-api';
|
|
2
|
+
export { cameraViewName, createCameraView, ensureCameraViewRegistered, } from './camera-view';
|
|
3
|
+
export { CAMERA_MODULE_NAME } from './constants';
|
|
4
|
+
export { PictureRef } from './picture-ref';
|
|
5
|
+
export { PermissionStatus, } from 'expo-modules-core';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,uBAAuB,EACvB,cAAc,EACd,4BAA4B,EAC5B,sBAAsB,EACtB,+BAA+B,EAC/B,aAAa,EACb,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,0BAA0B,GAE3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA8B3C,OAAO,EACL,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EventSubscription, PermissionResponse, SharedRef } from 'expo-modules-core';
|
|
2
|
+
import type { ICameraBarcodeScanningResult, ICameraBarcodeType, ICameraPhotoResult, ICameraSavePictureOptions, ICameraScanningOptions, ICameraScanningResult, ICameraVideoCodec } from './types';
|
|
3
|
+
/** A reference to a native instance of an image, other Expo packages accept it as is */
|
|
4
|
+
export type ICameraPictureRef = SharedRef<'image'> & {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
/** Saves the image into the cache directory */
|
|
8
|
+
savePictureAsync(options?: ICameraSavePictureOptions): Promise<ICameraPhotoResult>;
|
|
9
|
+
};
|
|
10
|
+
export type ICameraPictureRefClass = abstract new (...args: never[]) => ICameraPictureRef;
|
|
11
|
+
export type ICameraNativeModule = {
|
|
12
|
+
Picture: ICameraPictureRefClass;
|
|
13
|
+
readonly isModernBarcodeScannerAvailable: boolean;
|
|
14
|
+
readonly toggleRecordingAsyncAvailable: boolean;
|
|
15
|
+
readonly Type: Record<string, string>;
|
|
16
|
+
readonly FlashMode: Record<string, string>;
|
|
17
|
+
isAvailableAsync?(): Promise<boolean>;
|
|
18
|
+
launchScanner(options?: ICameraScanningOptions): Promise<void>;
|
|
19
|
+
dismissScanner(): Promise<void>;
|
|
20
|
+
scanFromURLAsync(url: string, barcodeTypes?: ICameraBarcodeType[]): Promise<ICameraBarcodeScanningResult[]>;
|
|
21
|
+
getCameraPermissionsAsync(): Promise<PermissionResponse>;
|
|
22
|
+
requestCameraPermissionsAsync(): Promise<PermissionResponse>;
|
|
23
|
+
getMicrophonePermissionsAsync(): Promise<PermissionResponse>;
|
|
24
|
+
requestMicrophonePermissionsAsync(): Promise<PermissionResponse>;
|
|
25
|
+
getAvailableVideoCodecsAsync?(): Promise<ICameraVideoCodec[]>;
|
|
26
|
+
addListener(eventName: string, listener: (event: ICameraScanningResult) => void): EventSubscription;
|
|
27
|
+
};
|
|
28
|
+
export declare const expoCamera: ICameraNativeModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAMxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAkDjD,MAAM,CAAC,MAAM,UAAU,GACrB,mBAAmB,CAAsB,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ICameraCapturedPicture, ICameraPictureOptions, ICameraRecordingOptions } from './types';
|
|
2
|
+
export declare function ensurePictureOptions(options?: ICameraPictureOptions): ICameraPictureOptions;
|
|
3
|
+
export declare function ensureRecordingOptions(options?: ICameraRecordingOptions): ICameraRecordingOptions;
|
|
4
|
+
export declare function handlePictureSaved({ nativeEvent, }: {
|
|
5
|
+
nativeEvent: {
|
|
6
|
+
data: ICameraCapturedPicture;
|
|
7
|
+
id: number;
|
|
8
|
+
};
|
|
9
|
+
}): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const MIRROR_DEPRECATED = 'The `mirror` option is deprecated. Please use the `mirror` prop on the `CameraView` instead.';
|
|
2
|
+
// The callbacks wait here for the native event that carries their picture
|
|
3
|
+
const pictureSavedCallbacks = new Map();
|
|
4
|
+
let nextPictureId = 1;
|
|
5
|
+
export function ensurePictureOptions(options) {
|
|
6
|
+
if (!options || typeof options !== 'object')
|
|
7
|
+
return {};
|
|
8
|
+
if (options.mirror)
|
|
9
|
+
console.warn(MIRROR_DEPRECATED);
|
|
10
|
+
const { onPictureSaved, ...rest } = options;
|
|
11
|
+
const withQuality = { ...rest, quality: options.quality ?? 1 };
|
|
12
|
+
if (!onPictureSaved)
|
|
13
|
+
return withQuality;
|
|
14
|
+
const id = nextPictureId++;
|
|
15
|
+
pictureSavedCallbacks.set(id, onPictureSaved);
|
|
16
|
+
return { ...withQuality, id, fastMode: true };
|
|
17
|
+
}
|
|
18
|
+
export function ensureRecordingOptions(options = {}) {
|
|
19
|
+
if (options.mirror)
|
|
20
|
+
console.warn(MIRROR_DEPRECATED);
|
|
21
|
+
return options;
|
|
22
|
+
}
|
|
23
|
+
export function handlePictureSaved({ nativeEvent, }) {
|
|
24
|
+
const callback = pictureSavedCallbacks.get(nativeEvent.id);
|
|
25
|
+
if (!callback)
|
|
26
|
+
return;
|
|
27
|
+
pictureSavedCallbacks.delete(nativeEvent.id);
|
|
28
|
+
callback(nativeEvent.data);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=picture-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picture-options.js","sourceRoot":"","sources":["../../src/core/picture-options.ts"],"names":[],"mappings":"AAMA,MAAM,iBAAiB,GACrB,8FAA8F,CAAC;AAEjG,0EAA0E;AAC1E,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAGlC,CAAC;AACJ,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB,MAAM,UAAU,oBAAoB,CAClC,OAA+B;IAE/B,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACvD,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACpD,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC;IAC/D,IAAI,CAAC,cAAc;QAAE,OAAO,WAAW,CAAC;IACxC,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;IAC3B,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;IAC9C,OAAO,EAAE,GAAG,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,UAAmC,EAAE;IAErC,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,WAAW,GAGZ;IACC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC3D,IAAI,CAAC,QAAQ;QAAE,OAAO;IACtB,qBAAqB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC7C,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picture-ref.js","sourceRoot":"","sources":["../../src/core/picture-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { expoCamera } from './native-module';
|
|
2
|
+
// Values under these keys become native options, the tables come from the native module
|
|
3
|
+
function conversionTableFor(key) {
|
|
4
|
+
if (key === 'type')
|
|
5
|
+
return expoCamera.Type;
|
|
6
|
+
if (key === 'flash')
|
|
7
|
+
return expoCamera.FlashMode;
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
function convertNativeProps(props) {
|
|
11
|
+
return Object.fromEntries(Object.entries(props).map(([key, value]) => {
|
|
12
|
+
const table = conversionTableFor(key);
|
|
13
|
+
return [key, typeof value === 'string' && table ? table[value] : value];
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
/** The props the native view takes, built from the friendly ones of the view */
|
|
17
|
+
export function ensureNativeProps(props) {
|
|
18
|
+
const { poster: _poster, ...native } = convertNativeProps(props);
|
|
19
|
+
return {
|
|
20
|
+
...native,
|
|
21
|
+
barcodeScannerEnabled: Boolean(Reflect.get(props, 'onBarcodeScanned')),
|
|
22
|
+
flashMode: Reflect.get(props, 'flash') ?? 'off',
|
|
23
|
+
mute: Reflect.get(props, 'mute') ?? false,
|
|
24
|
+
autoFocus: Reflect.get(props, 'autofocus') ?? 'off',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/core/props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,wFAAwF;AACxF,SAAS,kBAAkB,CAAC,GAAW;IACrC,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC;IAC3C,IAAI,GAAG,KAAK,OAAO;QAAE,OAAO,UAAU,CAAC,SAAS,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACzC,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,EAAE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1E,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO;QACL,GAAG,MAAM;QACT,qBAAqB,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;QACtE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,KAAK;QAC/C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,KAAK;QACzC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,KAAK;KACpD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { IAccessibilityProps, IAriaProps, IResponderProps } from '@symbiote-native/components';
|
|
2
|
+
import type { IStyleProp, ISymbioteEvent, IViewStyle } from '@symbiote-native/engine';
|
|
3
|
+
import type { IAndroidBarcode } from './android-barcode';
|
|
4
|
+
export type ICameraType = 'front' | 'back';
|
|
5
|
+
/**
|
|
6
|
+
* `screen` uses the display as the flash of a front camera, on iOS it maps to `on`
|
|
7
|
+
* and Retina Flash fires
|
|
8
|
+
*/
|
|
9
|
+
export type ICameraFlashMode = 'off' | 'on' | 'auto' | 'screen';
|
|
10
|
+
/** `on` focuses once and locks, `off` focuses whenever needed */
|
|
11
|
+
export type ICameraFocusMode = 'on' | 'off';
|
|
12
|
+
export type ICameraMode = 'picture' | 'video';
|
|
13
|
+
export type ICameraRatio = '4:3' | '16:9' | '1:1';
|
|
14
|
+
/** The codec of a video recording, iOS only */
|
|
15
|
+
export type ICameraVideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';
|
|
16
|
+
/** On Android all but `off` turn the stabilization on, the device picks the method */
|
|
17
|
+
export type ICameraVideoStabilization = 'off' | 'standard' | 'cinematic' | 'auto';
|
|
18
|
+
export type ICameraVideoQuality = '2160p' | '1080p' | '720p' | '480p' | '4:3';
|
|
19
|
+
export type ICameraOrientation = 'portrait' | 'portraitUpsideDown' | 'landscapeLeft' | 'landscapeRight';
|
|
20
|
+
export type ICameraBarcodeType = 'aztec' | 'ean13' | 'ean8' | 'qr' | 'pdf417' | 'upc_e' | 'datamatrix' | 'code39' | 'code93' | 'itf14' | 'codabar' | 'code128' | 'upc_a';
|
|
21
|
+
export type ICameraCapturedPicture = {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
format: 'jpg' | 'png';
|
|
25
|
+
uri: string;
|
|
26
|
+
/** Base64 of the JPEG data, present when the `base64` option was set */
|
|
27
|
+
base64?: string;
|
|
28
|
+
/** The EXIF tags and their values, present when the `exif` option was set */
|
|
29
|
+
exif?: Record<string, unknown>;
|
|
30
|
+
};
|
|
31
|
+
export type ICameraPictureOptions = {
|
|
32
|
+
/** From `0` (small) to `1` (best), `1` by default */
|
|
33
|
+
quality?: number;
|
|
34
|
+
base64?: boolean;
|
|
35
|
+
exif?: boolean;
|
|
36
|
+
/** Extra EXIF data, takes effect with `exif` */
|
|
37
|
+
additionalExif?: Record<string, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Called when the picture is saved, the promise then resolves at once with no data
|
|
40
|
+
* and the picture goes to this callback
|
|
41
|
+
*/
|
|
42
|
+
onPictureSaved?: (picture: ICameraCapturedPicture) => void;
|
|
43
|
+
/** Returns the image as it came from the sensor, `quality` is discarded */
|
|
44
|
+
skipProcessing?: boolean;
|
|
45
|
+
/** @deprecated Use the `mirror` prop of the view */
|
|
46
|
+
mirror?: boolean;
|
|
47
|
+
id?: number;
|
|
48
|
+
fastMode?: boolean;
|
|
49
|
+
maxDownsampling?: number;
|
|
50
|
+
/** `true` by default */
|
|
51
|
+
shutterSound?: boolean;
|
|
52
|
+
/** Resolves to a reference to the native image instead of a file */
|
|
53
|
+
pictureRef?: boolean;
|
|
54
|
+
};
|
|
55
|
+
export type ICameraRecordingOptions = {
|
|
56
|
+
/** In seconds */
|
|
57
|
+
maxDuration?: number;
|
|
58
|
+
/** In bytes */
|
|
59
|
+
maxFileSize?: number;
|
|
60
|
+
/** @deprecated Use the `mirror` prop of the view */
|
|
61
|
+
mirror?: boolean;
|
|
62
|
+
/** iOS only */
|
|
63
|
+
codec?: ICameraVideoCodec;
|
|
64
|
+
};
|
|
65
|
+
export type ICameraAvailableLenses = {
|
|
66
|
+
lenses: string[];
|
|
67
|
+
};
|
|
68
|
+
export type ICameraResponsiveOrientation = {
|
|
69
|
+
orientation: ICameraOrientation;
|
|
70
|
+
};
|
|
71
|
+
export type ICameraMountError = {
|
|
72
|
+
message: string;
|
|
73
|
+
};
|
|
74
|
+
export type ICameraBarcodePoint = {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
};
|
|
78
|
+
export type ICameraBarcodeBounds = {
|
|
79
|
+
origin: ICameraBarcodePoint;
|
|
80
|
+
size: {
|
|
81
|
+
height: number;
|
|
82
|
+
width: number;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export type ICameraBarcodeScanningResult = {
|
|
86
|
+
type: string;
|
|
87
|
+
/** The parsed information encoded in the barcode */
|
|
88
|
+
data: string;
|
|
89
|
+
/** The raw information, Android only */
|
|
90
|
+
raw?: string;
|
|
91
|
+
/** The order of the points differs per platform, and is empty for some types */
|
|
92
|
+
cornerPoints: ICameraBarcodePoint[];
|
|
93
|
+
bounds: ICameraBarcodeBounds;
|
|
94
|
+
/** Extra information of the type of barcode, Android only */
|
|
95
|
+
extra?: IAndroidBarcode;
|
|
96
|
+
};
|
|
97
|
+
export type ICameraScanningResult = Omit<ICameraBarcodeScanningResult, 'bounds' | 'cornerPoints'>;
|
|
98
|
+
export type ICameraBarcodeSettings = {
|
|
99
|
+
barcodeTypes: ICameraBarcodeType[];
|
|
100
|
+
};
|
|
101
|
+
/** The options of the system scanner, iOS 16+ and Google's code scanner on Android */
|
|
102
|
+
export type ICameraScanningOptions = {
|
|
103
|
+
barcodeTypes: ICameraBarcodeType[];
|
|
104
|
+
/** iOS only, `true` by default */
|
|
105
|
+
isPinchToZoomEnabled?: boolean;
|
|
106
|
+
/** iOS only, `true` by default */
|
|
107
|
+
isGuidanceEnabled?: boolean;
|
|
108
|
+
/** iOS only, `false` by default */
|
|
109
|
+
isHighlightingEnabled?: boolean;
|
|
110
|
+
};
|
|
111
|
+
export type ICameraPhotoResult = {
|
|
112
|
+
uri: string;
|
|
113
|
+
width: number;
|
|
114
|
+
height: number;
|
|
115
|
+
base64?: string;
|
|
116
|
+
};
|
|
117
|
+
export type ICameraSavePictureOptions = {
|
|
118
|
+
quality?: number;
|
|
119
|
+
metadata?: Record<string, unknown>;
|
|
120
|
+
base64?: boolean;
|
|
121
|
+
};
|
|
122
|
+
export type ICameraViewProps = IAccessibilityProps & IAriaProps & IResponderProps & {
|
|
123
|
+
/** `back` by default */
|
|
124
|
+
facing?: ICameraType;
|
|
125
|
+
/** `off` by default */
|
|
126
|
+
flash?: ICameraFlashMode;
|
|
127
|
+
/** From `0` to `1`, a share of the maximum zoom of the device */
|
|
128
|
+
zoom?: number;
|
|
129
|
+
/** `picture` by default */
|
|
130
|
+
mode?: ICameraMode;
|
|
131
|
+
/** Records video with no sound */
|
|
132
|
+
mute?: boolean;
|
|
133
|
+
/** Mirrors the image of the front camera */
|
|
134
|
+
mirror?: boolean;
|
|
135
|
+
/** iOS only, `off` by default */
|
|
136
|
+
autofocus?: ICameraFocusMode;
|
|
137
|
+
/** Stops the session while `false`, iOS only, `true` by default */
|
|
138
|
+
active?: boolean;
|
|
139
|
+
videoQuality?: ICameraVideoQuality;
|
|
140
|
+
/** In bits per second, on iOS needs the codec in `recordAsync` */
|
|
141
|
+
videoBitrate?: number;
|
|
142
|
+
animateShutter?: boolean;
|
|
143
|
+
/** Makes `ratio` ignored, the sizes come from `getAvailablePictureSizesAsync` */
|
|
144
|
+
pictureSize?: string;
|
|
145
|
+
/** iOS only, `builtInWideAngleCamera` by default */
|
|
146
|
+
selectedLens?: string;
|
|
147
|
+
enableTorch?: boolean;
|
|
148
|
+
/** `auto` by default */
|
|
149
|
+
videoStabilizationMode?: ICameraVideoStabilization;
|
|
150
|
+
barcodeScannerSettings?: ICameraBarcodeSettings;
|
|
151
|
+
/** Takes landscape pictures of a portrait-locked app when the device turns, iOS only */
|
|
152
|
+
responsiveOrientationWhenOrientationLocked?: boolean;
|
|
153
|
+
/** Android only, switches the preview from fill to fit */
|
|
154
|
+
ratio?: ICameraRatio;
|
|
155
|
+
onCameraReady?: () => void;
|
|
156
|
+
onMountError?: (event: ICameraMountError) => void;
|
|
157
|
+
onBarcodeScanned?: (result: ICameraBarcodeScanningResult) => void;
|
|
158
|
+
/** iOS only */
|
|
159
|
+
onResponsiveOrientationChanged?: (event: ICameraResponsiveOrientation) => void;
|
|
160
|
+
/** iOS only */
|
|
161
|
+
onAvailableLensesChanged?: (event: ICameraAvailableLenses) => void;
|
|
162
|
+
style?: IStyleProp<IViewStyle>;
|
|
163
|
+
testID?: string;
|
|
164
|
+
nativeID?: string;
|
|
165
|
+
onLayout?: (event: ISymbioteEvent) => void;
|
|
166
|
+
};
|
|
167
|
+
export type ICameraSupportedFeatures = {
|
|
168
|
+
isModernBarcodeScannerAvailable: boolean;
|
|
169
|
+
toggleRecordingAsyncAvailable: boolean;
|
|
170
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
|
package/native-link.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"android": {
|
|
3
|
+
"gradleProjectName": "expo-camera",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"importPath": "expo.modules.camera.CameraViewModule",
|
|
7
|
+
"className": "CameraViewModule",
|
|
8
|
+
"nativeName": "ExpoCamera"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"manifestPermissions": [
|
|
12
|
+
"android.permission.CAMERA",
|
|
13
|
+
"android.permission.RECORD_AUDIO"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"ios": {
|
|
17
|
+
"infoPlistKeys": {
|
|
18
|
+
"NSCameraUsageDescription": "Allow $(PRODUCT_NAME) to access your camera",
|
|
19
|
+
"NSMicrophoneUsageDescription": "Allow $(PRODUCT_NAME) to access your microphone"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|