futurepress/epubjs-rn

How to get current cfi?

Opened this issue · 1 comments

Hi,

I want add bookmark for current cfi. How to get the current cfi?

Hi, to solve this problem, what I did was take location.start.cfi like what I've shown below then I assigned it to a state variable using the useState() hook but you can also use it with this.setState({}) if it's a class-based component.

<Epub 
     ...
     onLocationChange={(location) => setCurrentLocation(location.start.cfi)}
/>