I have a React Native app with some business logic from the Native side using Android/iOS.
I am facing a problem now, where I have to kill an instance of the Camera that we use as a dependency. We create the instance of the CameraFrame and add the CameraView inside of it.
Our problem is, we can only stop the CameraView using an API method. However, we are not able to destroy or remove the CameraFrame
, and there is no method inside of the class to use for this purpose.
The CameraFrame has similar code like this:
class CameraFrame : ViewGroup {
// ...business logic
}
And we import on the Android side, creating the instance of it and adding a view.
import com......CameraFrame;
import com......CameraView;
class CameraViewManager extends SimpleViewManager<CameraFrame> {
@Override
public CameraFrame createViewInstance(ThemedReactContext context) {
this.CameraView = xyz.getInstance().createCameraView(context);
this.CameraView.start();
CameraFrame frame = new CameraFrame(context);
frame.addView(CameraView);
return this.frame;
}
// ...more business logic
}
How can I destroy/stop this view instance?