oblador / react-native-lightbox

Images etc in Full Screen Lightbox Popovers for React Native
MIT License
2.82k stars 501 forks source link

Cannot read property 'x' of undefined - Something I'm missing? #31

Open GantMan opened 8 years ago

GantMan commented 8 years ago

I've got to be missing something basic, but for the life of me I don't know what it is.

Copy/Paste example from readme, yes I have navigator in props.

      <Lightbox navigator={this.props.navigator}>
        <Image
          style={{ height: 300 }}
          source={{ uri: 'http://knittingisawesome.com/wp-content/uploads/2012/12/cat-wearing-a-reindeer-hat1.jpg' }}
        />
      </Lightbox>

:boom: BOOM:

https://github.com/oblador/react-native-lightbox/blob/master/LightboxOverlay.js#L187 simulator screen shot apr 1 2016 8 30 18 am

React Native 0.22 - https://github.com/infinitered/react_native_base/tree/light-box

zhongjie-chen commented 8 years ago

I also met this problem @React Native 0.22 Android

markrickert commented 8 years ago

:+1: I'm getting this same issue.

hartmamt commented 8 years ago

I fixed this by changing passProps to props:

https://github.com/hartmamt/react-native-lightbox/blob/master/Lightbox.js#L100

I can do a PR if this makes sense to anyone. I'm not sure if this is the right solution. I think NavigatorIOS supports passProps, but Navigator doesn't (at least not on Android from what I can tell).

DanielMSchmidt commented 8 years ago

A PR would be cool, I encounter the same problem

nidzovito commented 8 years ago

I have same issue and when I change it to props, it doesn't help. And it is related to origin is empty. Below is from result from console.log of

console.log(this.props); console.log(origin);

Result---

Object {navigator: Constructor, springConfig: Object, backgroundColor: "black"} LightboxOverlay.js:187 undefined

rocwong-cn commented 8 years ago

Hey guys , this problem is related to what you set in your navigator: <SceneComponent navigator={navigator} route={route} {...route.passProps}/>
If there is passProps , everything is ok, if not , you should modify it. Good luck !!