expo-camera 15.0.3 → 15.0.4

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/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 15.0.4 — 2024-05-07
14
+
15
+ ### 🎉 New features
16
+
17
+ - Add `autoFocus` prop to allow setting the device focus mode. ([#28650](https://github.com/expo/expo/pull/28650) by [@alanjhughes](https://github.com/alanjhughes))
18
+
13
19
  ## 15.0.3 — 2024-04-29
14
20
 
15
21
  ### 🎉 New features
@@ -1,7 +1,7 @@
1
1
  apply plugin: 'com.android.library'
2
2
 
3
3
  group = 'host.exp.exponent'
4
- version = '15.0.3'
4
+ version = '15.0.4'
5
5
 
6
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
7
  apply from: expoModulesCorePlugin
@@ -14,7 +14,7 @@ android {
14
14
  namespace "expo.modules.camera"
15
15
  defaultConfig {
16
16
  versionCode 32
17
- versionName "15.0.3"
17
+ versionName "15.0.4"
18
18
  }
19
19
  }
20
20
 
@@ -10,6 +10,7 @@ import expo.modules.camera.records.BarcodeType
10
10
  import expo.modules.camera.records.CameraMode
11
11
  import expo.modules.camera.records.CameraType
12
12
  import expo.modules.camera.records.FlashMode
13
+ import expo.modules.camera.records.FocusMode
13
14
  import expo.modules.camera.records.VideoQuality
14
15
  import expo.modules.camera.tasks.ResolveTakenPicture
15
16
  import expo.modules.core.errors.ModuleDestroyedException
@@ -182,6 +183,10 @@ class CameraViewModule : Module() {
182
183
  }
183
184
  }
184
185
 
186
+ Prop("autoFocus") { view, autoFocus: FocusMode? ->
187
+ view.autoFocus = autoFocus ?: FocusMode.OFF
188
+ }
189
+
185
190
  OnViewDidUpdateProps { view ->
186
191
  view.createCamera()
187
192
  }
@@ -24,6 +24,8 @@ import androidx.camera.core.Camera
24
24
  import androidx.camera.core.CameraInfo
25
25
  import androidx.camera.core.CameraSelector
26
26
  import androidx.camera.core.CameraState
27
+ import androidx.camera.core.DisplayOrientedMeteringPointFactory
28
+ import androidx.camera.core.FocusMeteringAction
27
29
  import androidx.camera.core.ImageAnalysis
28
30
  import androidx.camera.core.ImageCapture
29
31
  import androidx.camera.core.ImageCaptureException
@@ -53,6 +55,7 @@ import expo.modules.camera.records.BarcodeType
53
55
  import expo.modules.camera.records.CameraMode
54
56
  import expo.modules.camera.records.CameraType
55
57
  import expo.modules.camera.records.FlashMode
58
+ import expo.modules.camera.records.FocusMode
56
59
  import expo.modules.camera.records.VideoQuality
57
60
  import expo.modules.camera.tasks.ResolveTakenPicture
58
61
  import expo.modules.camera.utils.FileSystemUtils
@@ -113,6 +116,18 @@ class ExpoCameraView(
113
116
  shouldCreateCamera = true
114
117
  }
115
118
 
119
+ var autoFocus: FocusMode = FocusMode.OFF
120
+ set(value) {
121
+ field = value
122
+ camera?.cameraControl?.let {
123
+ if (field == FocusMode.OFF) {
124
+ it.cancelFocusAndMetering()
125
+ } else {
126
+ startFocusMetering()
127
+ }
128
+ }
129
+ }
130
+
116
131
  var videoQuality: VideoQuality = VideoQuality.VIDEO1080P
117
132
  set(value) {
118
133
  field = value
@@ -367,6 +382,20 @@ class ExpoCameraView(
367
382
  .build()
368
383
  }
369
384
 
385
+ private fun startFocusMetering() {
386
+ camera?.let {
387
+ val meteringPointFactory = DisplayOrientedMeteringPointFactory(
388
+ previewView.display,
389
+ it.cameraInfo,
390
+ previewView.width.toFloat(),
391
+ previewView.height.toFloat()
392
+ )
393
+ val action = FocusMeteringAction.Builder(meteringPointFactory.createPoint(1f, 1f), FocusMeteringAction.FLAG_AF)
394
+ .build()
395
+ it.cameraControl.startFocusAndMetering(action)
396
+ }
397
+ }
398
+
370
399
  private fun observeCameraState(cameraInfo: CameraInfo) {
371
400
  cameraInfo.cameraState.observe(currentActivity) {
372
401
  when (it.type) {
@@ -57,6 +57,11 @@ enum class CameraMode(val value: String) : Enumerable {
57
57
  VIDEO("video")
58
58
  }
59
59
 
60
+ enum class FocusMode(val value: String) : Enumerable {
61
+ ON("on"),
62
+ OFF("off")
63
+ }
64
+
60
65
  data class BarcodeSettings(
61
66
  @Field val barcodeTypes: List<BarcodeType>,
62
67
  @Field val interval: Double?
@@ -5,6 +5,13 @@ export type CameraType = 'front' | 'back';
5
5
  export type FlashMode = 'off' | 'on' | 'auto';
6
6
  export type ImageType = 'png' | 'jpg';
7
7
  export type CameraMode = 'picture' | 'video';
8
+ /**
9
+ * This option specifies the mode of focus on the device.
10
+ * - `on` - Indicates that the device should autofocus once and then lock the focus.
11
+ * - `off` - Indicates that the device should automatically focus when needed.
12
+ * @default off
13
+ */
14
+ export type FocusMode = 'on' | 'off';
8
15
  /**
9
16
  * This option specifies what codec to use when recording a video.
10
17
  * @platform ios
@@ -268,6 +275,12 @@ export type CameraProps = ViewProps & {
268
275
  * @default false
269
276
  */
270
277
  mute?: boolean;
278
+ /**
279
+ * Indicates the focus mode to use.
280
+ * @default off
281
+ * @platform ios
282
+ */
283
+ autofocus?: FocusMode;
271
284
  /**
272
285
  * Specify the quality of the recorded video. Use one of `VideoQuality` possible values:
273
286
  * for 16:9 resolution `2160p`, `1080p`, `720p`, `480p` : `Android only` and for 4:3 `4:3` (the size is 640x480).
@@ -372,6 +385,7 @@ export type CameraNativeProps = {
372
385
  flashMode?: string;
373
386
  enableTorch?: boolean;
374
387
  animateShutter?: boolean;
388
+ autoFocus?: FocusMode;
375
389
  mute?: boolean;
376
390
  zoom?: number;
377
391
  barcodeScannerSettings?: BarcodeSettings;
@@ -1 +1 @@
1
- {"version":3,"file":"Camera.types.d.ts","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KA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C;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,OAAO,GACP,MAAM,GACN,IAAI,GACJ,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Camera.types.js","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AA6c3B,OAAO,EAAsB,gBAAgB,EAA+C,CAAC","sourcesContent":["import {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n} from 'expo-modules-core';\nimport { Ref } from 'react';\nimport type { ViewProps } from 'react-native';\n\nexport type CameraType = 'front' | 'back';\n\nexport type FlashMode = 'off' | 'on' | 'auto';\n\nexport type ImageType = 'png' | 'jpg';\n\nexport type CameraMode = 'picture' | 'video';\n\n/**\n * This option specifies what codec to use when recording a video.\n * @platform ios\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * This option specifies the stabilization mode to use when recording a video.\n * @platform ios\n */\nexport type VideoStabilization = 'off' | 'standard' | 'cinematic' | 'auto';\n\n// @docsMissing\nexport type VideoQuality = '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\nexport type CameraOrientation =\n | 'portrait'\n | 'portraitUpsideDown'\n | 'landscapeLeft'\n | 'landscapeRight';\n\n// @docsMissing\n/**\n * @hidden We do not expose related web methods in docs.\n * @platform web\n */\nexport type ImageSize = {\n width: number;\n height: number;\n};\n\n// @docsMissing\n/**\n * @hidden We do not expose related web methods in docs.\n * @platform web\n */\nexport type WebCameraSettings = {\n autoFocus?: string;\n flashMode?: string;\n whiteBalance?: string;\n exposureCompensation?: number;\n colorTemperature?: number;\n iso?: number;\n brightness?: number;\n contrast?: number;\n saturation?: number;\n sharpness?: number;\n focusDistance?: number;\n zoom?: number;\n};\n\n// @needsAudit\nexport type CameraCapturedPicture = {\n /**\n * Captured image width.\n */\n width: number;\n /**\n * Captured image height.\n */\n height: number;\n /**\n * On web, the value of `uri` is the same as `base64` because file system URLs are not supported in the browser.\n */\n uri: string;\n /**\n * A Base64 representation of the image.\n */\n base64?: string;\n /**\n * On Android and iOS this object may include various fields based on the device and operating system.\n * On web, it is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings) dictionary.\n */\n exif?: Partial<MediaTrackSettings> | any;\n};\n\n// @needsAudit\nexport type CameraPictureOptions = {\n /**\n * Specify the compression quality from `0` to `1`. `0` means compress for small size, and `1` means compress for maximum quality.\n */\n quality?: number;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Whether to also include the EXIF data for the image.\n */\n exif?: boolean;\n /**\n * Additional EXIF data to be included for the image. Only useful when `exif` option is set to `true`.\n * @platform android\n * @platform ios\n */\n additionalExif?: Record<string, any>;\n /**\n * A callback invoked when picture is saved. If set, the promise of this method will resolve immediately with no data after picture is captured.\n * The data that it should contain will be passed to this callback. If displaying or processing a captured photo right after taking it\n * is not your case, this callback lets you skip waiting for it to be saved.\n * @param picture\n */\n onPictureSaved?: (picture: CameraCapturedPicture) => void;\n // TODO(Bacon): Is it possible to implement this in the browser?\n /**\n * If set to `true`, camera skips orientation adjustment and returns an image straight from the device's camera.\n * If enabled, `quality` option is discarded (processing pipeline is skipped as a whole).\n * Although enabling this option reduces image delivery time significantly, it may cause the image to appear in a wrong orientation\n * in the `Image` component (at the time of writing, it does not respect EXIF orientation of the images).\n * > **Note**: Enabling `skipProcessing` would cause orientation uncertainty. `Image` component does not respect EXIF\n * > stored orientation information, that means obtained image would be displayed wrongly (rotated by 90°, 180° or 270°).\n * > Different devices provide different orientations. For example some Sony Xperia or Samsung devices don't provide\n * > correctly oriented images by default. To always obtain correctly oriented image disable `skipProcessing` option.\n */\n skipProcessing?: boolean;\n /**\n * @platform web\n */\n scale?: number;\n /**\n * @platform web\n */\n imageType?: ImageType;\n /**\n * @platform web\n */\n isImageMirror?: boolean;\n /**\n * @hidden\n */\n id?: number;\n /**\n * @hidden\n */\n fastMode?: boolean;\n /**\n * @hidden\n */\n maxDownsampling?: number;\n};\n\n// @needsAudit\nexport type CameraRecordingOptions = {\n /**\n * Maximum video duration in seconds.\n */\n maxDuration?: number;\n /**\n * Maximum video file size in bytes.\n */\n maxFileSize?: number;\n /**\n * If `true`, the recorded video will be flipped along the vertical axis. iOS flips videos recorded with the front camera by default,\n * but you can reverse that back by setting this to `true`. On Android, this is handled in the user's device settings.\n * @platform ios\n */\n mirror?: boolean;\n /**\n * This option specifies what codec to use when recording the video. See [`VideoCodec`](#videocodec) for the possible values.\n * @platform ios\n */\n codec?: VideoCodec;\n};\n\n/**\n * @hidden\n */\nexport type PictureSavedListener = (event: {\n nativeEvent: { data: CameraCapturedPicture; id: number };\n}) => void;\n\n/**\n * @hidden\n */\nexport type CameraReadyListener = () => void;\n\n/**\n * @hidden\n */\nexport type ResponsiveOrientationChangedListener = (event: {\n nativeEvent: ResponsiveOrientationChanged;\n}) => void;\n\nexport type ResponsiveOrientationChanged = { orientation: CameraOrientation };\n\n/**\n * @hidden\n */\nexport type MountErrorListener = (event: { nativeEvent: CameraMountError }) => void;\n\n// @docsMissing\nexport type CameraMountError = { message: string };\n\n// @docsMissing\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport type BarcodeSize = {\n /**\n * The height value.\n */\n height: number;\n /**\n * The width value.\n */\n width: number;\n};\n\n/**\n * These coordinates are represented in the coordinate space of the camera source (e.g. when you\n * are using the camera view, these values are adjusted to the dimensions of the view).\n */\nexport type BarcodePoint = Point;\n\nexport type BarcodeBounds = {\n /**\n * The origin point of the bounding box.\n */\n origin: BarcodePoint;\n /**\n * The size of the bounding box.\n */\n size: BarcodeSize;\n};\n\n// @needsAudit\nexport type BarcodeScanningResult = {\n /**\n * The barcode type.\n */\n type: string;\n /**\n * The parsed information encoded in the barcode.\n */\n data: string;\n /**\n * The raw information encoded in the barcode.\n * May be different from `data` depending on the barcode type.\n * @platform android\n * @hidden\n */\n raw?: string;\n /**\n * Corner points of the bounding box.\n * `cornerPoints` is not always available and may be empty. On iOS, for `code39` and `pdf417`\n * you don't get this value.\n */\n cornerPoints: BarcodePoint[];\n /**\n * The [BarcodeBounds](#barcodebounds) object.\n * `bounds` in some case will be representing an empty rectangle.\n * Moreover, `bounds` doesn't have to bound the whole barcode.\n * For some types, they will represent the area used by the scanner.\n */\n bounds: BarcodeBounds;\n};\n\nexport type ScanningResult = Omit<BarcodeScanningResult, 'bounds'>;\n\n// @needsAudit\nexport type CameraProps = ViewProps & {\n /**\n * Camera facing. Use one of `CameraType`. When `front`, use the front-facing camera.\n * When `back`, use the back-facing camera.\n * @default 'back'\n */\n facing?: CameraType;\n /**\n * Camera flash mode. Use one of `FlashMode` values. When `on`, the flash on your device will\n * turn on when taking a picture. When `off`, it won't. Setting it to `auto` will fire flash if required.\n * @default 'off'\n */\n flash?: FlashMode;\n /**\n * A value between `0` and `1` being a percentage of device's max zoom. `0` - not zoomed, `1` - maximum zoom.\n * @default 0\n */\n zoom?: number;\n /**\n * Used to select image or video output\n * @default 'picture'\n */\n mode?: CameraMode;\n /**\n * If present, video will be recorded with no sound.\n * @default false\n */\n mute?: boolean;\n /**\n * Specify the quality of the recorded video. Use one of `VideoQuality` possible values:\n * for 16:9 resolution `2160p`, `1080p`, `720p`, `480p` : `Android only` and for 4:3 `4:3` (the size is 640x480).\n * If the chosen quality is not available for a device, the highest available is chosen.\n */\n videoQuality?: VideoQuality;\n /**\n * A boolean that determines whether the camera shutter animation should be enabled.\n * @default true\n */\n animateShutter?: boolean;\n /**\n * A string representing the size of pictures [`takePictureAsync`](#takepictureasync) will take.\n * Available sizes can be fetched with [`getAvailablePictureSizes`](#getavailablepicturesizes).\n */\n pictureSize?: string;\n /**\n * A boolean to enable or disable the torch\n * @default false\n */\n enableTorch?: boolean;\n /**\n * Callback invoked when camera preview has been set.\n */\n onCameraReady?: () => void;\n /**\n * The video stabilization mode used for a video recording. Use one of [`VideoStabilization.<value>`](#videostabilization).\n * You can read more about each stabilization type in [Apple Documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode).\n * @platform ios\n */\n videoStabilizationMode?: VideoStabilization;\n /**\n * Callback invoked when camera preview could not been started.\n * @param event Error object that contains a `message`.\n */\n onMountError?: (event: CameraMountError) => void;\n /**\n * @example\n * ```tsx\n * <CameraView\n * barcodeScannerSettings={{\n * barcodeTypes: [\"qr\"],\n * }}\n * />\n * ```\n */\n barcodeScannerSettings?: BarcodeSettings;\n /**\n * Callback that is invoked when a barcode has been successfully scanned. The callback is provided with\n * an object of the [`BarcodeScanningResult`](#barcodescanningresult) shape, where the `type`\n * refers to the barcode type that was scanned and the `data` is the information encoded in the barcode\n * (in this case of QR codes, this is often a URL). See [`BarcodeType`](#barcodetype) for supported values.\n * for supported values.\n * @param scanningResult\n */\n onBarcodeScanned?: (scanningResult: BarcodeScanningResult) => void;\n /**\n * A URL for an image to be shown while the camera is loading.\n * @platform web\n */\n poster?: string;\n /**\n * Whether to allow responsive orientation of the camera when the screen orientation is locked (i.e. when set to `true`\n * landscape photos will be taken if the device is turned that way, even if the app or device orientation is locked to portrait)\n * @platform ios\n */\n responsiveOrientationWhenOrientationLocked?: boolean;\n /**\n * Callback invoked when responsive orientation changes. Only applicable if `responsiveOrientationWhenOrientationLocked` is `true`\n * @param event result object that contains updated orientation of camera\n * @platform ios\n */\n onResponsiveOrientationChanged?: (event: ResponsiveOrientationChanged) => void;\n};\n\n/**\n * @hidden\n */\nexport interface CameraViewRef {\n readonly takePicture: (options: CameraPictureOptions) => Promise<CameraCapturedPicture>;\n readonly getAvailablePictureSizes: () => Promise<string[]>;\n readonly record: (options?: CameraRecordingOptions) => Promise<{ uri: string }>;\n readonly stopRecording: () => Promise<void>;\n readonly launchModernScanner: () => Promise<void>;\n}\n\n/**\n * @hidden\n */\nexport type CameraNativeProps = {\n pointerEvents?: any;\n style?: any;\n ref?: Ref<CameraViewRef>;\n onCameraReady?: CameraReadyListener;\n onMountError?: MountErrorListener;\n onBarcodeScanned?: (event: { nativeEvent: BarcodeScanningResult }) => void;\n onPictureSaved?: PictureSavedListener;\n onResponsiveOrientationChanged?: ResponsiveOrientationChangedListener;\n facing?: string;\n flashMode?: string;\n enableTorch?: boolean;\n animateShutter?: boolean;\n mute?: boolean;\n zoom?: number;\n barcodeScannerSettings?: BarcodeSettings;\n barcodeScannerEnabled?: boolean;\n poster?: string;\n responsiveOrientationWhenOrientationLocked?: boolean;\n};\n\n// @docsMissing\nexport type BarcodeSettings = {\n barcodeTypes: BarcodeType[];\n interval?: number;\n};\n\n/**\n * @platform ios\n */\nexport type ScanningOptions = {\n /**\n * The type of codes to scan for.\n */\n barcodeTypes: BarcodeType[];\n /**\n * Indicates whether people can use a two-finger pinch-to-zoom gesture.\n * @default true\n */\n isPinchToZoomEnabled?: boolean;\n /**\n * Guidance text, such as “Slow Down,” appears over the live video.\n * @default true\n */\n isGuidanceEnabled?: boolean;\n /**\n * Indicates whether the scanner displays highlights around recognized items.\n * @default false\n */\n isHighlightingEnabled?: boolean;\n};\n\n/**\n * The available barcode types that can be scanned.\n */\nexport type BarcodeType =\n | 'aztec'\n | 'ean13'\n | 'ean8'\n | 'qr'\n | 'pdf417'\n | 'upc_e'\n | 'datamatrix'\n | 'code39'\n | 'code93'\n | 'itf14'\n | 'codabar'\n | 'code128'\n | 'upc_a';\n\nexport { PermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions };\n"]}
1
+ {"version":3,"file":"Camera.types.js","sourceRoot":"","sources":["../src/Camera.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AA4d3B,OAAO,EAAsB,gBAAgB,EAA+C,CAAC","sourcesContent":["import {\n PermissionResponse,\n PermissionStatus,\n PermissionExpiration,\n PermissionHookOptions,\n} from 'expo-modules-core';\nimport { Ref } from 'react';\nimport type { ViewProps } from 'react-native';\n\nexport type CameraType = 'front' | 'back';\n\nexport type FlashMode = 'off' | 'on' | 'auto';\n\nexport type ImageType = 'png' | 'jpg';\n\nexport type CameraMode = 'picture' | 'video';\n\n/**\n * This option specifies the mode of focus on the device.\n * - `on` - Indicates that the device should autofocus once and then lock the focus.\n * - `off` - Indicates that the device should automatically focus when needed.\n * @default off\n */\nexport type FocusMode = 'on' | 'off';\n\n/**\n * This option specifies what codec to use when recording a video.\n * @platform ios\n */\nexport type VideoCodec = 'avc1' | 'hvc1' | 'jpeg' | 'apcn' | 'ap4h';\n\n/**\n * This option specifies the stabilization mode to use when recording a video.\n * @platform ios\n */\nexport type VideoStabilization = 'off' | 'standard' | 'cinematic' | 'auto';\n\n// @docsMissing\nexport type VideoQuality = '2160p' | '1080p' | '720p' | '480p' | '4:3';\n\nexport type CameraOrientation =\n | 'portrait'\n | 'portraitUpsideDown'\n | 'landscapeLeft'\n | 'landscapeRight';\n\n// @docsMissing\n/**\n * @hidden We do not expose related web methods in docs.\n * @platform web\n */\nexport type ImageSize = {\n width: number;\n height: number;\n};\n\n// @docsMissing\n/**\n * @hidden We do not expose related web methods in docs.\n * @platform web\n */\nexport type WebCameraSettings = {\n autoFocus?: string;\n flashMode?: string;\n whiteBalance?: string;\n exposureCompensation?: number;\n colorTemperature?: number;\n iso?: number;\n brightness?: number;\n contrast?: number;\n saturation?: number;\n sharpness?: number;\n focusDistance?: number;\n zoom?: number;\n};\n\n// @needsAudit\nexport type CameraCapturedPicture = {\n /**\n * Captured image width.\n */\n width: number;\n /**\n * Captured image height.\n */\n height: number;\n /**\n * On web, the value of `uri` is the same as `base64` because file system URLs are not supported in the browser.\n */\n uri: string;\n /**\n * A Base64 representation of the image.\n */\n base64?: string;\n /**\n * On Android and iOS this object may include various fields based on the device and operating system.\n * On web, it is a partial representation of the [`MediaTrackSettings`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings) dictionary.\n */\n exif?: Partial<MediaTrackSettings> | any;\n};\n\n// @needsAudit\nexport type CameraPictureOptions = {\n /**\n * Specify the compression quality from `0` to `1`. `0` means compress for small size, and `1` means compress for maximum quality.\n */\n quality?: number;\n /**\n * Whether to also include the image data in Base64 format.\n */\n base64?: boolean;\n /**\n * Whether to also include the EXIF data for the image.\n */\n exif?: boolean;\n /**\n * Additional EXIF data to be included for the image. Only useful when `exif` option is set to `true`.\n * @platform android\n * @platform ios\n */\n additionalExif?: Record<string, any>;\n /**\n * A callback invoked when picture is saved. If set, the promise of this method will resolve immediately with no data after picture is captured.\n * The data that it should contain will be passed to this callback. If displaying or processing a captured photo right after taking it\n * is not your case, this callback lets you skip waiting for it to be saved.\n * @param picture\n */\n onPictureSaved?: (picture: CameraCapturedPicture) => void;\n // TODO(Bacon): Is it possible to implement this in the browser?\n /**\n * If set to `true`, camera skips orientation adjustment and returns an image straight from the device's camera.\n * If enabled, `quality` option is discarded (processing pipeline is skipped as a whole).\n * Although enabling this option reduces image delivery time significantly, it may cause the image to appear in a wrong orientation\n * in the `Image` component (at the time of writing, it does not respect EXIF orientation of the images).\n * > **Note**: Enabling `skipProcessing` would cause orientation uncertainty. `Image` component does not respect EXIF\n * > stored orientation information, that means obtained image would be displayed wrongly (rotated by 90°, 180° or 270°).\n * > Different devices provide different orientations. For example some Sony Xperia or Samsung devices don't provide\n * > correctly oriented images by default. To always obtain correctly oriented image disable `skipProcessing` option.\n */\n skipProcessing?: boolean;\n /**\n * @platform web\n */\n scale?: number;\n /**\n * @platform web\n */\n imageType?: ImageType;\n /**\n * @platform web\n */\n isImageMirror?: boolean;\n /**\n * @hidden\n */\n id?: number;\n /**\n * @hidden\n */\n fastMode?: boolean;\n /**\n * @hidden\n */\n maxDownsampling?: number;\n};\n\n// @needsAudit\nexport type CameraRecordingOptions = {\n /**\n * Maximum video duration in seconds.\n */\n maxDuration?: number;\n /**\n * Maximum video file size in bytes.\n */\n maxFileSize?: number;\n /**\n * If `true`, the recorded video will be flipped along the vertical axis. iOS flips videos recorded with the front camera by default,\n * but you can reverse that back by setting this to `true`. On Android, this is handled in the user's device settings.\n * @platform ios\n */\n mirror?: boolean;\n /**\n * This option specifies what codec to use when recording the video. See [`VideoCodec`](#videocodec) for the possible values.\n * @platform ios\n */\n codec?: VideoCodec;\n};\n\n/**\n * @hidden\n */\nexport type PictureSavedListener = (event: {\n nativeEvent: { data: CameraCapturedPicture; id: number };\n}) => void;\n\n/**\n * @hidden\n */\nexport type CameraReadyListener = () => void;\n\n/**\n * @hidden\n */\nexport type ResponsiveOrientationChangedListener = (event: {\n nativeEvent: ResponsiveOrientationChanged;\n}) => void;\n\nexport type ResponsiveOrientationChanged = { orientation: CameraOrientation };\n\n/**\n * @hidden\n */\nexport type MountErrorListener = (event: { nativeEvent: CameraMountError }) => void;\n\n// @docsMissing\nexport type CameraMountError = { message: string };\n\n// @docsMissing\nexport type Point = {\n x: number;\n y: number;\n};\n\nexport type BarcodeSize = {\n /**\n * The height value.\n */\n height: number;\n /**\n * The width value.\n */\n width: number;\n};\n\n/**\n * These coordinates are represented in the coordinate space of the camera source (e.g. when you\n * are using the camera view, these values are adjusted to the dimensions of the view).\n */\nexport type BarcodePoint = Point;\n\nexport type BarcodeBounds = {\n /**\n * The origin point of the bounding box.\n */\n origin: BarcodePoint;\n /**\n * The size of the bounding box.\n */\n size: BarcodeSize;\n};\n\n// @needsAudit\nexport type BarcodeScanningResult = {\n /**\n * The barcode type.\n */\n type: string;\n /**\n * The parsed information encoded in the barcode.\n */\n data: string;\n /**\n * The raw information encoded in the barcode.\n * May be different from `data` depending on the barcode type.\n * @platform android\n * @hidden\n */\n raw?: string;\n /**\n * Corner points of the bounding box.\n * `cornerPoints` is not always available and may be empty. On iOS, for `code39` and `pdf417`\n * you don't get this value.\n */\n cornerPoints: BarcodePoint[];\n /**\n * The [BarcodeBounds](#barcodebounds) object.\n * `bounds` in some case will be representing an empty rectangle.\n * Moreover, `bounds` doesn't have to bound the whole barcode.\n * For some types, they will represent the area used by the scanner.\n */\n bounds: BarcodeBounds;\n};\n\nexport type ScanningResult = Omit<BarcodeScanningResult, 'bounds'>;\n\n// @needsAudit\nexport type CameraProps = ViewProps & {\n /**\n * Camera facing. Use one of `CameraType`. When `front`, use the front-facing camera.\n * When `back`, use the back-facing camera.\n * @default 'back'\n */\n facing?: CameraType;\n /**\n * Camera flash mode. Use one of `FlashMode` values. When `on`, the flash on your device will\n * turn on when taking a picture. When `off`, it won't. Setting it to `auto` will fire flash if required.\n * @default 'off'\n */\n flash?: FlashMode;\n /**\n * A value between `0` and `1` being a percentage of device's max zoom. `0` - not zoomed, `1` - maximum zoom.\n * @default 0\n */\n zoom?: number;\n /**\n * Used to select image or video output\n * @default 'picture'\n */\n mode?: CameraMode;\n /**\n * If present, video will be recorded with no sound.\n * @default false\n */\n mute?: boolean;\n /**\n * Indicates the focus mode to use.\n * @default off\n * @platform ios\n */\n autofocus?: FocusMode;\n /**\n * Specify the quality of the recorded video. Use one of `VideoQuality` possible values:\n * for 16:9 resolution `2160p`, `1080p`, `720p`, `480p` : `Android only` and for 4:3 `4:3` (the size is 640x480).\n * If the chosen quality is not available for a device, the highest available is chosen.\n */\n videoQuality?: VideoQuality;\n /**\n * A boolean that determines whether the camera shutter animation should be enabled.\n * @default true\n */\n animateShutter?: boolean;\n /**\n * A string representing the size of pictures [`takePictureAsync`](#takepictureasync) will take.\n * Available sizes can be fetched with [`getAvailablePictureSizes`](#getavailablepicturesizes).\n */\n pictureSize?: string;\n /**\n * A boolean to enable or disable the torch\n * @default false\n */\n enableTorch?: boolean;\n /**\n * Callback invoked when camera preview has been set.\n */\n onCameraReady?: () => void;\n /**\n * The video stabilization mode used for a video recording. Use one of [`VideoStabilization.<value>`](#videostabilization).\n * You can read more about each stabilization type in [Apple Documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode).\n * @platform ios\n */\n videoStabilizationMode?: VideoStabilization;\n /**\n * Callback invoked when camera preview could not been started.\n * @param event Error object that contains a `message`.\n */\n onMountError?: (event: CameraMountError) => void;\n /**\n * @example\n * ```tsx\n * <CameraView\n * barcodeScannerSettings={{\n * barcodeTypes: [\"qr\"],\n * }}\n * />\n * ```\n */\n barcodeScannerSettings?: BarcodeSettings;\n /**\n * Callback that is invoked when a barcode has been successfully scanned. The callback is provided with\n * an object of the [`BarcodeScanningResult`](#barcodescanningresult) shape, where the `type`\n * refers to the barcode type that was scanned and the `data` is the information encoded in the barcode\n * (in this case of QR codes, this is often a URL). See [`BarcodeType`](#barcodetype) for supported values.\n * for supported values.\n * @param scanningResult\n */\n onBarcodeScanned?: (scanningResult: BarcodeScanningResult) => void;\n /**\n * A URL for an image to be shown while the camera is loading.\n * @platform web\n */\n poster?: string;\n /**\n * Whether to allow responsive orientation of the camera when the screen orientation is locked (i.e. when set to `true`\n * landscape photos will be taken if the device is turned that way, even if the app or device orientation is locked to portrait)\n * @platform ios\n */\n responsiveOrientationWhenOrientationLocked?: boolean;\n /**\n * Callback invoked when responsive orientation changes. Only applicable if `responsiveOrientationWhenOrientationLocked` is `true`\n * @param event result object that contains updated orientation of camera\n * @platform ios\n */\n onResponsiveOrientationChanged?: (event: ResponsiveOrientationChanged) => void;\n};\n\n/**\n * @hidden\n */\nexport interface CameraViewRef {\n readonly takePicture: (options: CameraPictureOptions) => Promise<CameraCapturedPicture>;\n readonly getAvailablePictureSizes: () => Promise<string[]>;\n readonly record: (options?: CameraRecordingOptions) => Promise<{ uri: string }>;\n readonly stopRecording: () => Promise<void>;\n readonly launchModernScanner: () => Promise<void>;\n}\n\n/**\n * @hidden\n */\nexport type CameraNativeProps = {\n pointerEvents?: any;\n style?: any;\n ref?: Ref<CameraViewRef>;\n onCameraReady?: CameraReadyListener;\n onMountError?: MountErrorListener;\n onBarcodeScanned?: (event: { nativeEvent: BarcodeScanningResult }) => void;\n onPictureSaved?: PictureSavedListener;\n onResponsiveOrientationChanged?: ResponsiveOrientationChangedListener;\n facing?: string;\n flashMode?: string;\n enableTorch?: boolean;\n animateShutter?: boolean;\n autoFocus?: FocusMode;\n mute?: boolean;\n zoom?: number;\n barcodeScannerSettings?: BarcodeSettings;\n barcodeScannerEnabled?: boolean;\n poster?: string;\n responsiveOrientationWhenOrientationLocked?: boolean;\n};\n\n// @docsMissing\nexport type BarcodeSettings = {\n barcodeTypes: BarcodeType[];\n interval?: number;\n};\n\n/**\n * @platform ios\n */\nexport type ScanningOptions = {\n /**\n * The type of codes to scan for.\n */\n barcodeTypes: BarcodeType[];\n /**\n * Indicates whether people can use a two-finger pinch-to-zoom gesture.\n * @default true\n */\n isPinchToZoomEnabled?: boolean;\n /**\n * Guidance text, such as “Slow Down,” appears over the live video.\n * @default true\n */\n isGuidanceEnabled?: boolean;\n /**\n * Indicates whether the scanner displays highlights around recognized items.\n * @default false\n */\n isHighlightingEnabled?: boolean;\n};\n\n/**\n * The available barcode types that can be scanned.\n */\nexport type BarcodeType =\n | 'aztec'\n | 'ean13'\n | 'ean8'\n | 'qr'\n | 'pdf417'\n | 'upc_e'\n | 'datamatrix'\n | 'code39'\n | 'code93'\n | 'itf14'\n | 'codabar'\n | 'code128'\n | 'upc_a';\n\nexport { PermissionResponse, PermissionStatus, PermissionExpiration, PermissionHookOptions };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAIxF,eAAO,MAAM,gBAAgB,EAAE;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,KAAK,EAAE,MAAM,CAAC,MAAM,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;CAIhE,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAgBzE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAYxE"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAIxF,eAAO,MAAM,gBAAgB,EAAE;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5D,KAAK,EAAE,MAAM,CAAC,MAAM,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;CAIhE,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAgBzE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAaxE"}
@@ -25,6 +25,7 @@ export function ensureNativeProps(props) {
25
25
  newProps.barcodeScannerEnabled = !!newProps.onBarcodeScanned;
26
26
  newProps.flashMode = props?.flash ?? 'off';
27
27
  newProps.mute = props?.mute ?? false;
28
+ newProps.autoFocus = props?.autofocus ?? 'off';
28
29
  if (Platform.OS !== 'web') {
29
30
  delete newProps.po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CAAC,MAAM,CAAC;KACxB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n\nimport { CameraNativeProps, CameraType, FlashMode, CameraProps } from '../Camera.types';\nimport CameraManager from '../ExpoCameraManager';\n\n// Values under keys from this object will be transformed to native options\nexport const ConversionTables: {\n type: Record<keyof CameraType, CameraNativeProps['facing']>;\n flash: Record<keyof FlashMode, CameraNativeProps['flashMode']>;\n} = {\n type: CameraManager.Type,\n flash: CameraManager.FlashMode,\n};\n\nexport function convertNativeProps(props?: CameraProps): CameraNativeProps {\n if (!props || typeof props !== 'object') {\n return {};\n }\n\n const nativeProps: CameraNativeProps = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (typeof value === 'string' && ConversionTables[key]) {\n nativeProps[key] = ConversionTables[key][value];\n } else {\n nativeProps[key] = value;\n }\n }\n\n return nativeProps;\n}\n\nexport function ensureNativeProps(props?: CameraProps): CameraNativeProps {\n const newProps = convertNativeProps(props);\n\n newProps.barcodeScannerEnabled = !!newProps.onBarcodeScanned;\n newProps.flashMode = props?.flash ?? 'off';\n newProps.mute = props?.mute ?? false;\n\n if (Platform.OS !== 'web') {\n delete newProps.poster;\n }\n\n return newProps;\n}\n"]}
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/utils/props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAGzB;IACF,IAAI,EAAE,aAAa,CAAC,IAAI;IACxB,KAAK,EAAE,aAAa,CAAC,SAAS;CAC/B,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,KAAmB;IACpD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,WAAW,GAAsB,EAAE,CAAC;IAE1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE;YACtD,WAAW,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;SACjD;aAAM;YACL,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SAC1B;KACF;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAmB;IACnD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE3C,QAAQ,CAAC,qBAAqB,GAAG,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC7D,QAAQ,CAAC,SAAS,GAAG,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC;IAC3C,QAAQ,CAAC,IAAI,GAAG,KAAK,EAAE,IAAI,IAAI,KAAK,CAAC;IACrC,QAAQ,CAAC,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,KAAK,CAAC;IAE/C,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,OAAO,QAAQ,CAAC,MAAM,CAAC;KACxB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n\nimport { CameraNativeProps, CameraType, FlashMode, CameraProps } from '../Camera.types';\nimport CameraManager from '../ExpoCameraManager';\n\n// Values under keys from this object will be transformed to native options\nexport const ConversionTables: {\n type: Record<keyof CameraType, CameraNativeProps['facing']>;\n flash: Record<keyof FlashMode, CameraNativeProps['flashMode']>;\n} = {\n type: CameraManager.Type,\n flash: CameraManager.FlashMode,\n};\n\nexport function convertNativeProps(props?: CameraProps): CameraNativeProps {\n if (!props || typeof props !== 'object') {\n return {};\n }\n\n const nativeProps: CameraNativeProps = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (typeof value === 'string' && ConversionTables[key]) {\n nativeProps[key] = ConversionTables[key][value];\n } else {\n nativeProps[key] = value;\n }\n }\n\n return nativeProps;\n}\n\nexport function ensureNativeProps(props?: CameraProps): CameraNativeProps {\n const newProps = convertNativeProps(props);\n\n newProps.barcodeScannerEnabled = !!newProps.onBarcodeScanned;\n newProps.flashMode = props?.flash ?? 'off';\n newProps.mute = props?.mute ?? false;\n newProps.autoFocus = props?.autofocus ?? 'off';\n\n if (Platform.OS !== 'web') {\n delete newProps.poster;\n }\n\n return newProps;\n}\n"]}
@@ -132,6 +132,10 @@ public final class CameraViewModule: Module, ScannerResultHandler {
132
132
  }
133
133
  }
134
134
 
135
+ Prop("autoFocus") { (view, focusMode: FocusMode?) in
136
+ view.autoFocus = focusMode?.toAVCaptureFocusMode() ?? .continuousAutoFocus
137
+ }
138
+
135
139
  Prop("responsiveOrientationWhenOrientationLocked") { (view, responsiveOrientation: Bool?) in
136
140
  if let responsiveOrientation, view.responsiveWhenOrientationLocked != responsiveOrientation {
137
141
  view.responsiveWhenOrientationLocked = responsiveOrientation
@@ -36,3 +36,19 @@ enum CameraMode: String, Enumerable {
36
36
  case picture
37
37
  case video
38
38
  }
39
+
40
+ enum FocusMode: String, Enumerable {
41
+ case on
42
+ case off
43
+
44
+ func toAVCaptureFocusMode() -> AVCaptureDevice.FocusMode {
45
+ switch self {
46
+ case .on:
47
+ return .autoFocus
48
+ case .off:
49
+ return .continuousAutoFocus
50
+ default:
51
+ return .continuousAutoFocus
52
+ }
53
+ }
54
+ }
@@ -68,6 +68,12 @@ public class CameraView: ExpoView, EXCameraInterface, EXAppLifecycleListener,
68
68
  }
69
69
  }
70
70
 
71
+ var autoFocus = AVCaptureDevice.FocusMode.continuousAutoFocus {
72
+ didSet {
73
+ setFocusMode()
74
+ }
75
+ }
76
+
71
77
  var pictureSize = PictureSize.high {
72
78
  didSet {
73
79
  updatePictureSize()
@@ -190,10 +196,27 @@ public class CameraView: ExpoView, EXCameraInterface, EXAppLifecycleListener,
190
196
  if device.hasTorch && device.isTorchModeSupported(.on) {
191
197
  device.torchMode = torchEnabled ? .on : .off
192
198
  }
199
+ } catch {
200
+ log.info("\(#function): \(error.localizedDescription)")
201
+ }
202
+ device.unlockForConfiguration()
203
+ }
204
+
205
+ private func setFocusMode() {
206
+ guard let device = captureDeviceInput?.device else {
207
+ return
208
+ }
209
+
210
+ do {
211
+ try device.lockForConfiguration()
212
+ if device.isFocusModeSupported(autoFocus), device.focusMode != autoFocus {
213
+ device.focusMode = autoFocus
214
+ }
193
215
  } catch {
194
216
  log.info("\(#function): \(error.localizedDescription)")
195
217
  return
196
218
  }
219
+ device.unlockForConfiguration()
197
220
  }
198
221
 
199
222
  private func setCameraMode() {
@@ -53,7 +53,7 @@ enum AutoFocus: Int, Enumerable {
53
53
  case .on:
54
54
  return .autoFocus
55
55
  case .off:
56
- return .locked
56
+ return .continuousAutoFocus
57
57
  default:
58
58
  return .autoFocus
59
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-camera",
3
- "version": "15.0.3",
3
+ "version": "15.0.4",
4
4
  "description": "A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to the app's cache. Morever, the component is also capable of detecting faces and bar codes appearing on the preview.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "peerDependencies": {
43
43
  "expo": "*"
44
44
  },
45
- "gitHead": "4a7cf0d0baf6dfc595d93f604945d2142e705a36"
45
+ "gitHead": "1b95b402af6ec95f885aaf93eedfbfe521c548d9"
46
46
  }
@@ -15,6 +15,14 @@ export type ImageType = 'png' | 'jpg';
15
15
 
16
16
  export type CameraMode = 'picture' | 'video';
17
17
 
18
+ /**
19
+ * This option specifies the mode of focus on the device.
20
+ * - `on` - Indicates that the device should autofocus once and then lock the focus.
21
+ * - `off` - Indicates that the device should automatically focus when needed.
22
+ * @default off
23
+ */
24
+ export type FocusMode = 'on' | 'off';
25
+
18
26
  /**
19
27
  * This option specifies what codec to use when recording a video.
20
28
  * @platform ios
@@ -305,6 +313,12 @@ export type CameraProps = ViewProps & {
305
313
  * @default false
306
314
  */
307
315
  mute?: boolean;
316
+ /**
317
+ * Indicates the focus mode to use.
318
+ * @default off
319
+ * @platform ios
320
+ */
321
+ autofocus?: FocusMode;
308
322
  /**
309
323
  * Specify the quality of the recorded video. Use one of `VideoQuality` possible values:
310
324
  * for 16:9 resolution `2160p`, `1080p`, `720p`, `480p` : `Android only` and for 4:3 `4:3` (the size is 640x480).
@@ -407,6 +421,7 @@ export type CameraNativeProps = {
407
421
  flashMode?: string;
408
422
  enableTorch?: boolean;
409
423
  animateShutter?: boolean;
424
+ autoFocus?: FocusMode;
410
425
  mute?: boolean;
411
426
  zoom?: number;
412
427
  barcodeScannerSettings?: BarcodeSettings;
@@ -36,6 +36,7 @@ export function ensureNativeProps(props?: CameraProps): CameraNativeProps {
36
36
  newProps.barcodeScannerEnabled = !!newProps.onBarcodeScanned;
37
37
  newProps.flashMode = props?.flash ?? 'off';
38
38
  newProps.mute = props?.mute ?? false;
39
+ newProps.autoFocus = props?.autofocus ?? 'off';
39
40
 
40
41
  if (Platform.OS !== 'web') {
41
42
  delete newProps.poster;