react-nativeexpoexpo-camera

Close React Native Expo Camera


Random question, I've created a camera app and on iOS, the green dot (signifying that the camera is in use) stays on even when the camera screen is not in use. Do I need to "close" the camera when it's not in use or anything like that? Thanks!


Solution

  • Until you unmount your camera screen, the camera will be in use.

    When you unfocus the camera screen, use the pausePreview() method: https://docs.expo.dev/versions/latest/sdk/camera/#pausepreview

    When you focus on the screen, use the resumePreview() method instead: https://docs.expo.dev/versions/latest/sdk/camera/#resumepreview