Replies: 3 comments
-
There so many issue complain about this, but no true solution |
Beta Was this translation helpful? Give feedback.
-
For any user have problem like this, i recommend use this library https://github.com/wix/react-native-navigation that more stable and less breaking changes every version |
Beta Was this translation helpful? Give feedback.
-
Why? If you have everything typed-checked, what value does constants provide except another extra import? You get the same autocomplete and error checking with string literals.
type SuckParamsDesign = {
[typeof Screen.Product.Details]: {
productId: string
}
}
Why do you want to provide a generic at every call site? What if you don't pass the correct type here? The point of type-checking is to catch errors, if you pass the type of the argument when you call the function, there's no type-safety. Passing a generic here provides little value. Having all types for screen defined in a single place means you have no chance to make mistakes in other places.
Did you just come here to advertise other libraries? If it works for you then great. What's the point of going to a repo, posting that I don't like this library, I'll use another? |
Beta Was this translation helpful? Give feedback.
-
Using react-navigation is harder to make params well typed, What motivation behind
ParamsList
Currently way making make typed params
But what if user store screen name inside constants ? We have 200+ screens inside project our team cannot remember each screen name if is named with string literal, so we should store inside constants
Is not possible to anonatate params like this
User should able pass params as generic instead
React navigation 4 we can do like that, react navigation 5 this changed 360°
Beta Was this translation helpful? Give feedback.
All reactions