Skip to content

Camera remains active when not on 'Scan' scene #1

@wolverineks

Description

@wolverineks

Problem:
When navigating away from the 'Scan' scene or in background mode, the camera component remains active + scanning.

Effects:

  • drains battery
  • scans when the user doesn't expect it
  • crashes when returning to the scan scene a second time

Causes:

  • React Native Router Flux does not unmount a scene when navigating to a new scene

Possible Fixes:

  • Add conditional rendering of the camera which includes the current scene and background mode
    • Upsides:
      • complete fix
      • current best practice
    • Downsides:
      • requires checking background mode
      • must remount on each navigation to the 'Scan' scene, this is slow
    • Mitigation:
      • Throw up a spinner

Further Research

  • Look into React Native Camera pausing the camera component
  • Look into Android Native pausing camera preview

react-native-camera issue 556
react-native-camera issue 460
react-native-camera issue 357

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions