goto API on Navigator.
Overview
Thegoto method enables programmatic navigation to specific locations within a form. This is useful for:
- Guiding users to required fields after validation
- Implementing custom navigation flows
- Deep linking to specific form sections
- Auto-scrolling to specific fields
Navigator and pass it to the JoyDoc component via the navigator prop. Then call navigator.goto(path) with a path string whenever you want to navigate.
Path-Based Navigation
Navigate using a slash-separated path string.NavResponse
Thegoto method returns an object indicating success or failure.
Failure reasons include:
- Page does not exist
- Page is hidden (due to conditional logic)
- Field position does not exist
- Field is hidden (due to conditional logic)
- Field type is unsupported (e.g.
file,unknown) - Navigating to a hidden field: the page still switches and scrolls to the top of the page, but
statusis"failure"
Page Change Events
Page changes triggered bygoto() or by the user clicking a page in the UI are emitted through the onBlur and onFocus callbacks (the navigation listener). When the active page changes, the SDK fires a page event so you can track which page is focused.
Check the type property on the event to distinguish page events from field focus/blur events:
Page event payload:
For all event options (including field-level focus/blur), see Event Handling.