`addMark()` doesn't work?
alphonso06 opened this issue · comments
Tried using addMark()
to test out highlighting via CFI Range, but it didn't seem to work for onReady
, onStarted
, and even onRendered
.
Tested if the onPress()
was working and by adding a simple console.info("book pressed")
I was able to confirm that it was working. So that's where I decided to put the addMark()
hook instead.
Given the following page, this will start you at a specific page. The CFI Range I provided for addMark()
should highlight the word "Niagara", but it doesn't.
export default function Page() {
const { width, height } = useWindowDimensions()
const { addMark } = useReader()
return (
<SafeAreaView>
<ReaderProvider>
<Reader
src="https://s3.amazonaws.com/moby-dick/OPS/package.opf"
width={width}
height={height}
fileSystem={useFileSystem}
initialLocation="epubcfi(/6/14!/4/2/14/2[c001p0006]/1:348)"
onPress={() => addMark("highlight", "epubcfi(/6/14!/4/2/14/2[c001p0006],/1:911,/1:918)")}
/>
</ReaderProvider>
</SafeAreaView>
)
}
Any ideas how to use this properly? What am I missing here? 🤔
--edit--
I tested this on Expo Go (SDK Version 49), with an Android 13 device.
From my experience in this package there is a wrong setup for onPress function. It’s quite buggy on android platform. Try to change TouchableWithoutFeedback to for example react native gesture handler one. You can also listen to onHighlight event from Reader component.
Hello @alphonso06, did @Goldlightdrake suggestion help you with the problem?
Hi everyone, I finally fixed this problem, sorry for the delay. The fix will soon be available in version 1.4.0