femioladeji / react-slideshow

A react component for slideshow supporting slide, fade and zoom
https://react-slideshow-image.netlify.app/
MIT License
362 stars 71 forks source link

passing a ref to Fade component throws a warning #192

Closed Yuripetusko closed 2 years ago

Yuripetusko commented 2 years ago

I am passing ref to a Fade like so:

const MyComponent = () => {
  const slideRef = useRef<Fade | null>(null);

  const onChange = () => {...}

  return (
     <Fade
        autoplay={false}
        duration={10000}
        arrows={false}
        ref={slideRef}
        onChange={onChange}
        transitionDuration={300}>
        {items.map((item) => (
          <Item
            slideIndicators={slideIndicators}
            item={item}
            key={item.id}
          />
        ))}
      </Fade>
  )

And getting a warning in browser console like so:

Warning: [object Object]:refis not a prop. Trying to access it will result inundefinedbeing returned. If you need to access the same value within the child component, you should pass it as a different **prop.**

Not really sue where to look yet, but if there are any pointers happy to try to debug more

femioladeji commented 2 years ago

@Yuripetusko we'll look into this and get back to you

femioladeji commented 2 years ago

@Yuripetusko thanks for raising this issue. It has been fixed in the latest version 4.0.5

Yuripetusko commented 2 years ago

Thank you for doing it so promptly