Skip to content

Instantly share code, notes, and snippets.

@jbutko
Created September 10, 2018 20:29
Show Gist options
  • Save jbutko/f40faf7339210523347edef38ac1fd04 to your computer and use it in GitHub Desktop.
Save jbutko/f40faf7339210523347edef38ac1fd04 to your computer and use it in GitHub Desktop.
React Native: Leave screen callback React Navigation Tab Navigator
const didBlurSubscription = this.props.navigation.addListener(
'didBlur',
payload => {
console.debug('didBlur', payload);
}
);
// Remove the listener when you are done
didBlurSubscription.remove();
// Payload
{
action: { type: 'Navigation/COMPLETE_TRANSITION', key: 'StackRouterRoot' },
context: 'id-1518521010538-2:Navigation/COMPLETE_TRANSITION_Root',
lastState: undefined,
state: undefined,
type: 'didBlur',
};
// via From https://stackoverflow.com/questions/49372508/leave-screen-callback-react-navigation-tab-navigator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment