epubjs-rn icon indicating copy to clipboard operation
epubjs-rn copied to clipboard

Can we set the specific location

Open Mubeen07 opened this issue 4 years ago • 2 comments

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

Mubeen07 avatar Sep 07 '20 17:09 Mubeen07

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.

ErnestGrey avatar Sep 10 '20 18:09 ErnestGrey

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

mesismart avatar Sep 28 '20 07:09 mesismart