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
473 stars 91 forks source link

No flip animation each page is rendering independantly #54

Open quteboy opened 6 months ago

quteboy commented 6 months ago

i am fetching a list of document from an api and its an array of object each object contains url key with s3 bucket url as value below code is rendering files but each page and pdf is rendering separately thus making page flip animation not working i think it is because of pagnumber calculation please provide support

` {filteredData.map((item, index) => { return (

    );
  })}

`

quteboy commented 6 months ago

` const Page = React.forwardRef(({ pageNumber }, ref) => { return (

);

}); `

grgicpetar commented 6 months ago

You should be using only one HtmlFlipBook component. Currently you're rendering one HtmlFlipBook component per item in your map function.

Also you should probably use Document (pdf viewer) as a container for one Page.

quteboy commented 6 months ago

`

{filteredData.map((item, index) => { return ( ); })}

`

like this ? if not please share correct code

grgicpetar commented 6 months ago

Yup, like that. Does it work now?

quteboy commented 6 months ago

console errors are cleaned but still rendering every pdf page individually

quteboy commented 6 months ago

` {filteredData.map((item, index) => { return (

{[...Array(item.numPages)].map((_, pageIndex) => (
))}
    );
  })}

` here is code that i have updated Please let me know