Add a few @internal annotations

This commit is contained in:
Marc Rousavy 2021-03-07 14:23:14 +01:00 committed by GitHub
parent 0a76a416ad
commit d4b8da790c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,11 +204,20 @@ type RefType = React.Component<CameraProps> & Readonly<NativeMethods>;
* @component * @component
*/ */
export class Camera extends React.PureComponent<CameraProps, CameraState> { export class Camera extends React.PureComponent<CameraProps, CameraState> {
/**
* @internal
*/
static displayName = 'Camera'; static displayName = 'Camera';
/**
* @internal
*/
displayName = Camera.displayName; displayName = Camera.displayName;
private readonly ref: React.RefObject<RefType>; private readonly ref: React.RefObject<RefType>;
/**
* @internal
*/
constructor(props: CameraProps) { constructor(props: CameraProps) {
super(props); super(props);
this.state = { cameraId: undefined }; this.state = { cameraId: undefined };
@ -451,6 +460,9 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
} }
//#endregion //#endregion
/**
* @internal
*/
static getDerivedStateFromProps(props: CameraProps, state: CameraState): CameraState | null { static getDerivedStateFromProps(props: CameraProps, state: CameraState): CameraState | null {
const newCameraId = props.device.id; const newCameraId = props.device.id;
if (state.cameraId !== newCameraId) return { ...state, cameraId: newCameraId }; if (state.cameraId !== newCameraId) return { ...state, cameraId: newCameraId };
@ -458,6 +470,9 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
return null; return null;
} }
/**
* @internal
*/
public render(): React.ReactNode { public render(): React.ReactNode {
// We remove the big `device` object from the props because we only need to pass `cameraId` to native. // We remove the big `device` object from the props because we only need to pass `cameraId` to native.
const { device: _, ...props } = this.props; const { device: _, ...props } = this.props;