Skip to content

Instantly share code, notes, and snippets.

@Pinwheeler
Last active June 11, 2019 20:48
Show Gist options
  • Save Pinwheeler/589d6448ea0fe97c8d7545236f660aac to your computer and use it in GitHub Desktop.
Save Pinwheeler/589d6448ea0fe97c8d7545236f660aac to your computer and use it in GitHub Desktop.
State Change
_genericStateChange(nextAppState) {
this._stateChangeFromSource(nextAppState, 'generic')
}
async _universalLinksStateChange(nextAppState, route) {
await this._stateChangeFromSource(nextAppState, 'universal_link', route)
}
async _stateChangeFromSource(nextAppState, source, route = null) {
if (nextAppState === 'active') {
await this.updateApp()
if (source === 'universal_link') {
try {
let options = await route.navigationOptions()
Navigation.setStackRoot('CENTER_STACK', {component: options})
this.AppState.removeEventListener('change', this._universalLinksStateChange)
} catch (error) {
console.log('_universalLinksStateChange', error)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment