Skip to content
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

Navigation.updateProps also clears untouched props #6536

Closed
mrousavy opened this issue Sep 5, 2020 · 0 comments · Fixed by #6538
Closed

Navigation.updateProps also clears untouched props #6536

mrousavy opened this issue Sep 5, 2020 · 0 comments · Fixed by #6538

Comments

@mrousavy
Copy link
Collaborator

mrousavy commented Sep 5, 2020

Issue Description

When using Navigation.updateProps(...), untouched props should remain unchanged, but they're being set to undefined.

@guyca pointed out that the issue might be caused by a missing spread operator in ComponentWrapper::setProps(...)

Steps to Reproduce / Code Snippets / Screenshots

  1. Create screen/modal/overlay with props type:
    { foo: number, bar: string }
  2. Show screen/modal/overlay with props:
    { foo: 0, bar: 'hello' }
  3. Print props in render function of component:
    console.log(JSON.stringify(props))
    // outputs: { foo: 0, bar: 'hello' }
  4. Call updateProps:
    Navigation.updateProps(SCREEN_COMPONENT_ID, { foo: 1 })
  5. Print props in render function of component:
    console.log(JSON.stringify(props))
    // outputs: { foo: 1, bar: undefined }

Environment

  • React Native Navigation version: 6.12.2
  • React Native version: 0.63.2
  • Platform(s) (iOS, Android, or both?): iOS, Android
  • Device info (Simulator/Device? OS version? Debug/Release?): all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant