react-native-rectangle-scanner icon indicating copy to clipboard operation
react-native-rectangle-scanner copied to clipboard

remove captured image

Open kimsean opened this issue 5 years ago • 2 comments

Hi. how to removed the captured images? when i capture it and do the process, I navigate it to other page, then when i go back to the camera capture page, the previous image is still there. How do i reset ?

kimsean avatar Apr 14 '20 07:04 kimsean

Read through the Capturing an Image section on the readme. The image is NOT deleted from the file system after you navigate away. It is stored in a cache folder, so the OS will clear these eventually. You can manually delete them by deleting the file or the folder which is accessible by import { CACHE_FOLDER_NAME } from 'react-native-rectangle-scanner;

If this is a question of the component not remounting when navigating BACK to the page, this is most likely an issue with your navigation package. Most often, when navigating back to a page, it does not remount the component, or unmount the component when leaving the page. You should turn off and on the camera on navigating to and from the page, rather than just relying on the mount function. (Or you can put the entire camera package in a modal and dismiss the modal after capture. )

humphreyja avatar Apr 14 '20 16:04 humphreyja

Yeah, @humphreyja is right, the camera has problems with navigation libraries. So it's better to turn off the camera before navigating other pages. What I'm currently doing is using a conditional on a component to display or not the camera component.

cagv24 avatar Apr 22 '20 13:04 cagv24