React Navigation logo
React Navigation
Create
Roadmap
Feedback
Feature Requests
Voters
Daniel
sibelius
Richard Lindhout
Victor Gutemberg
Justin Waite
Brooks Lyrette
A
Abdul
Alexander Petcoglo
Jimmy
Nick Svanidze
and 6 more...
Powered by Canny
Set default params in a screen component
complete
member badge
Brent Vatne
Moved from https://github.com/react-navigation/react-navigation/issues/441
January 24, 2018
member badge
Brent Vatne
marked this post as
complete
this landed in this PR: https://github.com/react-navigation/react-navigation-core/pull/11
it'll be available in 3.0, which is currently in alpha but rc coming soon
·
October 23, 2018
·
Reply
Harshul Sharma
This behavior could be mimiced by passing some default values from parent component as params. Although having some built in functionality could help remove confusion.
·
February 8, 2018
·
Reply
Bruce Flowers
Harshul Sharma: if this is a viable workaround (until the feature is built properly), can you show an example of how to do it?
·
February 27, 2018
·
Reply
Harshul Sharma
Bruce Flowers: Well I hope, inside render() of desired screen you can used set params and es5 style || operator to check if a param has a value and if not supply with yours.
·
March 2, 2018
·
Reply
Alexander Petcoglo
Harshul Sharma: In my case it's not about just having the default params, but the ability to assign them. I'm using the same screen to display different datasets and I need to know which one to use. For now I decided to go with checking the state.routeName to differentiate between them. But I would like to do this in a more explicit way.
·
April 6, 2018
·
Reply
Powered by Canny