Hooks
Guideway exposes two hooks. Both must be used inside a TourProvider.
useTour()
Section titled “useTour()”Returns the controller for starting and driving tours.
const { start, next, back, skip, stop, isActive, stepIndex, totalSteps } = useTour();Methods
Section titled “Methods”| Member | Type | Description |
|---|---|---|
start |
(tourId: string, options?: { fromIndex?: number }) => void |
Start a tour, optionally from a given step index. |
next |
() => void |
Advance one step. Fires the tour’s onComplete on the last step. |
back |
() => void |
Go back one step. |
skip |
() => void |
End the tour and fire onSkip(atIndex). |
stop |
() => void |
End the tour silently. |
reset |
(tourId: string) => void |
Clear a showOnce tour’s “seen” flag so it can auto-start again. No-op without storage. |
| Member | Type | Description |
|---|---|---|
isActive |
boolean |
Whether a tour is currently running. |
activeTourId |
string | null |
The running tour’s id. |
currentStep |
StepDefinition | null |
The current step. |
stepIndex |
number |
Zero-based index of the current step. |
totalSteps |
number |
Number of steps in the active tour. |
progress |
number |
Progress through the tour, from 0 to 1. |
useTourTarget(id, options?)
Section titled “useTourTarget(id, options?)”Returns a ref to attach to the view a step should highlight. The id must match a step’s id.
const ref = useTourTarget('search');// ...<TextInput ref={ref} placeholder="Search" />Options
Section titled “Options”| Option | Type | Description |
|---|---|---|
scrollRef |
RefObject<ScrollView | FlatList> |
The scroll container holding this target, so Guideway can scroll it into view before highlighting. See Auto-scroll. |
index |
number |
The item’s index in a FlatList, used with scrollToIndex for virtualized rows. See FlatList and lists. |
enabled |
boolean |
Set false to skip registering this target (for example, behind a feature flag). |
