Use @linkcode for typedocs

This commit is contained in:
Marc Rousavy
2021-03-08 18:51:53 +01:00
parent b93bb2a68b
commit bfba6a95ee
8 changed files with 73 additions and 42 deletions

View File

@@ -73,7 +73,24 @@ export type CameraScannerProps = Modify<
export interface CameraDeviceProps {
// Properties
/**
* The Camera Device to use
* The Camera Device to use.
*
* See the [Camera Devices](https://cuvent.github.io/react-native-vision-camera/docs/devices) section in the documentation for more information about Camera Devices.
*
* @example
* ```js
* const devices = useCameraDevices('wide-angle-camera')
* const device = devices.back
*
* return (
* <Camera
* device={device}
* isActive={true}
* style={StyleSheet.absoluteFill}
* />
* )
*
* ```
*/
device: CameraDevice;
/**
@@ -101,7 +118,7 @@ export interface CameraDeviceProps {
export interface CameraDynamicProps {
/**
* Whether the Camera should actively stream video frames, or not.
* Whether the Camera should actively stream video frames, or not. See the [documentation about the `isActive` prop](https://cuvent.github.io/react-native-vision-camera/docs/devices#the-isactive-prop) for more information.
*
* This can be compared to a Video component, where `isActive` specifies whether the video is paused or not.
*
@@ -125,7 +142,9 @@ export interface CameraDynamicProps {
*/
zoom?: number;
/**
* Enables or disables the native pinch to zoom gesture
* Enables or disables the native pinch to zoom gesture.
*
* If you want to implement a custom zoom gesture, see [the Zooming with Reanimated documentation](https://cuvent.github.io/react-native-vision-camera/docs/animated).
*
* @default false
*/
@@ -181,10 +200,12 @@ type RefType = React.Component<CameraProps> & Readonly<NativeMethods>;
/**
* ### A powerful `<Camera>` component.
*
* Read the [VisionCamera documentation](https://cuvent.github.io/react-native-vision-camera/) for more information.
*
* The `<Camera>` component's most important (and therefore _required_) properties are:
*
* * {@link CameraDeviceProps.device}: Specifies the {@link CameraDevice} to use. Get a {@link CameraDevice} by using the {@link useCameraDevices} hook, or manually by using the {@link Camera.getAvailableCameraDevices} function.
* * {@link CameraDynamicProps.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.
* * {@linkcode CameraDeviceProps.device | device}: Specifies the {@linkcode CameraDevice} to use. Get a {@linkcode CameraDevice} by using the {@linkcode useCameraDevices | useCameraDevices()} hook, or manually by using the {@linkcode Camera.getAvailableCameraDevices Camera.getAvailableCameraDevices()} function.
* * {@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.
*
* @example
* ```jsx
@@ -240,7 +261,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
/**
* 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
* @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
* @example
* ```js
* const photo = await camera.current.takePhoto({
@@ -261,7 +282,9 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
/**
* Take a snapshot of the current preview view.
*
* This can be used as an alternative to {@link Camera.takePhoto} if speed is more important than quality
* This can be used as an alternative to {@linkcode Camera.takePhoto | takePhoto()} if speed is more important than quality
*
* @throws {@linkcode CameraCaptureError} When any kind of error occured while taking a snapshot. Use the {@linkcode CameraCaptureError.code | code} property to get the actual error
*
* @platform Android
* @example
@@ -292,7 +315,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
*
* @blocking This function is synchronized/blocking.
*
* @throws {@link CameraCaptureError} When any kind of error occured. Use the {@link CameraCaptureError.code} property to get the actual error
* @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
*
* @example
* ```js
@@ -324,7 +347,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
/**
* Stop the current video recording.
*
* @throws {@link CameraCaptureError} When any kind of error occured. Use the {@link CameraCaptureError.code} property to get the actual error
* @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
*
* @example
* ```js
@@ -351,7 +374,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
*
* 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
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while focussing. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
* @example
* ```js
* await camera.current.focus({
@@ -372,9 +395,10 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
* Get a list of video codecs the current camera supports. Returned values are ordered by efficiency (descending).
*
* This function can only be called after the camera has been initialized,
* so only use this after the {@link onInitialized} event has fired.
* so only use this after the {@linkcode onInitialized | onInitialized()} event has fired.
*
* @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error
* @platform iOS
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while getting available video codecs. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
*/
public async getAvailableVideoCodecs(): Promise<CameraVideoCodec[]> {
try {
@@ -387,9 +411,10 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
* Get a list of photo codecs the current camera supports. Returned values are ordered by efficiency (descending).
*
* This function can only be called after the camera has been initialized,
* so only use this after the {@link onInitialized} event has fired.
* so only use this after the {@linkcode onInitialized | onInitialized()} event has fired.
*
* @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error
* @platform iOS
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while getting available photo codecs. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
*/
public async getAvailablePhotoCodecs(): Promise<CameraPhotoCodec[]> {
try {
@@ -404,7 +429,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
/**
* 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
* @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
* @example
* ```js
* const devices = await Camera.getAvailableCameraDevices()
@@ -427,9 +452,9 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
* Gets the current Camera Permission Status. Check this before mounting the Camera to ensure
* the user has permitted the app to use the camera.
*
* To actually prompt the user for camera permission, use {@link Camera.requestCameraPermission}.
* To actually prompt the user for camera permission, use {@linkcode Camera.requestCameraPermission | requestCameraPermission()}.
*
* @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while getting the current permission status. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
*/
public static async getCameraPermissionStatus(): Promise<CameraPermissionStatus> {
try {
@@ -442,9 +467,9 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
* Gets the current Microphone-Recording Permission Status. Check this before mounting the Camera to ensure
* the user has permitted the app to use the microphone.
*
* To actually prompt the user for microphone permission, use {@link Camera.requestMicrophonePermission}.
* To actually prompt the user for microphone permission, use {@linkcode Camera.requestMicrophonePermission | requestMicrophonePermission()}.
*
* @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while getting the current permission status. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
*/
public static async getMicrophonePermissionStatus(): Promise<CameraPermissionStatus> {
try {
@@ -459,7 +484,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
* If the user has previously blocked the app from using the camera, the alert will not be shown
* and `"denied"` will be returned.
*
* @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while requesting permission. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
*/
public static async requestCameraPermission(): Promise<CameraPermissionRequestResult> {
try {
@@ -474,7 +499,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
* If the user has previously blocked the app from using the microphone, the alert will not be shown
* and `"denied"` will be returned.
*
* @throws {@link CameraRuntimeError} When any kind of error occured. Use the {@link CameraRuntimeError.code} property to get the actual error
* @throws {@linkcode CameraRuntimeError} When any kind of error occured while requesting permission. Use the {@linkcode CameraRuntimeError.code | code} property to get the actual error
*/
public static async requestMicrophonePermission(): Promise<CameraPermissionRequestResult> {
try {