Add an option to pass object params in linking.
h
hossein mohammadi
Params on the web convert to stringify. On web history have an option for push state between route. why react-navigation don't use that.
satya164
Can you elaborate what you mean by "we can only parse strings"? URLs are strings, so what else could it be?
If you want to pass full param objects, you should use
initialParams
prop on Screen
instead of linking config.Ryu Nishida
satya164: Yes that’s how I am currently getting it done.
I am suggesting this because it is sort of inconsistent with how this module supports: while passing object-based params involved with deep linking needs extra work from scratch, providing string-based params can be handled easily with internal support.
satya164
Ryu Nishida: I'm not sure what you're suggesting
Ryu Nishida
satya164: hmm what’s your native language? I’ll try translating this into it.
satya164
Ryu Nishida: it's not a language barrier. you need to write down and explain what exactly you're proposing. what does "pass object params in linking" exactly mean? how does it interact with other features? why is it needed?
Ryu Nishida
satya164: I answered all questions previously but again:
- In the linking option, it’s good to have an ability to parse the url and pass it as an object to the navigation state. For now, it’s only possible for us to parse the url and provide the navigation state with a string value.
- It interacts with the parse option of the linking prop.
- Because it’s pretty convenient to have an option with internal support to pass an object directly to the navigation when detecting access via deep linking.
satya164
Ryu Nishida: you can already pass URL yourself with a custom
getStateFromPath
function. the parse
function for params in linking also doesn't restrict you to strings, you can return anything such as an object. if that's not what you're looking for, please open an RFC with code examples of what you mean how it's going to work with current linking mechanism.i'm not sure what you mean by "provide the navigation state with a string value". navigation state is an object, not string, params are parsed as string by default and the
parse
function lets you parse them however you want.Ryu Nishida
satya164: yeah again this’s how I’m dealing with that. But it’s not as easy as passing a string value to the navigation state. This’s my point.
satya164
Ryu Nishida: I have no idea what "passing a string value to the navigation state" means. Please open an RFC with "code examples".
h
hossein mohammadi
I think react-navigation should have some things internally to handle the object between screen navigates.
I am handling that with react.context but it doesn't seem good.