gerhardsletten / react-reader

An ePub-reader for React, powered by Epub.js
https://react-reader.metabits.no
Apache License 2.0
721 stars 132 forks source link

Reader only shows cover #165

Closed adigiz closed 12 months ago

adigiz commented 1 year ago

So i tried implementing react reader for my project. But some epub shows blank

i tried using the rendition method. but still returns blank

here is my implementation: https://library.kreatale.com/books/before-the-coffee-gets-cold/read

and this is the epub file im trying to load https://res.cloudinary.com/dhrs3yldr/raw/upload/v1699069528/Before_the_Coffee_Gets_Cold_-_Toshikazu_Kawaguchi_alhxuv.epub

and this is the code snippet i use:

import { useState } from "react"
import { ReactReader } from "react-reader"
import { useLocation } from "react-router-dom";

const BookReader = () => {
    const location = useLocation();
    const [position, setPosition] = useState(0)
    return (
      <div style={{ height: '100vh' }}>
        <ReactReader
          swipeable
          showToc={false}
          url={location.state.fileUrl}
          location={position}
          locationChanged={(epubcfi) => setPosition(epubcfi)}
          epubInitOptions={{
            openAs: 'epub',
          }}
        />
      </div>
    )
}

export default BookReader;
gerhardsletten commented 12 months ago

@adigiz Try to "unzip your-book.epub" and compare the contents of the epub with the epub found here: https://github.com/gerhardsletten/react-reader/blob/main/public/files/alice.epub it looks like there are some difference that makes epubjs break