React-native-navigation: [V2] PassProps is broken

Created on 23 Aug 2018  路  16Comments  路  Source: wix/react-native-navigation

Issue Description

PassProps doesn't work. Passing props like it is done in the playground app results in undefined props in components. Also, componentId, which I've come to understand that is supposed to be passed to every screen behind the scenes, is undefined

There is no example in the playground app. All passProps references are in the deprecated or old-example-redux folder.

Steps to Reproduce / Code Snippets / Screenshots

Navigation.push('Kimoby.Stacks.Customers', {
      component: {
        name: 'Kimoby.Customer',
        passProps: {
          customerId: customer.id,
          customer: customer
        }
      }
    })
Navigation.push('Kimoby.Stacks.Customers', {
      component: {
        name: 'Kimoby.Customer',
        options: {
          passProps: {
             customerId: customer.id,
             customer: customer
          }
        }
      }
    })



md5-985fdebec380e34d032b0c95f93e07c3



CustomerComponent: this.props.customerId === undefined



md5-985fdebec380e34d032b0c95f93e07c3



CustomerComponent: this.props.componentId === undefined

Environment

  • React Native Navigation version: 2.0.2478
  • React Native version: 0.55.4
  • Platform(s) (iOS, Android, or both?): Android
  • Device info : Simulator and Device, Android 8, Debug and Release
more info needed 馃彋 stale

All 16 comments

Did you find a way to make it work? I have the same problem on Android ...

Nope, sorry. Still awaiting answer from repo managers.

Hey there, I'm not aware of any issues passing props. The first snippet is correct, the second isn't.
Here's an example from the playground app for passing props, we have e2e on pass props so I don't think it's broken.
If you can reproduce this issue in the playground app, pelese PR a failing e2e test

@wbeuil @guyca I was having problems with anything defined within passProps not being available within the component. I felt maybe this had to do something with the app bundling process.

I stopped the Metro Bundler running on port 8081 and run react-native run-android again and it worked 馃檶

However, if I make a change and reload, the props passed through passProps are gone again. Adding a new property to passProps doesn't show up. I have to stop the Metro Bundler and run react-native run-android again.

Update: Disabling "Live Reload" and enabling "Hot Reload" instead solve this problem. I can now make changes, save, and the passProps props don't disappear.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

The issue has been closed for inactivity.

Why the issue was closed? Any solutions?

I am seeing props being undefined with showOverlay and showModal. Using push they seem to be working.

I faced this issue too. Any solutions guys?

I also see this on version 2.11.0. Haven't done a lot of testing, but nothing passed in with passProps in showModal is ending up in the component.

@cuongtora1996 @stevenkampen Can you guys please try latest snapshot? 2.11.0-snapshot.200

@guyca Still don't work with push

PassProps doesn't work when I use it with redux, or is there something wrong with how I get the passprops and the props from redux

I am having this issue as well. How do you actually get the props when passing props?
+1 bump

any solutions ? please ...

Hey guys
If you believe there's an issue with passProps, then please pr a failing e2e or unit test.
e2e tests for passProps can be found here
Unit tests can be found here

Was this page helpful?
0 / 5 - 0 ratings