Skip to content

Adds guide: action on focus #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 29, 2018

Conversation

jonsamp
Copy link
Contributor

@jonsamp jonsamp commented Dec 28, 2018

Adds a guide: Call an Action After Focusing Screen

This is in response to this Help Wanted issue: #191

See the guide here: https://deploy-preview-330--react-navigation.netlify.com/docs/en/action-after-focusing-screen.html

@react-navigation-bot
Copy link

react-navigation-bot commented Dec 28, 2018

Deploy preview for react-navigation ready!

Built with commit 50d6871

https://deploy-preview-330--react-navigation.netlify.com

@brentvatne
Copy link
Member

thanks @jonsamp, this looks great! a few notes:

  • before merging we should create an identical file in the unversioned docs directory
  • it may be worth mentioning that using the HOC will re-render the screen when isFocused changes unless you implement shouldComponentUpdate. so if you want to make an api call it may be better to use the listener instead, since that won't re-render until you do a setState after the api call completes.
  • it may also be worth mentioning that another use case may be to pause some resource (eg: watching location, playing a video) when switching away from the screen

@jonsamp
Copy link
Contributor Author

jonsamp commented Dec 28, 2018

thanks @brentvatne for the feedback! i incorporated your feedback and also copied the markdown file to the docs/ directory. please let me know if you have more feedback!

@brentvatne
Copy link
Member

looks great, thanks @jonsamp :)

@brentvatne brentvatne merged commit b324302 into react-navigation:source Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants