AppState ยท React Native
AppState can tell you if the app is in the foreground or background, and notify you when the state changes.