Skip to content

Race condition on iOS setActive behavior. Non-explicit documentation #46

@brianangulo

Description

@brianangulo

Thank you for your open source contributions.

Current behavior

Our users reported the scanner not showing. After looking into it we believe that when updating isActive prop with the same prop to show/hide the scanner camera a race condition seems to occur causing the session to become nil and since setupIfNeeded doesn't seem to get recalled from setting isActive the component gets "stuck" in a state unable to reopen the camera until the app is closed and reopened.

Another issue somewhat related is that the memory is not getting released on unMount automatically, forcing us to do it JS side or not do it at all.

Expected behavior

The component always closes and opens the camera.

How to reproduce?

Very hard to reproduce organically (as its sometimes is with race conditions) but in theory tapping opening and closing really fast on a high refresh rate screen may trigger it.

Preview

What have you tried so far?

Your Environment

software version
ios 18.5
android N/A (iOS only)
react-native v0.76.9
@pushpendersingh/react-native-scanner v1.5.0
node v20.19.1
npm or yarn npm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions