Closed durpy2 closed 1 year ago
@durpy2 is this on iOS, Android, or both? additionally, what version are you using?
@jspizziri I've only tested for iOS 16 where this is happening, the environment looks like below.
{
"react-native": "0.69.6",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native-readium": "^1.0.0",
}
with podfile specs
pod 'GCDWebServer', podspec: 'https://raw.githubusercontent.com/readium/GCDWebServer/3ec154d358f26858071feaa6429e0f1c16bb11bd/GCDWebServer.podspec', modular_headers: true
pod 'R2Shared', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.4.0/Support/CocoaPods/ReadiumShared.podspec'
pod 'R2Streamer', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.4.0/Support/CocoaPods/ReadiumStreamer.podspec'
pod 'R2Navigator', podspec: 'https://raw.githubusercontent.com/readium/swift-toolkit/2.4.0/Support/CocoaPods/ReadiumNavigator.podspec'
pod 'Minizip', modular_headers: true
@durpy2 thanks for the additional information. It'll probably be a bit before I can look into this myself. Please feel free to do some digging via the example project. I can give guidance as needed.
@durpy2 I was just able to confirm this behavior. I'm going to take a look at getting it resolved.
@durpy2 alright, so the problem here is that you need to specifically pass the #
as a fragment. Here's a rough example:
<TableOfContents
items={toc}
onPress={(link) => {
console.log('onPress', link);
const parts = link.href.split('#');
const l: any = {
href: parts[0],
type: 'application/xhtml+xml',
};
if (parts[1]) {
l['locations'] = {
fragments: [parts[1]],
};
}
setLocation(l);
}}
/>
I would've assumed that the core swift-tooklit
readium would've handled this automatically, as it is handling it on the Android side, but it's not on the Swift side.
I have filed an issue upstream and we'll see what they say. If they don't want to support it then we can add it to our swift code for consistency. In the meantime please try a workaround like the above.
@jspizziri Great. Thank you for the workaround info.
Thanks for creating this library.
When an epub is loaded with toc, if the href contains '#', navigation doesn't work properly.
Attached a sample epub with toc href values like
<a href="7604861093435514544_67098-h-0.htm.xhtml#pgepubid00012" id="np-13">IN WHICH EEYORE LOSES A TAIL AND POOH FINDS ONE</a>
pg67098-images-3.epub.zip
Currently setting Link object location as
{ href: "7604861093435514544_67098-h-0.htm.xhtml#pgepubid00012", type: 'application/xhtml+xml',}