rn-smart-tour 1.1.0 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +244 -68
- package/lib/commonjs/compat.js +87 -0
- package/lib/commonjs/compat.js.map +1 -0
- package/lib/commonjs/core/TourEngine.js +608 -0
- package/lib/commonjs/core/TourEngine.js.map +1 -0
- package/lib/commonjs/core/controller.js +38 -0
- package/lib/commonjs/core/controller.js.map +1 -0
- package/lib/commonjs/core/measure.js +130 -0
- package/lib/commonjs/core/measure.js.map +1 -0
- package/lib/commonjs/core/store.js +39 -0
- package/lib/commonjs/core/store.js.map +1 -0
- package/lib/commonjs/index.js +95 -44
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/react/TourOverlay.js +520 -0
- package/lib/commonjs/react/TourOverlay.js.map +1 -0
- package/lib/commonjs/react/TourProvider.js +74 -0
- package/lib/commonjs/react/TourProvider.js.map +1 -0
- package/lib/commonjs/react/TourScope.js +39 -0
- package/lib/commonjs/react/TourScope.js.map +1 -0
- package/lib/commonjs/react/TourScrollable.js +61 -0
- package/lib/commonjs/react/TourScrollable.js.map +1 -0
- package/lib/commonjs/react/TourTarget.js +76 -0
- package/lib/commonjs/react/TourTarget.js.map +1 -0
- package/lib/commonjs/react/context.js +15 -0
- package/lib/commonjs/react/context.js.map +1 -0
- package/lib/commonjs/react/hooks.js +115 -0
- package/lib/commonjs/react/hooks.js.map +1 -0
- package/lib/commonjs/react/placement.js +69 -0
- package/lib/commonjs/react/placement.js.map +1 -0
- package/lib/commonjs/react-navigation.js +80 -0
- package/lib/commonjs/react-navigation.js.map +1 -0
- package/lib/module/compat.js +81 -0
- package/lib/module/compat.js.map +1 -0
- package/lib/module/core/TourEngine.js +604 -0
- package/lib/module/core/TourEngine.js.map +1 -0
- package/lib/module/core/controller.js +33 -0
- package/lib/module/core/controller.js.map +1 -0
- package/lib/module/core/measure.js +118 -0
- package/lib/module/core/measure.js.map +1 -0
- package/lib/module/core/store.js +34 -0
- package/lib/module/core/store.js.map +1 -0
- package/lib/module/index.js +8 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/react/TourOverlay.js +511 -0
- package/lib/module/react/TourOverlay.js.map +1 -0
- package/lib/module/react/TourProvider.js +67 -0
- package/lib/module/react/TourProvider.js.map +1 -0
- package/lib/module/react/TourScope.js +32 -0
- package/lib/module/react/TourScope.js.map +1 -0
- package/lib/module/react/TourScrollable.js +54 -0
- package/lib/module/react/TourScrollable.js.map +1 -0
- package/lib/module/react/TourTarget.js +69 -0
- package/lib/module/react/TourTarget.js.map +1 -0
- package/lib/module/react/context.js +11 -0
- package/lib/module/react/context.js.map +1 -0
- package/lib/module/react/hooks.js +106 -0
- package/lib/module/react/hooks.js.map +1 -0
- package/lib/module/react/placement.js +65 -0
- package/lib/module/react/placement.js.map +1 -0
- package/lib/module/react-navigation.js +74 -0
- package/lib/module/react-navigation.js.map +1 -0
- package/lib/typescript/commonjs/src/compat.d.ts +13 -0
- package/lib/typescript/commonjs/src/compat.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/TourEngine.d.ts +151 -0
- package/lib/typescript/commonjs/src/core/TourEngine.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/controller.d.ts +39 -0
- package/lib/typescript/commonjs/src/core/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/measure.d.ts +26 -0
- package/lib/typescript/commonjs/src/core/measure.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/store.d.ts +9 -0
- package/lib/typescript/commonjs/src/core/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +15 -5
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/react/TourOverlay.d.ts +46 -0
- package/lib/typescript/commonjs/src/react/TourOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react/TourProvider.d.ts +37 -0
- package/lib/typescript/commonjs/src/react/TourProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react/TourScope.d.ts +17 -0
- package/lib/typescript/commonjs/src/react/TourScope.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react/TourScrollable.d.ts +25 -0
- package/lib/typescript/commonjs/src/react/TourScrollable.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react/TourTarget.d.ts +13 -0
- package/lib/typescript/commonjs/src/react/TourTarget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react/context.d.ts +7 -0
- package/lib/typescript/commonjs/src/react/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react/hooks.d.ts +21 -0
- package/lib/typescript/commonjs/src/react/hooks.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react/placement.d.ts +20 -0
- package/lib/typescript/commonjs/src/react/placement.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/react-navigation.d.ts +15 -0
- package/lib/typescript/commonjs/src/react-navigation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +109 -9
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
- package/lib/typescript/module/src/compat.d.ts +13 -0
- package/lib/typescript/module/src/compat.d.ts.map +1 -0
- package/lib/typescript/module/src/core/TourEngine.d.ts +151 -0
- package/lib/typescript/module/src/core/TourEngine.d.ts.map +1 -0
- package/lib/typescript/module/src/core/controller.d.ts +39 -0
- package/lib/typescript/module/src/core/controller.d.ts.map +1 -0
- package/lib/typescript/module/src/core/measure.d.ts +26 -0
- package/lib/typescript/module/src/core/measure.d.ts.map +1 -0
- package/lib/typescript/module/src/core/store.d.ts +9 -0
- package/lib/typescript/module/src/core/store.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +15 -5
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/react/TourOverlay.d.ts +46 -0
- package/lib/typescript/module/src/react/TourOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/react/TourProvider.d.ts +37 -0
- package/lib/typescript/module/src/react/TourProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/react/TourScope.d.ts +17 -0
- package/lib/typescript/module/src/react/TourScope.d.ts.map +1 -0
- package/lib/typescript/module/src/react/TourScrollable.d.ts +25 -0
- package/lib/typescript/module/src/react/TourScrollable.d.ts.map +1 -0
- package/lib/typescript/module/src/react/TourTarget.d.ts +13 -0
- package/lib/typescript/module/src/react/TourTarget.d.ts.map +1 -0
- package/lib/typescript/module/src/react/context.d.ts +7 -0
- package/lib/typescript/module/src/react/context.d.ts.map +1 -0
- package/lib/typescript/module/src/react/hooks.d.ts +21 -0
- package/lib/typescript/module/src/react/hooks.d.ts.map +1 -0
- package/lib/typescript/module/src/react/placement.d.ts +20 -0
- package/lib/typescript/module/src/react/placement.d.ts.map +1 -0
- package/lib/typescript/module/src/react-navigation.d.ts +15 -0
- package/lib/typescript/module/src/react-navigation.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +109 -9
- package/lib/typescript/module/src/types.d.ts.map +1 -1
- package/package.json +26 -7
- package/react-navigation/package.json +6 -0
- package/src/compat.ts +84 -0
- package/src/core/TourEngine.ts +633 -0
- package/src/core/controller.ts +51 -0
- package/src/core/measure.ts +129 -0
- package/src/core/store.ts +39 -0
- package/src/index.ts +15 -5
- package/src/react/TourOverlay.tsx +516 -0
- package/src/react/TourProvider.tsx +106 -0
- package/src/react/TourScope.tsx +33 -0
- package/src/react/TourScrollable.tsx +58 -0
- package/src/react/TourTarget.tsx +83 -0
- package/src/react/context.ts +10 -0
- package/src/react/hooks.ts +117 -0
- package/src/react/placement.ts +95 -0
- package/src/react-navigation.tsx +80 -0
- package/src/types.ts +114 -10
- package/lib/commonjs/DapContext.js +0 -9
- package/lib/commonjs/DapContext.js.map +0 -1
- package/lib/commonjs/DapOverlay.js +0 -223
- package/lib/commonjs/DapOverlay.js.map +0 -1
- package/lib/commonjs/DapProvider.js +0 -350
- package/lib/commonjs/DapProvider.js.map +0 -1
- package/lib/commonjs/DapScrollView.js +0 -44
- package/lib/commonjs/DapScrollView.js.map +0 -1
- package/lib/commonjs/DapTarget.js +0 -116
- package/lib/commonjs/DapTarget.js.map +0 -1
- package/lib/commonjs/useDap.js +0 -17
- package/lib/commonjs/useDap.js.map +0 -1
- package/lib/module/DapContext.js +0 -5
- package/lib/module/DapContext.js.map +0 -1
- package/lib/module/DapOverlay.js +0 -220
- package/lib/module/DapOverlay.js.map +0 -1
- package/lib/module/DapProvider.js +0 -343
- package/lib/module/DapProvider.js.map +0 -1
- package/lib/module/DapScrollView.js +0 -41
- package/lib/module/DapScrollView.js.map +0 -1
- package/lib/module/DapTarget.js +0 -109
- package/lib/module/DapTarget.js.map +0 -1
- package/lib/module/useDap.js +0 -12
- package/lib/module/useDap.js.map +0 -1
- package/lib/typescript/commonjs/src/DapContext.d.ts +0 -3
- package/lib/typescript/commonjs/src/DapContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/DapOverlay.d.ts +0 -2
- package/lib/typescript/commonjs/src/DapOverlay.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/DapProvider.d.ts +0 -15
- package/lib/typescript/commonjs/src/DapProvider.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/DapScrollView.d.ts +0 -9
- package/lib/typescript/commonjs/src/DapScrollView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/DapTarget.d.ts +0 -10
- package/lib/typescript/commonjs/src/DapTarget.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/useDap.d.ts +0 -2
- package/lib/typescript/commonjs/src/useDap.d.ts.map +0 -1
- package/lib/typescript/module/src/DapContext.d.ts +0 -3
- package/lib/typescript/module/src/DapContext.d.ts.map +0 -1
- package/lib/typescript/module/src/DapOverlay.d.ts +0 -2
- package/lib/typescript/module/src/DapOverlay.d.ts.map +0 -1
- package/lib/typescript/module/src/DapProvider.d.ts +0 -15
- package/lib/typescript/module/src/DapProvider.d.ts.map +0 -1
- package/lib/typescript/module/src/DapScrollView.d.ts +0 -9
- package/lib/typescript/module/src/DapScrollView.d.ts.map +0 -1
- package/lib/typescript/module/src/DapTarget.d.ts +0 -10
- package/lib/typescript/module/src/DapTarget.d.ts.map +0 -1
- package/lib/typescript/module/src/useDap.d.ts +0 -2
- package/lib/typescript/module/src/useDap.d.ts.map +0 -1
- package/src/DapContext.ts +0 -4
- package/src/DapOverlay.tsx +0 -190
- package/src/DapProvider.tsx +0 -417
- package/src/DapScrollView.tsx +0 -43
- package/src/DapTarget.tsx +0 -124
- package/src/useDap.ts +0 -10
package/README.md
CHANGED
|
@@ -9,40 +9,42 @@
|
|
|
9
9
|
|
|
10
10
|
## ✨ Features
|
|
11
11
|
|
|
12
|
-
- 🎯 **
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- 🎯 **Measured When Shown**: Targets are measured when their step starts, after scrolling into view and once they stop moving, so the highlight matches what's on screen.
|
|
13
|
+
- 🧭 **Navigation Aware**: Screens kept mounted in the background are never highlighted, and steps wait for screen transitions to finish (React Navigation integration included).
|
|
14
|
+
- 🔀 **Tours Across Screens**: A step can navigate to another screen before it is shown.
|
|
15
|
+
- 📜 **Auto-Scroll**: Works with `ScrollView`, `FlatList` and `SectionList`; each target scrolls its own nearest list.
|
|
16
|
+
- ⚡ **No Re-Render Cost**: Mounting and measuring targets re-renders nothing; components subscribe only to the tour state they use.
|
|
15
17
|
- 💾 **Seen State Caching**: Persistent "only-once" logic with pluggable storage (AsyncStorage, MMKV, etc.).
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- 🛟 **Never Gets Stuck**: If a step's target isn't on screen, the tour ends cleanly instead of leaving an invisible, active tour.
|
|
19
|
-
- 🔁 **Replay on Demand**: `startTour(id, { force: true })`, `resetTour(id)` and `resetAll()` for Help buttons and settings screens.
|
|
18
|
+
- 🛟 **Never Gets Stuck**: If a step's target isn't on screen in time, the tour ends (or skips the step) instead of leaving an invisible, active tour.
|
|
19
|
+
- 🔁 **Replay on Demand**: `startTour(id, { force: true })`, `resetTour(id)` and `resetAll()`, from components or from outside React.
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
23
|
## 📦 Installation
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
npm install rn-smart-tour
|
|
26
|
+
npm install rn-smart-tour@next # 2.0 beta (this README)
|
|
27
|
+
npm install rn-smart-tour # 1.x (stable)
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
Requires React
|
|
30
|
+
Requires React 18+ and React Native 0.73+. No native code, so no `pod install` or rebuild is needed. React Navigation (6+) is optional.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
Checked on device on iOS and Android with React Native 0.88 (New Architecture), and on iOS with React Native 0.81 on the old architecture, with React Navigation 7. Unit tests run against React Native 0.73.
|
|
32
33
|
|
|
33
34
|
---
|
|
34
35
|
|
|
35
36
|
## 🚀 Quick Start
|
|
36
37
|
|
|
37
38
|
### 1. Wrap your App
|
|
38
|
-
Wrap your root component in
|
|
39
|
+
Wrap your root component in `TourProvider` and define your tours.
|
|
39
40
|
|
|
40
41
|
```tsx
|
|
41
|
-
import {
|
|
42
|
+
import { TourProvider } from 'rn-smart-tour';
|
|
42
43
|
|
|
43
44
|
const TOURS = {
|
|
44
45
|
'welcome-tour': {
|
|
45
46
|
id: 'welcome-tour',
|
|
47
|
+
autoStart: true,
|
|
46
48
|
steps: [{
|
|
47
49
|
targetId: 'save-btn',
|
|
48
50
|
title: 'Welcome!',
|
|
@@ -53,96 +55,228 @@ const TOURS = {
|
|
|
53
55
|
|
|
54
56
|
export default function App() {
|
|
55
57
|
return (
|
|
56
|
-
<
|
|
58
|
+
<TourProvider tours={TOURS}>
|
|
57
59
|
<MainApp />
|
|
58
|
-
</
|
|
60
|
+
</TourProvider>
|
|
59
61
|
);
|
|
60
62
|
}
|
|
61
63
|
```
|
|
62
64
|
|
|
63
|
-
### 2. Mark your
|
|
64
|
-
Wrap any view or button you want to highlight with `
|
|
65
|
+
### 2. Mark your Targets
|
|
66
|
+
Wrap any view or button you want to highlight with `TourTarget`.
|
|
65
67
|
|
|
66
68
|
```tsx
|
|
67
|
-
import {
|
|
69
|
+
import { TourTarget } from 'rn-smart-tour';
|
|
68
70
|
|
|
69
71
|
const MyButton = () => (
|
|
70
|
-
<
|
|
72
|
+
<TourTarget name="save-btn">
|
|
71
73
|
<Button title="Save" onPress={...} />
|
|
72
|
-
</
|
|
74
|
+
</TourTarget>
|
|
73
75
|
);
|
|
74
76
|
```
|
|
75
77
|
|
|
76
78
|
### 3. Start the Tour
|
|
77
|
-
|
|
79
|
+
A tour with `autoStart: true` shows the first time its first target appears. Start any tour yourself with `useTour`:
|
|
78
80
|
|
|
79
81
|
```tsx
|
|
80
|
-
import {
|
|
82
|
+
import { useTour } from 'rn-smart-tour';
|
|
81
83
|
|
|
82
|
-
const { startTour } =
|
|
84
|
+
const { startTour } = useTour();
|
|
83
85
|
// ...
|
|
84
86
|
// A tour is shown only once. `force: true` replays it, e.g. from a Help button.
|
|
85
87
|
<Button title="Help" onPress={() => startTour('welcome-tour', { force: true })} />
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
### 4.
|
|
89
|
-
|
|
90
|
+
### 4. Screens (React Navigation)
|
|
91
|
+
Wrap each screen that has targets in `NavigationTourScope`. Its targets then only count while the screen is focused and has finished animating in, so a screen kept mounted in the background is never highlighted.
|
|
90
92
|
|
|
91
93
|
```tsx
|
|
92
|
-
import {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
import { NavigationTourScope } from 'rn-smart-tour/react-navigation';
|
|
95
|
+
|
|
96
|
+
const OrdersScreen = () => (
|
|
97
|
+
<NavigationTourScope>
|
|
98
|
+
{/* screen content with TourTargets */}
|
|
99
|
+
</NavigationTourScope>
|
|
100
|
+
);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Not using React Navigation? `TourScope` does the same with an `active` prop you control: `<TourScope active={isVisible}>`.
|
|
104
|
+
|
|
105
|
+
### 5. Lists (Optional)
|
|
106
|
+
To let tours scroll a target into view, use `TourScrollView` instead of `ScrollView`, or wrap a `FlatList` / `SectionList` in `TourScrollable`:
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { TourScrollable, TourTarget } from 'rn-smart-tour';
|
|
110
|
+
|
|
111
|
+
const listRef = useRef<FlatList>(null);
|
|
112
|
+
|
|
113
|
+
<TourScrollable scrollRef={listRef}>
|
|
114
|
+
<FlatList
|
|
115
|
+
ref={listRef}
|
|
116
|
+
data={items}
|
|
117
|
+
renderItem={({ item }) => (
|
|
118
|
+
<TourTarget name={`item-${item.id}`}>
|
|
119
|
+
<Row item={item} />
|
|
120
|
+
</TourTarget>
|
|
121
|
+
)}
|
|
122
|
+
/>
|
|
123
|
+
</TourScrollable>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
A target in a virtualized list can only be scrolled to once its row has rendered.
|
|
127
|
+
|
|
128
|
+
### 6. Tours Across Screens (Optional)
|
|
129
|
+
`beforeEnter` runs before a step looks for its target, e.g. to open the screen it's on. The step then waits for the target to appear on the focused screen.
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { createNavigationContainerRef } from '@react-navigation/native';
|
|
133
|
+
|
|
134
|
+
export const navigationRef = createNavigationContainerRef();
|
|
135
|
+
|
|
136
|
+
const TOURS = {
|
|
137
|
+
orders: {
|
|
138
|
+
id: 'orders',
|
|
139
|
+
steps: [
|
|
140
|
+
{ targetId: 'orders-tab', title: 'Orders', description: 'All your orders live here.' },
|
|
141
|
+
{
|
|
142
|
+
targetId: 'new-order',
|
|
143
|
+
title: 'New order',
|
|
144
|
+
description: 'Start one from here.',
|
|
145
|
+
beforeEnter: () => navigationRef.navigate('Orders'),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
};
|
|
100
150
|
```
|
|
101
151
|
|
|
102
|
-
###
|
|
152
|
+
### 7. Remember Seen Tours (Optional)
|
|
103
153
|
Without a `storageAdapter`, "seen" state lasts until the app restarts. Pass any storage with `getItem` / `setItem`:
|
|
104
154
|
|
|
105
155
|
```tsx
|
|
106
156
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
107
157
|
|
|
108
|
-
<
|
|
158
|
+
<TourProvider tours={TOURS} storageAdapter={AsyncStorage}>
|
|
109
159
|
```
|
|
110
160
|
|
|
111
161
|
```tsx
|
|
112
|
-
import {
|
|
162
|
+
import { createMMKV } from 'react-native-mmkv'; // v4; on v3: `const mmkv = new MMKV()`
|
|
113
163
|
|
|
114
|
-
const mmkv =
|
|
164
|
+
const mmkv = createMMKV();
|
|
115
165
|
const mmkvAdapter = {
|
|
116
166
|
getItem: (key: string) => mmkv.getString(key) ?? null,
|
|
117
167
|
setItem: (key: string, value: string) => mmkv.set(key, value),
|
|
118
168
|
};
|
|
119
169
|
|
|
120
|
-
<
|
|
170
|
+
<TourProvider tours={TOURS} storageAdapter={mmkvAdapter}>
|
|
121
171
|
```
|
|
122
172
|
|
|
123
173
|
Storage is read once on mount. Calls to `startTour`, `resetTour` and `resetAll` made before it has loaded are queued and run once it has, so an already-seen tour is never shown by mistake.
|
|
124
174
|
|
|
175
|
+
### 8. Your Own Tooltip Card (Optional)
|
|
176
|
+
Render the card with your design system and theme. It is placed beside the target for you (below by default, flipping above when there's no room), using its measured height.
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
import type { TourTooltipProps } from 'rn-smart-tour';
|
|
180
|
+
|
|
181
|
+
const TourCard = ({ step, stepIndex, stepCount, isFirstStep, isLastStep, next, prev, skip }: TourTooltipProps) => (
|
|
182
|
+
<Card>
|
|
183
|
+
<Title>{step.title}</Title>
|
|
184
|
+
<Body>{step.description}</Body>
|
|
185
|
+
<Row>
|
|
186
|
+
{!isLastStep && <Button title="Skip" onPress={skip} />}
|
|
187
|
+
{!isFirstStep && <Button title="Back" onPress={prev} />}
|
|
188
|
+
<Button title={isLastStep ? 'Done' : `Next (${stepIndex + 1}/${stepCount})`} onPress={next} />
|
|
189
|
+
</Row>
|
|
190
|
+
</Card>
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
<TourProvider
|
|
194
|
+
tours={TOURS}
|
|
195
|
+
renderTooltip={props => <TourCard {...props} />}
|
|
196
|
+
tooltipWidth={320}
|
|
197
|
+
backdropColor="rgba(0, 0, 0, 0.6)">
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 9. "How do I…?" Walkthroughs (Optional)
|
|
201
|
+
A walkthrough guides the user through a task in the real app — they tap the real buttons and the walkthrough follows along. Start it from a help list instead of automatically.
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
const TOURS = {
|
|
205
|
+
applyLeave: {
|
|
206
|
+
id: 'applyLeave',
|
|
207
|
+
kind: 'walkthrough',
|
|
208
|
+
title: 'Apply for leave',
|
|
209
|
+
keywords: ['holiday', 'sick'],
|
|
210
|
+
canStart: ctx => (ctx.isOnline ? true : 'Connect to the internet to apply for leave'),
|
|
211
|
+
steps: [
|
|
212
|
+
{ title: "Let's apply for leave", description: 'It takes about a minute.' }, // no targetId: centred card
|
|
213
|
+
{ targetId: 'menu', title: 'Open the menu', description: '', advanceOn: 'press' },
|
|
214
|
+
{ targetId: 'leave', title: 'Tap Leave Management', description: '', advanceOn: 'press' },
|
|
215
|
+
{ targetId: 'apply', title: 'Tap Apply Leave', description: '', advanceOn: 'press' },
|
|
216
|
+
{ targetId: 'leaveType', title: 'Pick the leave type', description: '' }, // Next button
|
|
217
|
+
{ targetId: 'submit', title: 'Tap Submit Request', description: 'This sends a real request.', advanceOn: 'press' },
|
|
218
|
+
{ title: 'All done!', description: 'Track it under My Leave requests.' },
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
<TourProvider
|
|
224
|
+
tours={TOURS}
|
|
225
|
+
context={{ isOnline }} // what canStart / when check
|
|
226
|
+
onStartBlocked={(tour, reason) => Toast.show(reason)} // canStart said no
|
|
227
|
+
>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
- `advanceOn: 'press'` — the highlighted element stays tappable; the step moves on when the user taps it. The rest of the screen stays blocked.
|
|
231
|
+
- `advanceOn: { event: 'leaveTypeChosen' }` — moves on when the app calls `emit('leaveTypeChosen')` (from `useTour()` or a controller).
|
|
232
|
+
- `when: ctx => …` — shows a step only when it applies (e.g. managers only); step counts skip hidden steps.
|
|
233
|
+
- If the user leaves the path, a walkthrough **pauses** (instead of ending) and shows a "Resume" chip (`renderResumeChip` to draw your own). Resuming continues from the latest step whose element is on screen, so the user is guided back.
|
|
234
|
+
|
|
235
|
+
List walkthroughs for a help screen with `useTourCatalog`:
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
const tasks = useTourCatalog({ kind: 'walkthrough', query: searchText });
|
|
239
|
+
// [{ id: 'applyLeave', title: 'Apply for leave', kind: 'walkthrough' }, …]
|
|
240
|
+
const { startTour } = useTour();
|
|
241
|
+
<Button title={task.title} onPress={() => startTour(task.id, { force: true })} />
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 10. Start Tours from Outside React (Optional)
|
|
245
|
+
For deep links or notification handlers, create a controller and pass it to the provider:
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
import { createTourController, TourProvider } from 'rn-smart-tour';
|
|
249
|
+
|
|
250
|
+
export const tours = createTourController({ tours: TOURS, storageAdapter: mmkvAdapter });
|
|
251
|
+
|
|
252
|
+
<TourProvider controller={tours}>…</TourProvider>
|
|
253
|
+
|
|
254
|
+
// anywhere:
|
|
255
|
+
tours.startTour('new-feature', { force: true });
|
|
256
|
+
```
|
|
257
|
+
|
|
125
258
|
---
|
|
126
259
|
|
|
127
260
|
## 🧠 Technical Architecture
|
|
128
261
|
|
|
129
262
|
<details>
|
|
130
|
-
<summary><b>
|
|
263
|
+
<summary><b>How Measurement Works (Click to expand)</b></summary>
|
|
131
264
|
|
|
132
|
-
|
|
265
|
+
Targets only register a ref. When a step starts:
|
|
133
266
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
267
|
+
1. `beforeEnter` runs, if the step has one, and is awaited.
|
|
268
|
+
2. The engine waits for the target to be mounted inside an active scope.
|
|
269
|
+
3. If the target is in a `TourScrollable` and not fully visible, the list scrolls it to the middle.
|
|
270
|
+
4. The target is measured every frame until its position holds steady for 3 frames, then the step is shown.
|
|
137
271
|
|
|
138
|
-
|
|
272
|
+
While a step is shown, its target is measured again when its layout changes, the window resizes, the keyboard opens or closes, or the app returns to the foreground. Positions that change by **1pt** or less are ignored.
|
|
139
273
|
|
|
140
274
|
</details>
|
|
141
275
|
|
|
142
276
|
<details>
|
|
143
277
|
<summary><b>Auto-Start & Debounce Settings</b></summary>
|
|
144
278
|
|
|
145
|
-
When `autoStart: true` is enabled, the
|
|
279
|
+
When `autoStart: true` is enabled, the tour starts **300ms** after its first target is registered in an active scope, so the rest of the screen can mount first.
|
|
146
280
|
|
|
147
281
|
A tour that is stopped (finished, skipped, or ended because a target was missing) is not auto-started again in the same app session. `startTour` still works, and `resetTour` makes it eligible again.
|
|
148
282
|
|
|
@@ -152,8 +286,9 @@ A tour that is stopped (finished, skipped, or ended because a target was missing
|
|
|
152
286
|
<summary><b>Tour Lifecycle Rules</b></summary>
|
|
153
287
|
|
|
154
288
|
- **Skip**, **Finish** and the **Android back button** end the tour and mark it as seen.
|
|
155
|
-
- If a step's target is not on screen within `missingTargetTimeoutMs` (default **3000ms
|
|
156
|
-
-
|
|
289
|
+
- If a step's target is not on screen within `missingTargetTimeoutMs` (default **3000ms**, or the step's `targetTimeoutMs`), the tour ends **without** being marked as seen, or moves to the next step with `onMissingTarget: 'skip'`. A warning is logged in development.
|
|
290
|
+
- If the target of the step being shown disappears (unmounts, or its screen loses focus), the step is hidden until it comes back, within the same timeout.
|
|
291
|
+
- While moving to the next step, the current one stays on screen until the next target is measured, and extra taps on **Next** are ignored.
|
|
157
292
|
|
|
158
293
|
</details>
|
|
159
294
|
|
|
@@ -161,53 +296,93 @@ A tour that is stopped (finished, skipped, or ended because a target was missing
|
|
|
161
296
|
|
|
162
297
|
## 🛠 API Reference
|
|
163
298
|
|
|
164
|
-
###
|
|
299
|
+
### TourProvider
|
|
165
300
|
| Property | Type | Default | Description |
|
|
166
301
|
|:---|:---|:---|:---|
|
|
167
302
|
| `tours` | `Record<string, Tour>` | — | All tours, keyed by id. |
|
|
168
303
|
| `storageAdapter` | `StorageAdapter` | — | Persists seen tours (AsyncStorage, MMKV, …). Read once on mount. |
|
|
169
|
-
| `missingTargetTimeoutMs` | `number` | `3000` | How long a step waits for its target
|
|
304
|
+
| `missingTargetTimeoutMs` | `number` | `3000` | How long a step waits for its target. |
|
|
305
|
+
| `controller` | `TourController` | — | From `createTourController`, instead of `tours` / `storageAdapter`. |
|
|
306
|
+
| `renderTooltip` | `(props: TourTooltipProps) => ReactNode` | built-in card | Draws the tooltip card. Receives the step, its index and count, and `next` / `prev` / `skip`. |
|
|
307
|
+
| `tooltipWidth` | `number` | `280` | Card width (capped to the screen). |
|
|
308
|
+
| `backdropColor` | `string` | `'rgba(0, 0, 0, 0.6)'` | Color of the dimmed area around the target. |
|
|
309
|
+
| `presentation` | `'root' \| 'modal'` | `'root'` | `'root'` draws the overlay as a layer over the app; the app's own modals open above it. `'modal'` uses a React Native `Modal` (only for tours inside another Modal). |
|
|
310
|
+
| `supportedOrientations` | `ModalProps['supportedOrientations']` | all | With `presentation="modal"`: iOS orientations the overlay allows (still limited by Info.plist). |
|
|
311
|
+
| `context` | `Record<string, unknown>` | `{}` | App state that `canStart` and step `when` receive. |
|
|
312
|
+
| `onStartBlocked` | `(tour, reason) => void` | — | A tour's `canStart` refused a `startTour` call; show `reason` to the user. |
|
|
313
|
+
| `renderResumeChip` | `(props: ResumeChipProps) => ReactNode` | built-in chip | Draws the "Resume" chip shown while a tour is paused (`tour`, `resume`, `dismiss`). |
|
|
314
|
+
| `highlightColor` | `string` | `'#FFFFFF'` | Ring around an element the user should tap. |
|
|
170
315
|
|
|
171
316
|
### Tour Configuration
|
|
172
317
|
| Property | Type | Description |
|
|
173
318
|
|:---|:---|:---|
|
|
174
319
|
| `id` | `string` | Unique identifier for caching. |
|
|
175
|
-
| `autoStart` | `boolean` |
|
|
320
|
+
| `autoStart` | `boolean` | Start the first time the first step with a target appears. |
|
|
176
321
|
| `steps` | `TourStep[]` | Sequence of highlight steps. |
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
| Property | Type | Description |
|
|
181
|
-
|:---|:---|:---|
|
|
182
|
-
| `children` | `React.Node` | Components to scroll. |
|
|
183
|
-
| `...props` | `ScrollViewProps` | Standard props are forwarded to the native ScrollView. |
|
|
184
|
-
|
|
185
|
-
### DapTarget
|
|
186
|
-
| Property | Type | Description |
|
|
187
|
-
|:---|:---|:---|
|
|
188
|
-
| `name` | `string` | Unique identifier that matches a `targetId` in a tour step. |
|
|
189
|
-
| `children` | `ReactElement` | The UI element to wrap and highlight. |
|
|
190
|
-
| `...props` | `ViewProps` | All standard React Native `View` props are forwarded. |
|
|
322
|
+
| `kind` | `'tour' \| 'walkthrough'` | Walkthroughs pause on a missing target and say "Exit". Default `'tour'`. |
|
|
323
|
+
| `title` / `description` / `keywords` | `string` / `string` / `string[]` | Shown and searched by `useTourCatalog`. |
|
|
324
|
+
| `canStart` | `(context) => boolean \| string` | Return `true`, or a reason the tour can't start. |
|
|
191
325
|
|
|
192
326
|
### TourStep
|
|
193
327
|
| Property | Type | Default | Description |
|
|
194
328
|
|:---|:---|:---|:---|
|
|
195
|
-
| `targetId` | `string` | — | Matches the `name` prop
|
|
329
|
+
| `targetId` | `string` | — | Matches the `name` prop of a `<TourTarget>`. Leave out for a centred card. |
|
|
196
330
|
| `title` | `string` | — | Tooltip header. |
|
|
197
331
|
| `description` | `string` | — | Tooltip body. |
|
|
198
332
|
| `position` | `string` | `'bottom'` | `top`, `bottom`, `left`, `right`. |
|
|
333
|
+
| `beforeEnter` | `() => void \| Promise<void>` | — | Runs (and is awaited) before the step looks for its target. |
|
|
334
|
+
| `advanceOn` | `'next' \| 'press' \| { event }` | `'next'` | How the step moves on: Next button, a tap on the element, or an app event. |
|
|
335
|
+
| `when` | `(context) => boolean` | — | Show the step only when this returns true. |
|
|
336
|
+
| `onMissingTarget` | `'end' \| 'skip' \| 'pause'` | `'end'` (`'pause'` for walkthroughs) | What happens if the target isn't found in time. |
|
|
337
|
+
| `targetTimeoutMs` | `number` | provider's | Per-step override of `missingTargetTimeoutMs`. |
|
|
199
338
|
|
|
200
|
-
###
|
|
201
|
-
|
|
|
339
|
+
### TourTarget
|
|
340
|
+
| Property | Type | Description |
|
|
341
|
+
|:---|:---|:---|
|
|
342
|
+
| `name` | `string` | Matches a `targetId` in a tour step. |
|
|
343
|
+
| `children` | `ReactNode` | The UI element to wrap and highlight. |
|
|
344
|
+
| `...props` | `ViewProps` | All standard React Native `View` props are forwarded. |
|
|
345
|
+
|
|
346
|
+
### TourScope / NavigationTourScope
|
|
347
|
+
| Component | Props | Description |
|
|
348
|
+
|:---|:---|:---|
|
|
349
|
+
| `TourScope` | `active?: boolean` (default `true`) | Targets inside only count while `active` (and every parent scope is active). |
|
|
350
|
+
| `NavigationTourScope` | — | From `rn-smart-tour/react-navigation`. Active while the screen is focused and not animating. |
|
|
351
|
+
|
|
352
|
+
### TourScrollable / TourScrollView
|
|
353
|
+
| Component | Props | Description |
|
|
354
|
+
|:---|:---|:---|
|
|
355
|
+
| `TourScrollable` | `scrollRef`, `horizontal?` | Lets tours scroll targets inside the referenced `ScrollView` / `FlatList` / `SectionList`. |
|
|
356
|
+
| `TourScrollView` | `ScrollViewProps` | A `ScrollView` already wrapped in `TourScrollable`. A `ref` is forwarded. |
|
|
357
|
+
|
|
358
|
+
### `useTour()` Hook
|
|
359
|
+
| Member | Description |
|
|
202
360
|
|:---|:---|
|
|
203
361
|
| `startTour(id, options?)` | Start a tour by ID. Does nothing if it was already seen, unless `{ force: true }`. |
|
|
204
362
|
| `stopTour(markAsSeen?)`| End tour. Pass `false` to keep it unread. |
|
|
205
363
|
| `nextStep()` / `prevStep()` | Manual step navigation. |
|
|
206
364
|
| `resetTour(id)` | Mark a tour as unseen so it can show (and auto-start) again. |
|
|
207
365
|
| `resetAll()` | Mark every tour as unseen. |
|
|
366
|
+
| `status` | `'idle'`, `'waiting'` (looking for the step's target), `'active'` or `'paused'`. |
|
|
208
367
|
| `activeTour` | Current active tour object. |
|
|
209
368
|
| `currentStepIndex` | Current step number (0-indexed). |
|
|
210
369
|
| `seenTours` | `Record<string, boolean>` of tours already seen. |
|
|
370
|
+
| `emit(event)` | Report an app event, for steps with `advanceOn: { event }`. |
|
|
371
|
+
| `pauseTour()` / `resumeTour()` | Put the running tour on hold / continue it. |
|
|
372
|
+
|
|
373
|
+
`useTourState(selector)` subscribes to any slice of the tour state and re-renders only when it changes.
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## ⬆️ Upgrading from 1.x
|
|
378
|
+
|
|
379
|
+
The 1.x names still work and are deprecated: `DapProvider` → `TourProvider`, `DapTarget` → `TourTarget`, `DapScrollView` → `TourScrollView`, `useDap` → `useTour`. Seen tours stored by 1.x are kept.
|
|
380
|
+
|
|
381
|
+
Behaviour changes:
|
|
382
|
+
- React ≥ 18 and React Native ≥ 0.73 are required.
|
|
383
|
+
- A step appears a few frames after it starts (once its target has stopped moving), not immediately.
|
|
384
|
+
- `useDap().targets` only contains the measurement of the step being shown, and `requestScroll` does nothing; scrolling is automatic.
|
|
385
|
+
- Wrap screens in `NavigationTourScope` (or `TourScope`) to stop targets on background screens from being used.
|
|
211
386
|
|
|
212
387
|
---
|
|
213
388
|
|
|
@@ -219,9 +394,10 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
219
394
|
npm install
|
|
220
395
|
npm run typecheck && npm run lint && npm test # what CI runs
|
|
221
396
|
npm run build # outputs lib/ (CommonJS, ES modules, types)
|
|
397
|
+
npm publish --tag next # prereleases (betas); `npm publish` for stable versions
|
|
222
398
|
```
|
|
223
399
|
|
|
224
|
-
The `example/` app loads the library straight from `src/`, so changes show up without a build:
|
|
400
|
+
The `example/` app (React Native 0.88, React Navigation) loads the library straight from `src/`, so changes show up without a build:
|
|
225
401
|
|
|
226
402
|
```sh
|
|
227
403
|
cd example && npm install
|
|
@@ -233,4 +409,4 @@ npm run ios # or: npm run android
|
|
|
233
409
|
|
|
234
410
|
<p align="center">
|
|
235
411
|
<b>rn-smart-tour</b> • Built with ❤️ for the React Native community.
|
|
236
|
-
</p>
|
|
412
|
+
</p>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DapTarget = exports.DapScrollView = exports.DapProvider = void 0;
|
|
7
|
+
exports.useDap = useDap;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _context = require("./react/context.js");
|
|
10
|
+
var _hooks = require("./react/hooks.js");
|
|
11
|
+
var _TourProvider = require("./react/TourProvider.js");
|
|
12
|
+
var _TourScrollable = require("./react/TourScrollable.js");
|
|
13
|
+
var _TourTarget = require("./react/TourTarget.js");
|
|
14
|
+
/**
|
|
15
|
+
* The 1.x API (`Dap*` names and `useDap`), kept so existing apps keep working.
|
|
16
|
+
* New code should use `TourProvider`, `TourTarget`, `TourScrollView` and `useTour`.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** @deprecated Use `TourProvider`. */
|
|
20
|
+
const DapProvider = exports.DapProvider = _TourProvider.TourProvider;
|
|
21
|
+
/** @deprecated Use `TourProviderProps`. */
|
|
22
|
+
|
|
23
|
+
/** @deprecated Use `TourTarget`. */
|
|
24
|
+
const DapTarget = exports.DapTarget = _TourTarget.TourTarget;
|
|
25
|
+
/** @deprecated Use `TourScrollView`. */
|
|
26
|
+
const DapScrollView = exports.DapScrollView = _TourScrollable.TourScrollView;
|
|
27
|
+
/**
|
|
28
|
+
* 1.x `registerTarget` / `unregisterTarget`, created once per engine: callers
|
|
29
|
+
* register from effects, so the functions must keep the same identity across renders.
|
|
30
|
+
*/
|
|
31
|
+
const legacyRegistries = new WeakMap();
|
|
32
|
+
function getLegacyRegistry(engine) {
|
|
33
|
+
let registry = legacyRegistries.get(engine);
|
|
34
|
+
if (!registry) {
|
|
35
|
+
const registrations = new Map();
|
|
36
|
+
const unregisterTarget = id => {
|
|
37
|
+
registrations.get(id)?.();
|
|
38
|
+
registrations.delete(id);
|
|
39
|
+
};
|
|
40
|
+
const registerTarget = (id, measurement, ref) => {
|
|
41
|
+
unregisterTarget(id);
|
|
42
|
+
// Without a ref, report the given measurement whenever the engine measures.
|
|
43
|
+
const measurable = ref ?? {
|
|
44
|
+
measureInWindow: cb => cb(measurement.x, measurement.y, measurement.width, measurement.height)
|
|
45
|
+
};
|
|
46
|
+
registrations.set(id, engine.registerTarget(id, {
|
|
47
|
+
ref: {
|
|
48
|
+
current: measurable
|
|
49
|
+
},
|
|
50
|
+
scope: null,
|
|
51
|
+
scrollable: null
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
registry = {
|
|
55
|
+
registerTarget,
|
|
56
|
+
unregisterTarget
|
|
57
|
+
};
|
|
58
|
+
legacyRegistries.set(engine, registry);
|
|
59
|
+
}
|
|
60
|
+
return registry;
|
|
61
|
+
}
|
|
62
|
+
const noop = () => {};
|
|
63
|
+
|
|
64
|
+
/** @deprecated Use `useTour`. */
|
|
65
|
+
function useDap() {
|
|
66
|
+
const engine = (0, _react.useContext)(_context.TourEngineContext);
|
|
67
|
+
if (!engine) {
|
|
68
|
+
throw new Error('useDap must be used within a DapProvider');
|
|
69
|
+
}
|
|
70
|
+
const api = (0, _hooks.useTour)();
|
|
71
|
+
// 1.x consumers re-rendered on every measurement and could read `targets`.
|
|
72
|
+
const presented = (0, _hooks.useTourState)(state => state.presented);
|
|
73
|
+
return (0, _react.useMemo)(() => {
|
|
74
|
+
const presentedStep = presented && engine.getTour(presented.tourId)?.steps[presented.stepIndex];
|
|
75
|
+
return {
|
|
76
|
+
...api,
|
|
77
|
+
...getLegacyRegistry(engine),
|
|
78
|
+
targets: presented?.rect && presentedStep?.targetId ? {
|
|
79
|
+
[presentedStep.targetId]: presented.rect
|
|
80
|
+
} : {},
|
|
81
|
+
requestScroll: noop,
|
|
82
|
+
_registerScrollRef: noop,
|
|
83
|
+
_unregisterScrollRef: noop
|
|
84
|
+
};
|
|
85
|
+
}, [engine, api, presented]);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_context","_hooks","_TourProvider","_TourScrollable","_TourTarget","DapProvider","exports","TourProvider","DapTarget","TourTarget","DapScrollView","TourScrollView","legacyRegistries","WeakMap","getLegacyRegistry","engine","registry","get","registrations","Map","unregisterTarget","id","delete","registerTarget","measurement","ref","measurable","measureInWindow","cb","x","y","width","height","set","current","scope","scrollable","noop","useDap","useContext","TourEngineContext","Error","api","useTour","presented","useTourState","state","useMemo","presentedStep","getTour","tourId","steps","stepIndex","targets","rect","targetId","requestScroll","_registerScrollRef","_unregisterScrollRef"],"sourceRoot":"../../src","sources":["compat.ts"],"mappings":"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","ignoreList":[]}
|