Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

fix: avoid stringified "null" and "undefined" values#9

Merged
ericvicenti merged 1 commit intoreact-navigation:masterfrom
jaulz:patch-1
Oct 29, 2018
Merged

fix: avoid stringified "null" and "undefined" values#9
ericvicenti merged 1 commit intoreact-navigation:masterfrom
jaulz:patch-1

Conversation

@jaulz
Copy link
Copy Markdown
Contributor

@jaulz jaulz commented Oct 18, 2018

No description provided.

@rszalski
Copy link
Copy Markdown

Would love to see this merged in. One case when this is problematic is when you defined optional params in your navigators, e.g.

Home: {
  screen: HomeScreen,
  path: 'link/:requiredParam/:optionalParam?'
},

Then you need to make workarounds, since getParam won't handle it as default value:

let optionalParam = this.props.navigation.getParam('optionalParam', '0')

if (optionalParam === 'undefined') {
  optionalParam = '0'
}

@satya164 satya164 requested a review from ericvicenti October 21, 2018 11:23
@ericvicenti
Copy link
Copy Markdown
Contributor

Ah, this looks good

@ericvicenti ericvicenti merged commit fa8b320 into react-navigation:master Oct 29, 2018
@jaulz jaulz deleted the patch-1 branch October 30, 2018 08:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants