gerhardsletten / react-reader

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

in vertical Scroll view : when I click any section in TOC it 1st open that section and in next second it scrolled to end of that section. same happens When I pass externally epubcfi of the start of the section. #155

Closed junior-g closed 1 year ago

junior-g commented 1 year ago

I observed that in vertial scroll locationChanged function being called twice. and 1st it give expected start epubcfi and then 2nd time (after auto scroll) it gives end epubcfi

junior-g commented 1 year ago

I tried this also - https://github.com/futurepress/epub.js/issues/1131. It's the same issue after trying this issue confined to some sections of the book only but behaviour remains same for cases when I am manually putting start epubcfi location of the section

junior-g commented 1 year ago

https://github.com/futurepress/epub.js/issues/1131. this worked when I set offset to zero by sending offsets in this way <ReactReader ...... epubOptions={{ allowScriptedContent: true, allowPopups: false, flow: "scrolled", manager: 'continuous', offset: 0 }} />

But this stopped scrolling between sections

junior-g commented 1 year ago

@gerhardsletten , @rafaelsaback , @Lamarcke , @azu Can you help here -

junior-g commented 1 year ago

@gerhardsletten , @rafaelsaback , @Lamarcke , @azu Can you help here -

BUMP

rafaelsaback commented 1 year ago

react-reader uses epubjs under the hood. If this is an issue in epubjs, then it must be fixed there. After they have this bug patched, then someone can try upgrading the version of epubjs used here in react-reader.

Disclaimer, I'm not a maintainer of this repo

gerhardsletten commented 1 year ago

@junior-g When I looked at this, it looks like the bug only happens on the first click on the chapther-link, if you click the same chapter one more time, it scrolls to the right location.

Look like a bug in epubjs, as mentioned in https://github.com/futurepress/epub.js/issues/1131.

When I revert this change https://github.com/futurepress/epub.js/commit/915ab2e107f7d95d44a9fbc48b91409c6ac8c3e2 it is working as expected.

You could try to just fixed that in your node_modules If you build the code locally, or search the web for how to replace a nested dependency within node_modules for your bundler.