Comments (2)
Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement
this is not VisionCamera's fault. You are using hooks wrong, I recommend you read about React hooks to make sure you understand how to properly use them.
Also, this is how to use it:
const front = useCameraDevice('front')
const back = useCameraDevice('back', { physicalDevices: [...] })
from react-native-vision-camera.
const [isSelfee, setIsSelfee] = useState(false)
const front = useCameraDevice('front')
const back = useCameraDevice('back', { physicalDevices: ['ultra-wide-angle-camera', 'wide-angle-camera'] })
const backFormat = useCameraFormat(backDevice, [{photoAspectRatio: ios ? ratio : 9 / 16}, {photoResolution: 'max'}]);
const frontFormat = useCameraFormat(frontDevice, [{photoAspectRatio: ios ? ratio : 9 / 16}, {photoResolution: 'max'}]);
const device = isSelfee ? frontDevice : backDevice;
const format = isSelfee ? frontFormat : backFormat;
return (
<ReanimatedCamera
ref={cameraRef}
style={[styles.camera, {aspectRatio: 1 / ratio, width: '100%'}]}
device={device}
format={format}
isActive={true}
photo={isPhoto}
video={!isPhoto}
audio={!isPhoto}
animatedProps={animatedProps}
onTouchEnd={handleFocus}
zoom={device.neutralZoom}
exposure={exposure}
enableHighQualityPhotos
/>
)
In this code, when i change isSelfee false to true, an error has occur. but without physicalDevices: ['ultra-wide-angle-camera', 'wide-angle-camera'] }, it is work well
Rendered fewer h ooks than expected. This may be cause dby an accidental early return statement.
from react-native-vision-camera.
Related Issues (20)
- 🐛 onOutputOrientationChanged outputs wrong value on tablets HOT 7
- ✨ Hello author, can you add a cropping function after taking the photo? HOT 3
- 🐛 system/camera-is-restricted Camera functionality is not available because it has been restricted by the operating system, possibly due to a device policy. HOT 5
- 💭 Question: Implementing Virtual Background and AR Try-On Glasses with Frame Processing HOT 2
- 💭 CodeScanner does not recognize Data Matrix code on a black background HOT 2
- 🐛 photo.orientation is wrong when outputOrientation = preview on Android HOT 2
- 🐛 OutputOrientation: "Duplicate label in when" HOT 1
- 💭 Add filter to photo when photo is taken HOT 2
- 💭 Obtaining camera calibration data HOT 5
- 🐛 Crash in Android release build HOT 5
- 🐛 Failed to convert NativeBuffer to SkImage HOT 2
- 🔧 RCT_NEW_ARCH_ENABLED=1 failed pod install HOT 2
- 🐛 Cannot debug via Google Chrome if using Android Native method marked as synchronous HOT 2
- 🐛 Crash in iOS release build when using SkiaFrameProcessor HOT 3
- 🐛 Cached apps freezer is freezing app on Google Pixel with Android 14 HOT 6
- 🐛 App Crashes when try to implement camera inside modal. HOT 1
- 💭 iOS photo quality vs native camera HOT 4
- 🐛 RN 0.74, RNVC 4.3.2. Take a photo or snapshot on iOS, the file does not exist at the path indicated by the response HOT 10
- 💭 Getting incorrect coordinates and bounds when using CodeScanner when scanning barcodes HOT 1
- 🔧 Failed to archive HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-vision-camera.