epubjs-rn
epubjs-rn copied to clipboard
Can we set the specific location
Can we set the location to specific page to navigate, Like if I'm reading a book and want to resume from that location where I left and when reopen the app
The onLocationChange
prop will return the the most recent location. Then you can store that location in AsyncStorage or wherever else then ask for it back when the view is rendered.
hi
save start cfi
like this in onLocationChange
:
onLocationChange={(visibleLocation) => {
for save cfi
:
visibleLocation.start.cfi
than in onReady
get cfi from async storage and set state location
AsyncStorage.getItem(id.toString())
.then(value => {
if (value != null && value.length > 5) {
console.log("saved cfi: " + value);
this.setState({ location: value, });
}
// else
// this.setState({ "islogin": false });
})
.done();
set location={this.state.location}
For Epub