Skip to content

Instantly share code, notes, and snippets.

@dblazeski
Last active February 7, 2019 12:30
Show Gist options
  • Select an option

  • Save dblazeski/fc119d640275f044bb1cd81af89b5a81 to your computer and use it in GitHub Desktop.

Select an option

Save dblazeski/fc119d640275f044bb1cd81af89b5a81 to your computer and use it in GitHub Desktop.
Register screen focus listener, onScreenFocus() called when the screen is focused initially
class HomeScreen extends React.Component {
componentDidMount() {
// Listen for screen focus event
this.props.navigation.addListener('didFocus', this.onScreenFocus)
}
// Called when our screen is focused
onScreenFocus = () => {
// Screen was focused, our on focus logic goes here
this.reloadHomePage()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment