epubjs-rn
epubjs-rn copied to clipboard
BUG: start.cfi does not update location
Hi,
For the latest version, 0.0.103 it seems that updating location with cfi does not work anymore.
A location: start.cfi
does not trigger a onLocationChange
and does not render the page correctly.
The location
and href
from start
seems to trigger the onLocationChange
but only href
works correctly.
Most of the times location
keeps the spinning on and doesn't render the page.
Since href
is too broad, it is not a working alternative.
Any idea on how to fix these back?
Generated locations are stored locally using AsyncStorage
using a book.key()
. But it appears that the key()
method always return the same value for iOS.
I didn't try it yet in android, but this.package.metadata
most likely will be the same for one app.
I updated in Epub.js
the method loadLocations()
from:
var key = this.book.key()+"-locations";
to
var key = this.book.key(this.book.url.filename)+"-locations";
Now the key will be different for different books filenames.
Hope this help whoever was trying to figure out why for different books setting location was buggy.
After the update above, the issue still persists. I suspected that since the locations were messed up the cfi
and location
won't be found. But the issue is more profound.
The location
still trigger onLocationChange
at the beginning of the book and cfi
does not trigger onLocationChange
at all.
Hi @valinaga
Wich version of epubjs do you use? It seems to be related to version 0.3.51, I downgrade to 0.3.49 and start.cfi changed correctly.
I hope it helps
@imarem 0.0.103 came with 0.3.49. It used to work but not anymore now. The issue is when you try to setState({ location: start.cfi })
Hi @valinaga
I could reproduce the error you commented, but it only happens to me in some epubs. the start.cfi doesn't change.
@imarem Yes, and I noticed that the cfi does not clearly identify the current page. Using location: start.cfi does not always go the the same page the start was retrieved through onLocationChange. Any idea? BTW, now I'm on 0.0.106 with 0.3.51 sometimes the cfi works, sometimes it doesn't.
Hi @fchasen
Have you detected the error that @valinaga comments? It only happens to me in any epubs, not everyone has this error. Do you know if it can be epub theme or is it an error in the library?
Thanks in advance
Hi again,
@valinaga : After passing the epubs that failed me, by the validator http://validator.idpf.org/, and fix the errors that contained. The start.cfi is updated correctly!
seems to indicate that these is for the errors in the epubs, not in the plugin, but I can't assure it.
I hope it helps
Do you have a book you can share with me? Would help track the issue, which is likely in epubjs
not in RN.
https://www.dropbox.com/sh/ej5p93xof9cpxo7/AACsoLwz0RzDui8w_v8a7Wqia?dl=1 For some reasons the dropbox change the extension to zip. Please just change the extension but do not unzip the file. It's an epub.
@fchasen hi,
any updates on this one? thanks!