Closed jvgeee closed 3 years ago
Turns out this was a problem with the way I was setting the ref on the AppIntroSlider
component. Ditching useRef()
and changing my code this worked:
let sliderRef;
return <AppIntroSlider
{...rest}
ref={(ref) => (sliderRef = ref)}
/>
Turns out this was a problem with the way I was setting the ref on the
AppIntroSlider
component. DitchinguseRef()
and changing my code this worked:let sliderRef; return <AppIntroSlider {...rest} ref={(ref) => (sliderRef = ref)} />
Hello @jvgeee I have a similar problem with custom pagination component. Can you please show me how you use goToSlide()
function please ?
I'm using custom pagination buttons that allow skipping to a slide on press.
When the component mounts.
sliderRef.current
is undefined. It only gets defined after I manually swipe from one page to the next.This means that on the first slide, if I click the pagination buttons,
sliderRef.current.goToSlide
is undefined and causes an error. Similarly,sliderRef.goToSlide
doesn't exist.What am I doing wrong here?