Skip to content

Commit e8a4e9f

Browse files
committed
Update code example languages
1 parent cd55596 commit e8a4e9f

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

src/Camera.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export interface CameraDeviceProps {
7878
* See the [Camera Devices](https://cuvent.github.io/react-native-vision-camera/docs/devices) section in the documentation for more information about Camera Devices.
7979
*
8080
* @example
81-
* ```js
81+
* ```tsx
8282
* const devices = useCameraDevices('wide-angle-camera')
8383
* const device = devices.back
8484
*
@@ -89,7 +89,6 @@ export interface CameraDeviceProps {
8989
* style={StyleSheet.absoluteFill}
9090
* />
9191
* )
92-
*
9392
* ```
9493
*/
9594
device: CameraDevice;
@@ -208,7 +207,7 @@ type RefType = React.Component<CameraProps> & Readonly<NativeMethods>;
208207
* * {@linkcode CameraDynamicProps.isActive | isActive}: A boolean value that specifies whether the Camera should actively stream video frames or not. This can be compared to a Video component, where `isActive` specifies whether the video is paused or not. If you fully unmount the `<Camera>` component instead of using `isActive={false}`, the Camera will take a bit longer to start again.
209208
*
210209
* @example
211-
* ```jsx
210+
* ```tsx
212211
* function App() {
213212
* const devices = useCameraDevices('wide-angle-camera')
214213
* const device = devices.back
@@ -263,7 +262,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
263262
*
264263
* @throws {@linkcode CameraCaptureError} When any kind of error occured while capturing the photo. Use the {@linkcode CameraCaptureError.code | code} property to get the actual error
265264
* @example
266-
* ```js
265+
* ```ts
267266
* const photo = await camera.current.takePhoto({
268267
* qualityPrioritization: 'quality',
269268
* flash: 'on',
@@ -288,7 +287,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
288287
*
289288
* @platform Android
290289
* @example
291-
* ```js
290+
* ```ts
292291
* const photo = await camera.current.takeSnapshot({
293292
* quality: 85,
294293
* skipMetadata: true
@@ -318,7 +317,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
318317
* @throws {@linkcode CameraCaptureError} When any kind of error occured while starting the video recording. Use the {@linkcode CameraCaptureError.code | code} property to get the actual error
319318
*
320319
* @example
321-
* ```js
320+
* ```ts
322321
* camera.current.startRecording({
323322
* onRecordingFinished: (video) => console.log(video),
324323
* onRecordingError: (error) => console.error(error),
@@ -350,7 +349,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
350349
* @throws {@linkcode CameraCaptureError} When any kind of error occured while stopping the video recording. Use the {@linkcode CameraCaptureError.code | code} property to get the actual error
351350
*
352351
* @example
353-
* ```js
352+
* ```ts
354353
* await camera.current.startRecording()
355354
* setTimeout(async () => {
356355
* const video = await camera.current.stopRecording()
@@ -376,7 +375,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
376375
*
377376
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while focussing. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
378377
* @example
379-
* ```js
378+
* ```ts
380379
* await camera.current.focus({
381380
* x: tapEvent.x,
382381
* y: tapEvent.y
@@ -431,7 +430,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
431430
*
432431
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while getting all available camera devices. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
433432
* @example
434-
* ```js
433+
* ```ts
435434
* const devices = await Camera.getAvailableCameraDevices()
436435
* const filtered = devices.filter((d) => matchesMyExpectations(d))
437436
* const sorted = devices.sort(sortDevicesByAmountOfCameras)

src/PhotoFile.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ export interface PhotoFile extends TemporaryFile {
7373
height: number;
7474
isRawPhoto: boolean;
7575
thumbnail?: Record<string, unknown>;
76+
/**
77+
* Metadata information describing the captured image.
78+
*
79+
* @see [AVCapturePhoto.metadata](https://developer.apple.com/documentation/avfoundation/avcapturephoto/2873982-metadata)
80+
* @see [AndroidX ExifInterface](https://developer.android.com/reference/androidx/exifinterface/media/ExifInterface)
81+
*/
7682
metadata: {
7783
Orientation: number;
7884
/**

src/hooks/useCameraDevices.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const DefaultCameraDevices: CameraDevices = {
2020
* @returns The best matching {@linkcode CameraDevice}.
2121
* @throws {@linkcode CameraRuntimeError} if no device was found.
2222
* @example
23-
* ```jsx
23+
* ```tsx
2424
* const device = useCameraDevice()
2525
* // ...
2626
* return <Camera device={device} />
@@ -35,7 +35,7 @@ export function useCameraDevices(): CameraDevices;
3535
* @returns A {@linkcode CameraDevice} for the requested device type.
3636
* @throws {@linkcode CameraRuntimeError} if no device was found.
3737
* @example
38-
* ```jsx
38+
* ```tsx
3939
* const device = useCameraDevice('wide-angle-camera')
4040
* // ...
4141
* return <Camera device={device} />

src/utils/FormatFilter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { CameraDevice, CameraDeviceFormat, FrameRateRange } from 'react-nat
99
* > Note that this makes the `sort()` function descending, so the first element (`[0]`) is the "best" device.
1010
*
1111
* @example
12-
* ```js
12+
* ```ts
1313
* const devices = camera.devices.sort(sortDevices)
1414
* const bestDevice = devices[0]
1515
* ```
@@ -84,7 +84,7 @@ const getFormatAspectRatioOverflow = (format: CameraDeviceFormat, size: Size): n
8484
* @returns A list of Camera Device Formats that match the given `viewSize`' aspect ratio _as close as possible_.
8585
*
8686
* @example
87-
* ```js
87+
* ```ts
8888
* const formats = useMemo(() => filterFormatsByAspectRatio(device.formats, CAMERA_VIEW_SIZE), [device.formats])
8989
* ```
9090
* @method
@@ -103,7 +103,7 @@ export const filterFormatsByAspectRatio = (formats: CameraDeviceFormat[], viewSi
103103
* Sorts Camera Device Formats by highest photo-capture resolution, descending. Use this in a `.sort` function.
104104
*
105105
* @example
106-
* ```js
106+
* ```ts
107107
* const formats = useMemo(() => device.formats.sort(sortFormatsByResolution), [device.formats])
108108
* const bestFormat = formats[0]
109109
* ```
@@ -128,7 +128,7 @@ export const sortFormatsByResolution = (left: CameraDeviceFormat, right: CameraD
128128
* @param {FrameRateRange} range The range to check if the given `fps` are included in
129129
* @param {number} fps The FPS to check if the given `range` supports.
130130
* @example
131-
* ```js
131+
* ```ts
132132
* // get all formats that support 60 FPS
133133
* const formatsWithHighFps = useMemo(() => device.formats.filter((f) => f.frameRateRanges.some((r) => frameRateIncluded(r, 60))), [device.formats])
134134
* ```

0 commit comments

Comments
 (0)