-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toc hrefs with '#' cannot be navigated #11
Comments
@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.
with podfile specs
|
@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 <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 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. |
…turn Locator[] for consistency Links and Locators are not the same and need to be handled differently. To avoid complexity, the library has been update to only deal with Locators and map all Links it returns to Locators. BREAKING CHANGE: onTableOfContents now returns a `Locator[]` instead of a `Link[]`. Update your `onTableOfContents` callbacks from `(toc: Link[]) => {...}` to `(toc: Locator[]) => {...}`. #11
…nk or Locator objects Links and Locators are not the same and need to be handled differently. Regardless of which object is passed to `location`, convert it to the proper Locator and navigate to it. #11
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',}
The text was updated successfully, but these errors were encountered: