react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[V2] PassProps is broken

Open eleretic opened this issue 8 years ago • 16 comments

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
          }
        }
      }
    })
CustomerComponent: this.props.customerId === undefined
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

eleretic avatar Aug 23 '18 15:08 eleretic

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

wbeuil avatar Aug 27 '18 15:08 wbeuil

Nope, sorry. Still awaiting answer from repo managers.

eleretic avatar Aug 27 '18 15:08 eleretic

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

guyca avatar Aug 28 '18 05:08 guyca

@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.

getDanArias avatar Sep 08 '18 18:09 getDanArias

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.

stale[bot] avatar Oct 23 '18 19:10 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Oct 30 '18 20:10 stale[bot]

Why the issue was closed? Any solutions?

KovalevAnton avatar Dec 02 '18 07:12 KovalevAnton

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

NirpE avatar Dec 09 '18 07:12 NirpE

I faced this issue too. Any solutions guys?

cuongtora1996 avatar Feb 13 '19 11:02 cuongtora1996

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.

stevenkampen avatar Feb 13 '19 12:02 stevenkampen

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

guyca avatar Feb 13 '19 17:02 guyca

@guyca Still don't work with push

cuongtora1996 avatar Feb 14 '19 02:02 cuongtora1996

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

krookten14 avatar Apr 06 '19 13:04 krookten14

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

max77p avatar Apr 07 '19 21:04 max77p

any solutions ? please ...

askmakdag avatar Apr 28 '19 00:04 askmakdag

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

guyca avatar Apr 28 '19 07:04 guyca