-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 App unable to go to sleep once camera loads #3041
Comments
Guten Tag, Hans here. Note New features, bugfixes, updates and other improvements are all handled mostly by |
@FoundersApproach We're seeing a similar issue on iOS 16+. On iOS <= 15 the green dot showing the camera is active never goes away. Can you try capturing the "goBack" and then using setTimeout to set the camera in-active prior to going back? Something like this:
Note: Would need to disable back gestures in order to make sure navigating back is always captured. |
Looks like this specific line keeps the phone from going to sleep. It doesn't appear that this is implemented on Android for VC. |
Perhaps this should just be removed? Idle management could be left to library consumers. This would benefit Expo users, especially, which uses |
this approach works. I need to delay the goBack action. if both |
I'm finally migrating from react-native-camera to get rid of some old problems.. only to run into new ones =( Leaving the green camera dot on and prevent the app from sleeping is a no-go for me. The delayedGoBack approach solves this, but only when I'm in charge of the back navigation. Do I really have to disable both the back button and the "swipe to go back" function to get this to work? I have postponed the migration for many years and I was quite confident that vision-camera would be a really mature product by now. Everything else in vision-camera seems excellent, but this bug is a bummer. I'm hoping that I have misunderstood something or that I have misconfigured something. Is it really the case that this bug affects everyone who uses react-navigation? |
For anyone else ending up here: With the below code I can use the regular
edit: Only difference is the delay and useFocusEffect instead of useEffect, which makes it possible to deactivate the camera even for routes which stays mounted. I.e. deactivate camera "onBlur" instead of "unMount" edit2: Simply use the value from |
What's happening?
Once camera library loads in one screen and going back to previous screen in stack navigation then app unable to goes to sleep. May be camera reference object is unable to let app sleep ?
I did some object reference clearance in component unmount but no luck. Please help!
Reproduceable Code
Relevant log output
Camera Device
Device
iPhone 14 plus (ios 17.1.1)
VisionCamera Version
"react-native-vision-camera": "^3.9.2"
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information
The text was updated successfully, but these errors were encountered: