Skip to content

Callbacks always running twice on iPhone X when minimzing app and relaunching #5

Open
@kylethebaker

Description

@kylethebaker

When 'minimizing' the application on iPhone X (hard swipe up) and then selecting the icon to open the running app the onActive callback gets ran twice. This doesn't happen when going into the paging view (soft swipe up) and selecting the app.

I think this is because react native is remounting the component when you minimize/reopen in this manner, which triggers the onActive in componentDidMount and then triggers it a second time from the AppState listener.

I can't reproduce this on other iPhone versions or on android, so it seems to be isolated to iPhone X. This might be an issue (or caveat) with react native itself where it triggers a remount when minimizing/opening in this manner only on iPhone X.

Are there edge cases that are avoided by triggering the callbacks on componentDidMount? I suppose this makes onActive run when initially opening the application, but there are other instances where a component might be remounted for whatever reason and you wouldn't want your onActive callback to be called. It's possible for the onActive callback to be called several times without the app ever moving to the background.

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