From 95db7fb2ffe445c8ed02f733f5b02e88b88e1c77 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Mon, 8 Mar 2021 18:30:23 +0100 Subject: [PATCH] Update Camera.tsx --- src/Camera.tsx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Camera.tsx b/src/Camera.tsx index 5b6786d..c058671 100644 --- a/src/Camera.tsx +++ b/src/Camera.tsx @@ -241,6 +241,14 @@ export class Camera extends React.PureComponent { * Take a single photo and write it's content to a temporary file. * * @throws {@link CameraCaptureError} When any kind of error occured. Use the {@link CameraCaptureError.code} property to get the actual error + * @example + * ```js + * const photo = await camera.current.takePhoto({ + * qualityPrioritization: 'quality', + * flash: 'on', + * enableAutoRedEyeReduction: true + * }) + * ``` */ public async takePhoto(options?: TakePhotoOptions): Promise { try { @@ -256,6 +264,13 @@ export class Camera extends React.PureComponent { * This can be used as an alternative to {@link Camera.takePhoto} if speed is more important than quality * * @platform Android + * @example + * ```js + * const photo = await camera.current.takeSnapshot({ + * quality: 85, + * skipMetadata: true + * }) + * ``` */ public async takeSnapshot(options?: TakeSnapshotOptions): Promise { if (Platform.OS !== 'android') @@ -337,6 +352,13 @@ export class Camera extends React.PureComponent { * Make sure the value doesn't exceed the CameraView's dimensions. * * @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error + * @example + * ```js + * await camera.current.focus({ + * x: tapEvent.x, + * y: tapEvent.y + * }) + * ``` */ public async focus(point: Point): Promise { try { @@ -383,6 +405,16 @@ export class Camera extends React.PureComponent { * Get a list of all available camera devices on the current phone. * * @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error + * @example + * ```js + * const devices = await Camera.getAvailableCameraDevices() + * const filtered = devices.filter((d) => matchesMyExpectations(d)) + * const sorted = devices.sort(sortDevicesByAmountOfCameras) + * return { + * back: sorted.find((d) => d.position === "back"), + * front: sorted.find((d) => d.position === "front") + * } + * ``` */ public static async getAvailableCameraDevices(): Promise { try {