Nodlik / react-pageflip

Simple React.js wrapper for StPageFlip library, for creating realistic and beautiful page turning effect
https://nodlik.github.io/react-pageflip/
MIT License
476 stars 91 forks source link

TypeError _this2.flipBook.getPageFlip is not a function #20

Open raana96 opened 3 years ago

raana96 commented 3 years ago

react-pageflip has a problem with nextjs and getPageFlip does not work.

https://stackoverflow.com/questions/68883595/typeerror-this2-flipbook-getpageflip-is-not-a-function

HarshaDW commented 3 years ago

Experiencing the same issue!

on version 2.0.3 react: 17.0.2

Sanaullahbugti commented 3 years ago

Have you guys got anything related to this or any alternative for flipbook? I am facing same issue

nixjke commented 1 year ago

For function components This work for me

const bookRef = useRef(null)

const nextButtonClick = () => {
    bookRef.current.pageFlip().flipNext()
  }

 const prevButtonClick = () => {
    bookRef.current.pageFlip().flipPrev()
  }

<HTMLFlipBook
  onFlip={onFlip}
  width={616}
  height={872}
  showCover={true}
  ref={bookRef}
>
// ...my render page
</HTMLFlipBook>