Describe the bug
The new arch implement performance optimization where views are not destroyed but rather reused after they are no longer on screen
prepareForRecycle is called when the component is dismissed, it is designed to reset the view's properties to a default state before it's placed in the recycling pool
Our current implementation is reinstantiating the entire CameraView. While this defeats the whole purpose of the optimization, this is even worst because we don't even know if what's been reinstantiated will even be used at all in the future.
https://github.com/teslamotors/react-native-camera-kit/blob/master/ios/ReactNativeCameraKit/CKCameraViewComponentView.mm#L255
To Reproduce
Steps to reproduce the behavior:
- Put a breakpoint in
CameraView init
- Open camera, breaks a first time - expected
- Close camera, breaks a second time - not expected!
- Open camera, doesn't break as it's been instantiated when we closed it previous time
Expected behavior
prepareForRecycle should gracefully stop the camera, not recreate everything
@WoLewicki
Describe the bug
The new arch implement performance optimization where views are not destroyed but rather reused after they are no longer on screen
prepareForRecycleis called when the component is dismissed, it is designed to reset the view's properties to a default state before it's placed in the recycling poolOur current implementation is reinstantiating the entire CameraView. While this defeats the whole purpose of the optimization, this is even worst because we don't even know if what's been reinstantiated will even be used at all in the future.
https://github.com/teslamotors/react-native-camera-kit/blob/master/ios/ReactNativeCameraKit/CKCameraViewComponentView.mm#L255
To Reproduce
Steps to reproduce the behavior:
CameraViewinitExpected behavior
prepareForRecycleshould gracefully stop the camera, not recreate everything@WoLewicki