import * as React from 'react'; import { ForwardedRef, forwardRef, useCallback, useImperativeHandle } from 'react'; import { CameraRef, Props } from './types'; import { PrimaryButton } from '../../buttons'; import { Surface, Text } from 'react-native-paper'; import shim from '@joplin/lib/shim'; import { TextInput } from 'react-native'; const Camera = (props: Props, ref: ForwardedRef) => { useImperativeHandle(ref, () => ({ takePictureAsync: async () => { const path = `${shim.fsDriver().getCacheDirectoryPath()}/test-photo.svg`; await shim.fsDriver().writeFile( path, ` Test! `, 'utf8', ); return { uri: path, type: 'image/svg+xml' }; }, }), []); const onCodeChange = useCallback((data: string) => { props.codeScanner.onBarcodeScanned?.({ data, type: 'qr', }); }, [props.codeScanner]); return Camera mock Reject permission Accept permission On camera ready ; }; export default forwardRef(Camera);