Skip to content
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

Example app: Unable to navigate using table of contents #36

Closed
adesege opened this issue Jun 12, 2023 · 4 comments · Fixed by #37
Closed

Example app: Unable to navigate using table of contents #36

adesege opened this issue Jun 12, 2023 · 4 comments · Fixed by #37

Comments

@adesege
Copy link
Contributor

adesege commented Jun 12, 2023

Using the example app, I'm unable to navigate to the selected page. The modal closes but it doesn't perform the navigation.

Upon further investigation, I found out that onPress parameter on TableOfContents component returns a Link and not a Locator.

I also attempted to use the returned Link object as the initialLocation but it didn't work too.

Swipe navigation works as expected.

@jspizziri
Copy link
Contributor

@adesege ahh yes. Links and Locators are not identical. The link needs to be converted into a locator before navigation is called. A primitive way of doing this is:

setLocation({
  href: link.href,
  type: 'application/xhtml+xml',
})

You can see more detail on this here

@adesege
Copy link
Contributor Author

adesege commented Jun 12, 2023

Ok, noted. Do you think this should be handled automatically from the native side, in the library's javascript side or the example app?

I can put up a PR to fix it

@jspizziri
Copy link
Contributor

@adesege , not currently, I think this should be handled by the user. I think we just need to update the example app to do something like what I chatted above.

Appreciate you catching and being willing to fix!

@adesege
Copy link
Contributor Author

adesege commented Jun 12, 2023

Happy to help, @jspizziri. Here's the PR #37.

I'll resume working on the PDF #8 support and let you know if I have questions.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants