Description
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.