This commit is contained in:
Marc Rousavy 2021-02-22 14:35:59 +01:00
parent b9d5bd0294
commit d3c19a4f8c
2 changed files with 18 additions and 14 deletions

View File

@ -66,10 +66,17 @@ The react-native-vision-camera library provides a hook to make camera device sel
You can specify a device type to only find devices with the given type:
```ts
```tsx
function App() {
const devices = useCameraDevices('wide-angle-camera')
const device = devices.back
return (
<Camera
style={StyleSheet.absoluteFill}
device={device}
/>
)
}
```
@ -77,9 +84,16 @@ Or just return the "best matching camera device". This function prefers camera d
> Example: `triple-camera` > `dual-wide-camera` > `dual-camera` > `wide-angle-camera` > `ultra-wide-angle-camera` > `telephoto-camera` > ...
```ts
```tsx
function App() {
const devices = useCameraDevices()
const device = devices.back
return (
<Camera
style={StyleSheet.absoluteFill}
device={device}
/>
)
}
```

View File

@ -60,12 +60,7 @@ function App() {
console.error(error)
}, [])
return (
<Camera
style={StyleSheet.absoluteFill}
onError={onError}
/>
)
return <Camera ref={camera} {...cameraProps} />
}
```
@ -94,11 +89,6 @@ function App() {
}
}, [camera]);
return (
<Camera
style={StyleSheet.absoluteFill}
ref={camera}
/>
)
return <Camera ref={camera} {...cameraProps} />
}
```