beefe / react-native-popup

popup for react-native
169 stars 41 forks source link

undefined it not an object (evaluating 'this.popup.tip') #4

Closed cablegunmaster closed 8 years ago

cablegunmaster commented 8 years ago

Trying to implement this code in my project it fails with bug. I got the feeling, this.popup seems to be undefined.

Error:

undefined it not an object (evaluating 'this.popup.tip') 

I got the feeling in my script it can't find:

 <Popup ref={(popup) => { this.popup = popup }}/>

Basically I got a simple script:

    onPressGimmeToolTip() {
        this.popup.tip({
            content: 'come on!'
        });
    }

render(){
    <View>
     <Popup ref={(popup) => { this.popup = popup }}/>
    <Text onPress={this.onPressGimmeToolTip}>
                    Yay it did something.
     </Text>
     </View>
}

I would love to use this library :+1: Specs: react-native: 0.23.1 react-native-popup: 0.5.2

cablegunmaster commented 8 years ago

Solved: forgot: .Bind(this)

 <Text onPress={this.onPressGimmeToolTip.bind(this)}>Solved.</Text>