Update Camera.tsx
This commit is contained in:
parent
95db7fb2ff
commit
981c5fa576
@ -14,7 +14,7 @@ import type { RecordVideoOptions, VideoFile } from './VideoFile';
|
|||||||
//#region Types
|
//#region Types
|
||||||
type Modify<T, R> = Omit<T, keyof R> & R;
|
type Modify<T, R> = Omit<T, keyof R> & R;
|
||||||
|
|
||||||
type CameraFormatProps = {
|
interface CameraFormatProps {
|
||||||
/**
|
/**
|
||||||
* Automatically selects a camera format which best matches the given preset
|
* Automatically selects a camera format which best matches the given preset
|
||||||
*/
|
*/
|
||||||
@ -39,7 +39,7 @@ type CameraFormatProps = {
|
|||||||
* Selects a given format.
|
* Selects a given format.
|
||||||
*/
|
*/
|
||||||
format?: never;
|
format?: never;
|
||||||
};
|
}
|
||||||
type CameraPresetProps = Modify<
|
type CameraPresetProps = Modify<
|
||||||
CameraFormatProps,
|
CameraFormatProps,
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ type CameraPresetProps = Modify<
|
|||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
type CameraScannerPropsNever = {
|
interface CameraScannerPropsNever {
|
||||||
/**
|
/**
|
||||||
* Specify the code types this camera can scan.
|
* Specify the code types this camera can scan.
|
||||||
*/
|
*/
|
||||||
@ -61,7 +61,7 @@ type CameraScannerPropsNever = {
|
|||||||
* Called when one or multiple codes have been scanned.
|
* Called when one or multiple codes have been scanned.
|
||||||
*/
|
*/
|
||||||
onCodeScanned?: never;
|
onCodeScanned?: never;
|
||||||
};
|
}
|
||||||
export type CameraScannerProps = Modify<
|
export type CameraScannerProps = Modify<
|
||||||
CameraScannerPropsNever,
|
CameraScannerPropsNever,
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ export type CameraScannerProps = Modify<
|
|||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type CameraDeviceProps = {
|
export interface CameraDeviceProps {
|
||||||
// Properties
|
// Properties
|
||||||
/**
|
/**
|
||||||
* The Camera Device to use
|
* The Camera Device to use
|
||||||
@ -97,9 +97,9 @@ export type CameraDeviceProps = {
|
|||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
enableHighResolutionCapture?: boolean;
|
enableHighResolutionCapture?: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
export type CameraDynamicProps = {
|
export interface CameraDynamicProps {
|
||||||
/**
|
/**
|
||||||
* Whether the Camera should actively stream video frames, or not.
|
* Whether the Camera should actively stream video frames, or not.
|
||||||
*
|
*
|
||||||
@ -130,9 +130,9 @@ export type CameraDynamicProps = {
|
|||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
enableZoomGesture?: boolean;
|
enableZoomGesture?: boolean;
|
||||||
};
|
}
|
||||||
|
|
||||||
export type CameraEventProps = {
|
export interface CameraEventProps {
|
||||||
/**
|
/**
|
||||||
* Called when any kind of runtime error occured.
|
* Called when any kind of runtime error occured.
|
||||||
*/
|
*/
|
||||||
@ -141,7 +141,7 @@ export type CameraEventProps = {
|
|||||||
* Called when the camera was successfully initialized.
|
* Called when the camera was successfully initialized.
|
||||||
*/
|
*/
|
||||||
onInitialized?: () => void;
|
onInitialized?: () => void;
|
||||||
};
|
}
|
||||||
|
|
||||||
export type CameraProps = (CameraPresetProps | CameraFormatProps) &
|
export type CameraProps = (CameraPresetProps | CameraFormatProps) &
|
||||||
(CameraScannerPropsNever | CameraScannerProps) &
|
(CameraScannerPropsNever | CameraScannerProps) &
|
||||||
@ -183,8 +183,8 @@ type RefType = React.Component<CameraProps> & Readonly<NativeMethods>;
|
|||||||
*
|
*
|
||||||
* The `<Camera>` component's most important (and therefore _required_) properties are:
|
* The `<Camera>` component's most important (and therefore _required_) properties are:
|
||||||
*
|
*
|
||||||
* * {@link CameraProps.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 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 CameraProps.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.
|
* * {@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.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```jsx
|
* ```jsx
|
||||||
|
Loading…
Reference in New Issue
Block a user