Jacse / react-native-app-intro-slider

Simple and configurable app introduction slider for react native
MIT License
1.66k stars 330 forks source link

Cannot read property 'goToSlide' of undefined #164

Closed shamtroon closed 4 years ago

shamtroon commented 4 years ago

I am using react-native-app-intro-slider and want to move to desired slide with given functionality of goToSlide of app-intro-slider. But when I used it, it shows me error that I this.slider is undefined. Here is my code :

 <AppIntroSlider
                            ref={(ref) => this._slider = ref}
                            slides={this.state.slidees}
                            renderItem={this._renderItem}
/AppIntroSlider>

Error : Cannot read property 'goToSlide' of undefined

shamtroon commented 4 years ago

@bienur @GabrielePrestifilippo @Jacse @andrejborstnik

andrejborstnik commented 4 years ago

Can you show us how you call goToSlide. It seems you use the wrong variable: this.slider, instead of this._slider, which is where your ref is saved.

shamtroon commented 4 years ago

@andrejborstnik No, I used this._slider, and it shows me an error. that this._slider is undefined

andrejborstnik commented 4 years ago

Can you share a full example

Jacse commented 4 years ago

Closing for inactivity