React Native · Components
CameraView
Camera preview.
11 exports
Import
CameraView
componentCamera preview. Capturing is done via ref. Camera permission must be granted beforehand (usePermission("camera")); without it onError is called with E_PERMISSION, and the preview opens automatically once permission is granted.
Camera
moduleAbout the device camera.
| Name | Type | Description |
|---|---|---|
isAvailable | () => boolean | Does the device have a camera. |
devices | () => CameraFacing[] | Available facings (["back", "front"]). |
CameraFacing
typeCamera facing.
CameraFlash
typeFlash (when taking a photo).
CameraPhoto
interfaceA captured photo.
| Name | Type | Description |
|---|---|---|
uri | string | Temporary file (file://…); move it to your own folder to keep it. |
width | number | Width with rotation applied (pixels). |
height | number | Height with rotation applied (pixels). |
CameraVideo
interfaceA recorded video.
| Name | Type | Description |
|---|---|---|
uri | string | Temporary file (file://…; Android .mp4, iOS .mov). |
duration | number | Duration (seconds). |
TakePhotoOptions
interfaceOptions for CameraHandle.takePhoto.
| Name | Type | Default | Description |
|---|---|---|---|
quality? | number | 0.9 | JPEG quality (0–1). Applied on Android; iOS uses the system quality. |
RecordOptions
interfaceOptions for CameraHandle.startRecording.
| Name | Type | Default | Description |
|---|---|---|---|
audio? | boolean | true | Record audio. If microphone permission (ui.config permissions.microphone) is not granted, the video is recorded silent. |
maxDuration? | number | Maximum duration (seconds); recording stops automatically when reached. |
CameraError
interfaceCamera error (onError).
| Name | Type | Description |
|---|---|---|
code | string | E_PERMISSION, E_NO_CAMERA, E_CAMERA… |
message | string | Error message. |
CameraHandle
interfaceHandle of CameraView (ref).
| Name | Type | Description |
|---|---|---|
takePhoto | (options?: TakePhotoOptions): Promise<CameraPhoto> | Takes a photo. |
startRecording | (options?: RecordOptions): Promise<CameraVideo> | Starts video recording; the returned promise resolves when recording ends (stopRecording or duration). |
stopRecording | (): Promise<void> | Stops recording. |
CameraViewProps
interfaceProps of CameraView.
| Name | Type | Default | Description |
|---|---|---|---|
facing? | CameraFacing | "back" | Front or back camera. |
flash? | CameraFlash | "off" | Photo flash. |
torch? | boolean | false | Torch (continuous light). |
zoom? | number | 0 | Zoom: 0 (none) – 1 (the maximum the device allows, up to 10x). |
active? | boolean | true | When false, the camera turns off (the view stays). |
onReady? | () => void | Preview started; capturing is now possible. | |
onError? | (error: CameraError) => void | Error (no permission, camera could not open…). | |
onRecordingStart? | () => void | Video recording started. | |
style? | StyleProp<ViewStyle> | Style; give it a size (the preview fills the area, edges are cropped). | |
testID? | string | Test ID. | |
ref? | Ref<CameraHandle> | Handle. |