Comments (5)
The camera component needs to be unmounted before you can change the camera. Here's a workaround for now:
const [cameraPosition, setCameraPosition] = useState("front");
const [isActive, setIsActive] = useState(true);
let device = useCameraDevice(cameraPosition);
const onFlipCameraPressed = useCallback(() => {
setIsActive(false);
}, [isActive]);
useEffect(() => {
if (!isActive) {
cameraPosition === "front"
? setCameraPosition("back")
: setCameraPosition("front");
setIsActive(true);
}
return () => {};
}, [isActive]);
and add isActive to conditionally render the component:
{isActive && (
<Camera
style={{ flex: 1 }}
device={device}
isActive={true}
/>
)}
from react-native-vision-camera.
have you found a fix for this @isinuyk ?
from react-native-vision-camera.
have the same issue on A9 Samsung no ref found. on 3.9.2 black screen!
from react-native-vision-camera.
having the same issue on OnePlus5
from react-native-vision-camera.
Fixed this issue in #2768. 💪
from react-native-vision-camera.
Related Issues (20)
- 💭 USB Camera Android HOT 2
- 🐛 Frame dimensions passed in to frame processor different for ios and android HOT 13
- ✨ Support 16kb page size for Android 15+ devices HOT 5
- 🐛 Orientation in output not correct when camera facing up/down. HOT 3
- 🐛 How can I reduce the size of a video that is 151 MB for a 1-minute recording? The bitRate setting does not seem to be working. HOT 6
- 💭 Frame processing FrameInvalidError seems to be thrown arbitrarily HOT 6
- 🐛 onRecordingFinished returns width: 0, height: 0 on every recording HOT 14
- 💭 Code scans only in the top right corner HOT 2
- 🔧 I had issue building !! HOT 1
- 🔧 cannot build!! HOT 1
- 🐛 Whats the meaning of life HOT 1
- 💭 Hans Pie recipe HOT 2
- 💭 Possible to zoom with useSkiaFrameProcessor? HOT 6
- 💭 How to set Low video resolution HOT 3
- 🐛 In production, runAsync does not work inside a useSkiaFrameProcessor HOT 1
- 🐛 Cannot zoom on Android when using useSkiaFrameProcessor HOT 5
- ✨ Request for Adding Additional Cinematic Modes HOT 1
- 🐛 The picture looks blurry ( out of focus) in Camera View but comes out focused after clicking on Ipad HOT 11
- 🐛 ERROR Frame Processor Error: Failed to lock HardwareBuffer for reading!, js engine: VisionCamera HOT 5
- 🐛 [capture/invalid-path] Unable to take photos or videos with custom path with Android using expo file system. HOT 5
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.