-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Set default params? #441
Comments
See https://reactnavigation.org/docs/navigators/navigation-options, section |
@grabbou I do not see this section. |
Try Default navigation options 😊 |
@grabbou |
Ah, sorry. I thought you were talking about navigation options (and its
default values). Do you mean default parameters for a scene? Can you post a
simple code to demonstrate what you want to achieve? That would help me
understand it a bit more.
…On Wed, Feb 22, 2017, 18:19 Jeff Mendez ***@***.***> wrote:
@grabbou <https://github.com/grabbou> static navigationOptions = { state:
{ params: { something: false, somethingElse: false } } } did not work.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#441 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWcxqcFc4A1kjXT2gy_0GzuRZjjaem_ks5rfG4wgaJpZM4MI4gp>
.
|
@grabbou Sure. I want to achieve this but for navigation state params since I have a statement checking to see if the prop has been passed down and set to true and need to default it to false. |
This may be related to #232 |
@jeffreymendez1993 why wouldn't |
@grabbou It would work, but wouldn't you want to be able to setDefault params just how you setDefault props to have a clear vision on what the default to certain things would be. If not I guess that would work for now. |
as far as I'm aware, you currently cannot set default parameters for a scene/screen. but seems like there is a good argument for adding them |
@thurt I think this should be added as for this makes code clean and easy to read. |
This is especially important for things like the Without default params it's not possible (at least not without fudging things using the routeName) to have a bunch of drawer items with the same screen but different params, like: DrawerNavigator({
Inbox: {
screen: MessageList,
params: {
filter: {
archived: false
}
},
},
Archives: {
screen: MessageList,
params: {
filter: {
archived: true
}
},
},
AllMessages: {
screen: MessageList,
},
}); |
@dantman that would be perfect |
Same problems with @dantman . Same screen with different params. |
Has the problem been solved? |
hi there! I moved this feature request to canny, as it's our new home for feature requests: https://react-navigation.canny.io/feature-requests/p/set-default-params-in-a-screen-component issues are now only for bugs |
where you use the param, you can do this:
if you think this api isn't good enough then please open a rfc to discuss further |
the api that @dantman suggested above was implemented in react-navigation/core#11 |
Is there any way to set a default param on the component itself?
The text was updated successfully, but these errors were encountered: