be-components 6.5.3 → 6.5.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/lib/commonjs/Guide/index.js +119 -90
- package/lib/commonjs/Guide/index.js.map +1 -1
- package/lib/module/Guide/index.js +120 -91
- package/lib/module/Guide/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Guide/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Guide/index.d.ts +1 -1
- package/lib/typescript/lib/module/Guide/index.d.ts.map +1 -1
- package/lib/typescript/src/Guide/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Guide/index.tsx +194 -126
|
@@ -16,71 +16,100 @@ function GuideWrapper({
|
|
|
16
16
|
}) {
|
|
17
17
|
const Colors = (0, _useColors.useColors)();
|
|
18
18
|
const wrapper_guid = guide ?? {};
|
|
19
|
+
const [tooltip_height, setTooltipHeight] = (0, _react.useState)(0);
|
|
19
20
|
const {
|
|
20
21
|
tour,
|
|
21
22
|
active,
|
|
22
23
|
onComplete
|
|
23
24
|
} = wrapper_guid;
|
|
24
25
|
const refs = (0, _react.useRef)({});
|
|
26
|
+
const containerRef = (0, _react.useRef)(null);
|
|
25
27
|
const [currentStep, setCurrentStep] = (0, _react.useState)(0);
|
|
26
28
|
const [layout, setLayout] = (0, _react.useState)(null);
|
|
27
|
-
const [
|
|
28
|
-
height: 0,
|
|
29
|
-
width: 0,
|
|
29
|
+
const [containerLayout, setContainerLayout] = (0, _react.useState)({
|
|
30
30
|
x: 0,
|
|
31
|
-
y: 0
|
|
31
|
+
y: 0,
|
|
32
|
+
width: 0,
|
|
33
|
+
height: 0
|
|
32
34
|
});
|
|
33
35
|
const {
|
|
34
|
-
width
|
|
36
|
+
width: screenWidth
|
|
35
37
|
} = (0, _reactNative.useWindowDimensions)();
|
|
36
|
-
//Check if it is negative
|
|
37
|
-
const MIN_WIDTH = 300;
|
|
38
|
-
let right = false;
|
|
39
|
-
if (layout) {
|
|
40
|
-
let right_side = layout.x + MIN_WIDTH;
|
|
41
|
-
if (right_side > container_layout.width) {
|
|
42
|
-
right = true;
|
|
43
|
-
}
|
|
44
|
-
//Check if it goes over the bottom
|
|
45
|
-
}
|
|
46
38
|
const sortedTour = tour ? [...tour].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0)) : [];
|
|
47
39
|
const step = sortedTour[currentStep];
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
// Measure the current step element
|
|
51
|
-
|
|
52
|
-
if (!
|
|
40
|
+
const stepRef = step ? refs.current[step.nativeID] : undefined;
|
|
41
|
+
console.log(Object.keys(refs.current));
|
|
42
|
+
// Measure the current step element relative to container
|
|
43
|
+
const measureStep = () => {
|
|
44
|
+
if (!stepRef || !containerRef.current) return;
|
|
53
45
|
if (_reactNative.Platform.OS === "web") {
|
|
54
|
-
const
|
|
46
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
47
|
+
const rect = stepRef.getBoundingClientRect();
|
|
55
48
|
setLayout({
|
|
56
|
-
x: rect.left -
|
|
57
|
-
y: rect.top -
|
|
49
|
+
x: rect.left - containerRect.left,
|
|
50
|
+
y: rect.top - containerRect.top,
|
|
58
51
|
width: rect.width,
|
|
59
52
|
height: rect.height
|
|
60
53
|
});
|
|
61
|
-
} else
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
} else {
|
|
55
|
+
const handle = (0, _reactNative.findNodeHandle)(stepRef);
|
|
56
|
+
const containerHandle = (0, _reactNative.findNodeHandle)(containerRef.current);
|
|
57
|
+
if (!handle || !containerHandle) return;
|
|
58
|
+
_reactNative.UIManager.measureLayout(handle, containerHandle, () => console.log("measureLayout failed"), (x, y, width, height) => setLayout({
|
|
59
|
+
x,
|
|
60
|
+
y,
|
|
61
|
+
width,
|
|
62
|
+
height
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Re-measure on active, currentStep, or container layout changes
|
|
68
|
+
(0, _react.useEffect)(() => {
|
|
69
|
+
if (!active || !step) return;
|
|
70
|
+
|
|
71
|
+
// Timeout ensures element is mounted
|
|
72
|
+
setTimeout(() => measureStep(), 0);
|
|
73
|
+
}, [active, currentStep, step, containerLayout]);
|
|
74
|
+
|
|
75
|
+
// Re-measure on web resize
|
|
76
|
+
(0, _react.useEffect)(() => {
|
|
77
|
+
if (_reactNative.Platform.OS === "web") {
|
|
78
|
+
const handleResize = () => measureStep();
|
|
79
|
+
window.addEventListener("resize", handleResize);
|
|
80
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
70
81
|
}
|
|
71
|
-
|
|
82
|
+
return;
|
|
83
|
+
}, [currentStep, step]);
|
|
84
|
+
const isTouchable = child => {
|
|
85
|
+
const typeName = child.type?.displayName || child.type;
|
|
86
|
+
return child.type === _reactNative.TouchableOpacity || child.type === _reactNative.TouchableHighlight || child.type === _reactNative.TouchableWithoutFeedback || typeof typeName === "string" && typeName.startsWith("Touchable");
|
|
87
|
+
};
|
|
72
88
|
|
|
73
|
-
// Recursively attach refs to children with nativeID
|
|
89
|
+
// Recursively attach refs to children with nativeID (only native elements)
|
|
74
90
|
const attachRefs = nodes => {
|
|
75
91
|
return _react.default.Children.map(nodes, child => {
|
|
76
92
|
if (! /*#__PURE__*/_react.default.isValidElement(child)) return child;
|
|
77
|
-
const props = child.props
|
|
93
|
+
const props = child.props;
|
|
78
94
|
const nativeID = props.nativeID;
|
|
79
95
|
const newChildren = props.children ? attachRefs(props.children) : props.children;
|
|
80
96
|
if (nativeID) {
|
|
97
|
+
// Wrap touchables in a View to get a proper measure if needed
|
|
98
|
+
if (isTouchable(child)) {
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
100
|
+
ref: r => {
|
|
101
|
+
if (r) refs.current[nativeID] = r;
|
|
102
|
+
},
|
|
103
|
+
style: {
|
|
104
|
+
flex: 0
|
|
105
|
+
}
|
|
106
|
+
}, /*#__PURE__*/_react.default.cloneElement(child, {
|
|
107
|
+
children: newChildren
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
81
110
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
82
|
-
ref:
|
|
83
|
-
if (
|
|
111
|
+
ref: r => {
|
|
112
|
+
if (r) refs.current[nativeID] = r;
|
|
84
113
|
},
|
|
85
114
|
children: newChildren
|
|
86
115
|
});
|
|
@@ -92,8 +121,6 @@ function GuideWrapper({
|
|
|
92
121
|
return child;
|
|
93
122
|
});
|
|
94
123
|
};
|
|
95
|
-
if (!tour || !active) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
96
|
-
if (!step) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, attachRefs(children));
|
|
97
124
|
const handleNext = () => {
|
|
98
125
|
if (currentStep + 1 < sortedTour.length) {
|
|
99
126
|
setCurrentStep(currentStep + 1);
|
|
@@ -104,114 +131,116 @@ function GuideWrapper({
|
|
|
104
131
|
const handlePrev = () => {
|
|
105
132
|
if (currentStep > 0) setCurrentStep(currentStep - 1);
|
|
106
133
|
};
|
|
107
|
-
if (!
|
|
134
|
+
if (!tour) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
135
|
+
if (!layout || !active || !step) return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
136
|
+
ref: containerRef
|
|
137
|
+
}, attachRefs(children));
|
|
138
|
+
const MIN_WIDTH = 300;
|
|
139
|
+
const right = layout.x + MIN_WIDTH > containerLayout.width;
|
|
108
140
|
const isLastStep = currentStep === sortedTour.length - 1;
|
|
109
141
|
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
110
|
-
|
|
111
|
-
flexGrow: 1
|
|
112
|
-
},
|
|
142
|
+
ref: containerRef,
|
|
113
143
|
onLayout: ev => {
|
|
114
144
|
const l = ev.nativeEvent.layout;
|
|
115
145
|
setContainerLayout({
|
|
116
|
-
height: l.height,
|
|
117
|
-
width: l.width,
|
|
118
146
|
x: l.x,
|
|
119
|
-
y: l.y
|
|
147
|
+
y: l.y,
|
|
148
|
+
width: l.width,
|
|
149
|
+
height: l.height
|
|
120
150
|
});
|
|
151
|
+
},
|
|
152
|
+
style: {
|
|
153
|
+
flex: 1
|
|
121
154
|
}
|
|
122
155
|
}, attachRefs(children), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
123
156
|
transparent: true,
|
|
157
|
+
pointerEvents: "none",
|
|
124
158
|
style: {
|
|
125
|
-
position:
|
|
159
|
+
position: "absolute",
|
|
126
160
|
zIndex: 9999999,
|
|
127
161
|
borderWidth: 2,
|
|
128
162
|
borderColor: Colors.text.success,
|
|
129
163
|
borderRadius: 4,
|
|
130
164
|
top: layout.y - 5,
|
|
131
165
|
left: layout.x - 5,
|
|
132
|
-
width: layout.width +
|
|
166
|
+
width: layout.width + 10,
|
|
133
167
|
height: layout.height + 10
|
|
134
168
|
}
|
|
135
|
-
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
136
|
-
|
|
169
|
+
}), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
170
|
+
onLayout: ev => {
|
|
171
|
+
const {
|
|
172
|
+
height
|
|
173
|
+
} = ev.nativeEvent.layout;
|
|
174
|
+
setTooltipHeight(height);
|
|
175
|
+
},
|
|
137
176
|
style: {
|
|
138
|
-
position:
|
|
139
|
-
maxWidth:
|
|
177
|
+
position: "absolute",
|
|
178
|
+
maxWidth: screenWidth - 10,
|
|
140
179
|
minWidth: 300,
|
|
141
180
|
borderColor: Colors.text.success,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
181
|
+
borderWidth: 1,
|
|
182
|
+
borderRadius: 8,
|
|
183
|
+
padding: 10,
|
|
184
|
+
top: layout.y - tooltip_height - 10,
|
|
185
|
+
left: right ? undefined : layout.x,
|
|
186
|
+
right: right ? 5 : undefined,
|
|
187
|
+
zIndex: 9999999
|
|
145
188
|
}
|
|
146
|
-
}, step.title
|
|
147
|
-
type: "header",
|
|
189
|
+
}, step.title && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
148
190
|
style: {
|
|
149
|
-
flexDirection:
|
|
150
|
-
alignItems:
|
|
151
|
-
|
|
152
|
-
borderTopRightRadius: 8,
|
|
153
|
-
borderTopLeftRadius: 8
|
|
191
|
+
flexDirection: "row",
|
|
192
|
+
alignItems: "center",
|
|
193
|
+
marginBottom: 5
|
|
154
194
|
}
|
|
155
195
|
}, /*#__PURE__*/_react.default.createElement(_Components.Icons.AlertIcon, {
|
|
156
196
|
size: 14,
|
|
157
197
|
color: Colors.text.warning
|
|
158
|
-
}), /*#__PURE__*/_react.default.createElement(_Themed.
|
|
159
|
-
|
|
198
|
+
}), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
199
|
+
theme: "h1",
|
|
160
200
|
style: {
|
|
161
201
|
flex: 1,
|
|
162
202
|
marginLeft: 10,
|
|
163
|
-
marginRight: 10
|
|
164
|
-
borderLeftWidth: 1,
|
|
165
|
-
borderColor: Colors.borders.light
|
|
203
|
+
marginRight: 10
|
|
166
204
|
}
|
|
167
|
-
}, /*#__PURE__*/_react.default.createElement(_Themed.
|
|
168
|
-
theme: "h1"
|
|
169
|
-
}, step.title)), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
205
|
+
}, step.title), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
170
206
|
style: {
|
|
171
207
|
height: 30,
|
|
172
208
|
width: 30,
|
|
173
209
|
borderRadius: 100,
|
|
174
210
|
padding: 0,
|
|
175
|
-
justifyContent:
|
|
176
|
-
alignItems:
|
|
211
|
+
justifyContent: "center",
|
|
212
|
+
alignItems: "center"
|
|
177
213
|
},
|
|
178
214
|
title: "X",
|
|
179
215
|
type: "error",
|
|
180
|
-
onPress: () => onComplete ? onComplete(
|
|
181
|
-
}))
|
|
182
|
-
type: "body",
|
|
216
|
+
onPress: () => onComplete ? onComplete("cancelled") : null
|
|
217
|
+
})), step.body && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
183
218
|
style: {
|
|
184
|
-
|
|
219
|
+
paddingVertical: 5
|
|
185
220
|
}
|
|
186
221
|
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
187
222
|
theme: "h2"
|
|
188
|
-
}, step.body))
|
|
189
|
-
type: "footer",
|
|
223
|
+
}, step.body)), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
190
224
|
style: {
|
|
191
|
-
flexDirection:
|
|
192
|
-
alignItems:
|
|
193
|
-
|
|
194
|
-
borderBottomRightRadius: 8,
|
|
195
|
-
borderBottomLeftRadius: 8
|
|
225
|
+
flexDirection: "row",
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
marginTop: 5
|
|
196
228
|
}
|
|
197
229
|
}, currentStep > 0 && /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
198
230
|
type: "action",
|
|
199
231
|
onPress: handlePrev,
|
|
200
232
|
style: {
|
|
201
|
-
padding: 10,
|
|
202
233
|
flex: 1,
|
|
203
|
-
|
|
234
|
+
marginRight: 5
|
|
204
235
|
},
|
|
205
236
|
title: "BACK"
|
|
206
237
|
}), !step.clickable && /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
207
238
|
type: "success",
|
|
239
|
+
onPress: handleNext,
|
|
208
240
|
style: {
|
|
209
|
-
|
|
210
|
-
flex: 1,
|
|
211
|
-
margin: 2
|
|
241
|
+
flex: 1
|
|
212
242
|
},
|
|
213
|
-
onPress: handleNext,
|
|
214
243
|
title: isLastStep ? "Done" : "Next"
|
|
215
|
-
}))))
|
|
244
|
+
}))));
|
|
216
245
|
}
|
|
217
246
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_Themed","_useColors","_Components","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GuideWrapper","children","guide","Colors","useColors","wrapper_guid","tour","active","onComplete","refs","useRef","currentStep","setCurrentStep","useState","layout","setLayout","container_layout","setContainerLayout","height","width","x","y","useWindowDimensions","MIN_WIDTH","right","right_side","sortedTour","sort","a","b","priority","step","ref","current","nativeID","undefined","useEffect","Platform","OS","rect","getBoundingClientRect","left","top","measure","pageX","pageY","attachRefs","nodes","React","Children","map","child","isValidElement","props","newChildren","cloneElement","createElement","Fragment","handleNext","length","handlePrev","isLastStep","View","style","flexGrow","onLayout","ev","l","nativeEvent","transparent","position","zIndex","borderWidth","borderColor","text","success","borderRadius","float","maxWidth","minWidth","bottom","title","type","flexDirection","alignItems","padding","borderTopRightRadius","borderTopLeftRadius","Icons","AlertIcon","size","color","warning","flex","marginLeft","marginRight","borderLeftWidth","borders","light","Text","theme","Button","justifyContent","onPress","console","log","body","borderBottomRightRadius","borderBottomLeftRadius","margin","clickable"],"sourceRoot":"../../../src","sources":["Guide/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAsC,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAA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CACvC,CAEC,CACJ,CACJ,CACA,CAAC;AAEX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_Themed","_useColors","_Components","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GuideWrapper","children","guide","Colors","useColors","wrapper_guid","tooltip_height","setTooltipHeight","useState","tour","active","onComplete","refs","useRef","containerRef","currentStep","setCurrentStep","layout","setLayout","containerLayout","setContainerLayout","x","y","width","height","screenWidth","useWindowDimensions","sortedTour","sort","a","b","priority","step","stepRef","current","nativeID","undefined","console","log","keys","measureStep","Platform","OS","containerRect","getBoundingClientRect","rect","left","top","handle","findNodeHandle","containerHandle","UIManager","measureLayout","useEffect","setTimeout","handleResize","window","addEventListener","removeEventListener","isTouchable","child","typeName","type","displayName","TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback","startsWith","attachRefs","nodes","React","Children","map","isValidElement","props","newChildren","createElement","View","ref","style","flex","cloneElement","handleNext","length","handlePrev","Fragment","MIN_WIDTH","right","isLastStep","onLayout","ev","l","nativeEvent","transparent","pointerEvents","position","zIndex","borderWidth","borderColor","text","success","borderRadius","maxWidth","minWidth","padding","title","flexDirection","alignItems","marginBottom","Icons","AlertIcon","size","color","warning","Text","theme","marginLeft","marginRight","Button","justifyContent","onPress","body","paddingVertical","marginTop","clickable"],"sourceRoot":"../../../src","sources":["Guide/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAUA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAsC,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,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EAAEtC,UAAW;IAACH,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAE,CAAE;IAACyB,KAAK,EAAEjB,UAAU,GAAG,MAAM,GAAG;EAAO,CAAE,CAEpG,CACF,CACF,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
-
import { Platform, useWindowDimensions } from "react-native";
|
|
2
|
+
import { Platform, useWindowDimensions, UIManager, findNodeHandle, TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback } from "react-native";
|
|
3
3
|
import { Button, Text, View } from "../Components/Themed";
|
|
4
4
|
import { useColors } from "../constants/useColors";
|
|
5
5
|
import { Icons } from "../Components";
|
|
@@ -9,71 +9,100 @@ export default function GuideWrapper({
|
|
|
9
9
|
}) {
|
|
10
10
|
const Colors = useColors();
|
|
11
11
|
const wrapper_guid = guide ?? {};
|
|
12
|
+
const [tooltip_height, setTooltipHeight] = useState(0);
|
|
12
13
|
const {
|
|
13
14
|
tour,
|
|
14
15
|
active,
|
|
15
16
|
onComplete
|
|
16
17
|
} = wrapper_guid;
|
|
17
18
|
const refs = useRef({});
|
|
19
|
+
const containerRef = useRef(null);
|
|
18
20
|
const [currentStep, setCurrentStep] = useState(0);
|
|
19
21
|
const [layout, setLayout] = useState(null);
|
|
20
|
-
const [
|
|
21
|
-
height: 0,
|
|
22
|
-
width: 0,
|
|
22
|
+
const [containerLayout, setContainerLayout] = useState({
|
|
23
23
|
x: 0,
|
|
24
|
-
y: 0
|
|
24
|
+
y: 0,
|
|
25
|
+
width: 0,
|
|
26
|
+
height: 0
|
|
25
27
|
});
|
|
26
28
|
const {
|
|
27
|
-
width
|
|
29
|
+
width: screenWidth
|
|
28
30
|
} = useWindowDimensions();
|
|
29
|
-
//Check if it is negative
|
|
30
|
-
const MIN_WIDTH = 300;
|
|
31
|
-
let right = false;
|
|
32
|
-
if (layout) {
|
|
33
|
-
let right_side = layout.x + MIN_WIDTH;
|
|
34
|
-
if (right_side > container_layout.width) {
|
|
35
|
-
right = true;
|
|
36
|
-
}
|
|
37
|
-
//Check if it goes over the bottom
|
|
38
|
-
}
|
|
39
31
|
const sortedTour = tour ? [...tour].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0)) : [];
|
|
40
32
|
const step = sortedTour[currentStep];
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
// Measure the current step element
|
|
44
|
-
|
|
45
|
-
if (!
|
|
33
|
+
const stepRef = step ? refs.current[step.nativeID] : undefined;
|
|
34
|
+
console.log(Object.keys(refs.current));
|
|
35
|
+
// Measure the current step element relative to container
|
|
36
|
+
const measureStep = () => {
|
|
37
|
+
if (!stepRef || !containerRef.current) return;
|
|
46
38
|
if (Platform.OS === "web") {
|
|
47
|
-
const
|
|
39
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
40
|
+
const rect = stepRef.getBoundingClientRect();
|
|
48
41
|
setLayout({
|
|
49
|
-
x: rect.left -
|
|
50
|
-
y: rect.top -
|
|
42
|
+
x: rect.left - containerRect.left,
|
|
43
|
+
y: rect.top - containerRect.top,
|
|
51
44
|
width: rect.width,
|
|
52
45
|
height: rect.height
|
|
53
46
|
});
|
|
54
|
-
} else
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
} else {
|
|
48
|
+
const handle = findNodeHandle(stepRef);
|
|
49
|
+
const containerHandle = findNodeHandle(containerRef.current);
|
|
50
|
+
if (!handle || !containerHandle) return;
|
|
51
|
+
UIManager.measureLayout(handle, containerHandle, () => console.log("measureLayout failed"), (x, y, width, height) => setLayout({
|
|
52
|
+
x,
|
|
53
|
+
y,
|
|
54
|
+
width,
|
|
55
|
+
height
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Re-measure on active, currentStep, or container layout changes
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!active || !step) return;
|
|
63
|
+
|
|
64
|
+
// Timeout ensures element is mounted
|
|
65
|
+
setTimeout(() => measureStep(), 0);
|
|
66
|
+
}, [active, currentStep, step, containerLayout]);
|
|
67
|
+
|
|
68
|
+
// Re-measure on web resize
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (Platform.OS === "web") {
|
|
71
|
+
const handleResize = () => measureStep();
|
|
72
|
+
window.addEventListener("resize", handleResize);
|
|
73
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
63
74
|
}
|
|
64
|
-
|
|
75
|
+
return;
|
|
76
|
+
}, [currentStep, step]);
|
|
77
|
+
const isTouchable = child => {
|
|
78
|
+
const typeName = child.type?.displayName || child.type;
|
|
79
|
+
return child.type === TouchableOpacity || child.type === TouchableHighlight || child.type === TouchableWithoutFeedback || typeof typeName === "string" && typeName.startsWith("Touchable");
|
|
80
|
+
};
|
|
65
81
|
|
|
66
|
-
// Recursively attach refs to children with nativeID
|
|
82
|
+
// Recursively attach refs to children with nativeID (only native elements)
|
|
67
83
|
const attachRefs = nodes => {
|
|
68
84
|
return React.Children.map(nodes, child => {
|
|
69
85
|
if (! /*#__PURE__*/React.isValidElement(child)) return child;
|
|
70
|
-
const props = child.props
|
|
86
|
+
const props = child.props;
|
|
71
87
|
const nativeID = props.nativeID;
|
|
72
88
|
const newChildren = props.children ? attachRefs(props.children) : props.children;
|
|
73
89
|
if (nativeID) {
|
|
90
|
+
// Wrap touchables in a View to get a proper measure if needed
|
|
91
|
+
if (isTouchable(child)) {
|
|
92
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
93
|
+
ref: r => {
|
|
94
|
+
if (r) refs.current[nativeID] = r;
|
|
95
|
+
},
|
|
96
|
+
style: {
|
|
97
|
+
flex: 0
|
|
98
|
+
}
|
|
99
|
+
}, /*#__PURE__*/React.cloneElement(child, {
|
|
100
|
+
children: newChildren
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
74
103
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
75
|
-
ref:
|
|
76
|
-
if (
|
|
104
|
+
ref: r => {
|
|
105
|
+
if (r) refs.current[nativeID] = r;
|
|
77
106
|
},
|
|
78
107
|
children: newChildren
|
|
79
108
|
});
|
|
@@ -85,8 +114,6 @@ export default function GuideWrapper({
|
|
|
85
114
|
return child;
|
|
86
115
|
});
|
|
87
116
|
};
|
|
88
|
-
if (!tour || !active) return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
89
|
-
if (!step) return /*#__PURE__*/React.createElement(React.Fragment, null, attachRefs(children));
|
|
90
117
|
const handleNext = () => {
|
|
91
118
|
if (currentStep + 1 < sortedTour.length) {
|
|
92
119
|
setCurrentStep(currentStep + 1);
|
|
@@ -97,114 +124,116 @@ export default function GuideWrapper({
|
|
|
97
124
|
const handlePrev = () => {
|
|
98
125
|
if (currentStep > 0) setCurrentStep(currentStep - 1);
|
|
99
126
|
};
|
|
100
|
-
if (!
|
|
127
|
+
if (!tour) return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
128
|
+
if (!layout || !active || !step) return /*#__PURE__*/React.createElement(View, {
|
|
129
|
+
ref: containerRef
|
|
130
|
+
}, attachRefs(children));
|
|
131
|
+
const MIN_WIDTH = 300;
|
|
132
|
+
const right = layout.x + MIN_WIDTH > containerLayout.width;
|
|
101
133
|
const isLastStep = currentStep === sortedTour.length - 1;
|
|
102
134
|
return /*#__PURE__*/React.createElement(View, {
|
|
103
|
-
|
|
104
|
-
flexGrow: 1
|
|
105
|
-
},
|
|
135
|
+
ref: containerRef,
|
|
106
136
|
onLayout: ev => {
|
|
107
137
|
const l = ev.nativeEvent.layout;
|
|
108
138
|
setContainerLayout({
|
|
109
|
-
height: l.height,
|
|
110
|
-
width: l.width,
|
|
111
139
|
x: l.x,
|
|
112
|
-
y: l.y
|
|
140
|
+
y: l.y,
|
|
141
|
+
width: l.width,
|
|
142
|
+
height: l.height
|
|
113
143
|
});
|
|
144
|
+
},
|
|
145
|
+
style: {
|
|
146
|
+
flex: 1
|
|
114
147
|
}
|
|
115
148
|
}, attachRefs(children), /*#__PURE__*/React.createElement(View, {
|
|
116
149
|
transparent: true,
|
|
150
|
+
pointerEvents: "none",
|
|
117
151
|
style: {
|
|
118
|
-
position:
|
|
152
|
+
position: "absolute",
|
|
119
153
|
zIndex: 9999999,
|
|
120
154
|
borderWidth: 2,
|
|
121
155
|
borderColor: Colors.text.success,
|
|
122
156
|
borderRadius: 4,
|
|
123
157
|
top: layout.y - 5,
|
|
124
158
|
left: layout.x - 5,
|
|
125
|
-
width: layout.width +
|
|
159
|
+
width: layout.width + 10,
|
|
126
160
|
height: layout.height + 10
|
|
127
161
|
}
|
|
128
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
129
|
-
|
|
162
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
163
|
+
onLayout: ev => {
|
|
164
|
+
const {
|
|
165
|
+
height
|
|
166
|
+
} = ev.nativeEvent.layout;
|
|
167
|
+
setTooltipHeight(height);
|
|
168
|
+
},
|
|
130
169
|
style: {
|
|
131
|
-
position:
|
|
132
|
-
maxWidth:
|
|
170
|
+
position: "absolute",
|
|
171
|
+
maxWidth: screenWidth - 10,
|
|
133
172
|
minWidth: 300,
|
|
134
173
|
borderColor: Colors.text.success,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
174
|
+
borderWidth: 1,
|
|
175
|
+
borderRadius: 8,
|
|
176
|
+
padding: 10,
|
|
177
|
+
top: layout.y - tooltip_height - 10,
|
|
178
|
+
left: right ? undefined : layout.x,
|
|
179
|
+
right: right ? 5 : undefined,
|
|
180
|
+
zIndex: 9999999
|
|
138
181
|
}
|
|
139
|
-
}, step.title
|
|
140
|
-
type: "header",
|
|
182
|
+
}, step.title && /*#__PURE__*/React.createElement(View, {
|
|
141
183
|
style: {
|
|
142
|
-
flexDirection:
|
|
143
|
-
alignItems:
|
|
144
|
-
|
|
145
|
-
borderTopRightRadius: 8,
|
|
146
|
-
borderTopLeftRadius: 8
|
|
184
|
+
flexDirection: "row",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
marginBottom: 5
|
|
147
187
|
}
|
|
148
188
|
}, /*#__PURE__*/React.createElement(Icons.AlertIcon, {
|
|
149
189
|
size: 14,
|
|
150
190
|
color: Colors.text.warning
|
|
151
|
-
}), /*#__PURE__*/React.createElement(
|
|
152
|
-
|
|
191
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
192
|
+
theme: "h1",
|
|
153
193
|
style: {
|
|
154
194
|
flex: 1,
|
|
155
195
|
marginLeft: 10,
|
|
156
|
-
marginRight: 10
|
|
157
|
-
borderLeftWidth: 1,
|
|
158
|
-
borderColor: Colors.borders.light
|
|
196
|
+
marginRight: 10
|
|
159
197
|
}
|
|
160
|
-
}, /*#__PURE__*/React.createElement(
|
|
161
|
-
theme: "h1"
|
|
162
|
-
}, step.title)), /*#__PURE__*/React.createElement(Button, {
|
|
198
|
+
}, step.title), /*#__PURE__*/React.createElement(Button, {
|
|
163
199
|
style: {
|
|
164
200
|
height: 30,
|
|
165
201
|
width: 30,
|
|
166
202
|
borderRadius: 100,
|
|
167
203
|
padding: 0,
|
|
168
|
-
justifyContent:
|
|
169
|
-
alignItems:
|
|
204
|
+
justifyContent: "center",
|
|
205
|
+
alignItems: "center"
|
|
170
206
|
},
|
|
171
207
|
title: "X",
|
|
172
208
|
type: "error",
|
|
173
|
-
onPress: () => onComplete ? onComplete(
|
|
174
|
-
}))
|
|
175
|
-
type: "body",
|
|
209
|
+
onPress: () => onComplete ? onComplete("cancelled") : null
|
|
210
|
+
})), step.body && /*#__PURE__*/React.createElement(View, {
|
|
176
211
|
style: {
|
|
177
|
-
|
|
212
|
+
paddingVertical: 5
|
|
178
213
|
}
|
|
179
214
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
180
215
|
theme: "h2"
|
|
181
|
-
}, step.body))
|
|
182
|
-
type: "footer",
|
|
216
|
+
}, step.body)), /*#__PURE__*/React.createElement(View, {
|
|
183
217
|
style: {
|
|
184
|
-
flexDirection:
|
|
185
|
-
alignItems:
|
|
186
|
-
|
|
187
|
-
borderBottomRightRadius: 8,
|
|
188
|
-
borderBottomLeftRadius: 8
|
|
218
|
+
flexDirection: "row",
|
|
219
|
+
alignItems: "center",
|
|
220
|
+
marginTop: 5
|
|
189
221
|
}
|
|
190
222
|
}, currentStep > 0 && /*#__PURE__*/React.createElement(Button, {
|
|
191
223
|
type: "action",
|
|
192
224
|
onPress: handlePrev,
|
|
193
225
|
style: {
|
|
194
|
-
padding: 10,
|
|
195
226
|
flex: 1,
|
|
196
|
-
|
|
227
|
+
marginRight: 5
|
|
197
228
|
},
|
|
198
229
|
title: "BACK"
|
|
199
230
|
}), !step.clickable && /*#__PURE__*/React.createElement(Button, {
|
|
200
231
|
type: "success",
|
|
232
|
+
onPress: handleNext,
|
|
201
233
|
style: {
|
|
202
|
-
|
|
203
|
-
flex: 1,
|
|
204
|
-
margin: 2
|
|
234
|
+
flex: 1
|
|
205
235
|
},
|
|
206
|
-
onPress: handleNext,
|
|
207
236
|
title: isLastStep ? "Done" : "Next"
|
|
208
|
-
}))))
|
|
237
|
+
}))));
|
|
209
238
|
}
|
|
210
239
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRef","useState","useEffect","Platform","useWindowDimensions","Button","Text","View","useColors","Icons","GuideWrapper","children","guide","Colors","wrapper_guid","tour","active","onComplete","refs","currentStep","setCurrentStep","layout","setLayout","
|
|
1
|
+
{"version":3,"names":["React","useRef","useState","useEffect","Platform","useWindowDimensions","UIManager","findNodeHandle","TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback","Button","Text","View","useColors","Icons","GuideWrapper","children","guide","Colors","wrapper_guid","tooltip_height","setTooltipHeight","tour","active","onComplete","refs","containerRef","currentStep","setCurrentStep","layout","setLayout","containerLayout","setContainerLayout","x","y","width","height","screenWidth","sortedTour","sort","a","b","priority","step","stepRef","current","nativeID","undefined","console","log","Object","keys","measureStep","OS","containerRect","getBoundingClientRect","rect","left","top","handle","containerHandle","measureLayout","setTimeout","handleResize","window","addEventListener","removeEventListener","isTouchable","child","typeName","type","displayName","startsWith","attachRefs","nodes","Children","map","isValidElement","props","newChildren","createElement","ref","r","style","flex","cloneElement","handleNext","length","handlePrev","Fragment","MIN_WIDTH","right","isLastStep","onLayout","ev","l","nativeEvent","transparent","pointerEvents","position","zIndex","borderWidth","borderColor","text","success","borderRadius","maxWidth","minWidth","padding","title","flexDirection","alignItems","marginBottom","AlertIcon","size","color","warning","theme","marginLeft","marginRight","justifyContent","onPress","body","paddingVertical","marginTop","clickable"],"sourceRoot":"../../../src","sources":["Guide/index.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC1D,SACEC,QAAQ,EACRC,mBAAmB,EACnBC,SAAS,EACTC,cAAc,EACdC,gBAAgB,EAChBC,kBAAkB,EAClBC,wBAAwB,QACnB,cAAc;AAErB,SAASC,MAAM,EAAEC,IAAI,EAAEC,IAAI,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,KAAK,QAAQ,eAAe;AASrC,eAAe,SAASC,YAAYA,CAAC;EAAEC,QAAQ;EAAEC;AAAyB,CAAC,EAAE;EAC3E,MAAMC,MAAM,GAAGL,SAAS,CAAC,CAAC;EAC1B,MAAMM,YAAY,GAAGF,KAAK,IAAI,CAAC,CAAC;EAChC,MAAM,CAAEG,cAAc,EAAEC,gBAAgB,CAAE,GAAGpB,QAAQ,CAAC,CAAC,CAAC;EACxD,MAAM;IAAEqB,IAAI;IAAEC,MAAM;IAAEC;EAAW,CAAC,GAAGL,YAAY;EAEjD,MAAMM,IAAI,GAAGzB,MAAM,CAAyB,CAAC,CAAC,CAAC;EAC/C,MAAM0B,YAAY,GAAG1B,MAAM,CAAM,IAAI,CAAC;EAEtC,MAAM,CAAC2B,WAAW,EAAEC,cAA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,iBACR3H,KAAA,CAAAiF,aAAA,CAACpE,IAAI;IAACuE,KAAK,EAAE;MAAEwC,eAAe,EAAE;IAAE;EAAE,gBAClC5H,KAAA,CAAAiF,aAAA,CAACrE,IAAI;IAAC0G,KAAK,EAAC;EAAI,GAAE1E,IAAI,CAAC+E,IAAW,CAC9B,CACP,eAED3H,KAAA,CAAAiF,aAAA,CAACpE,IAAI;IAACuE,KAAK,EAAE;MAAE2B,aAAa,EAAE,KAAK;MAAEC,UAAU,EAAE,QAAQ;MAAEa,SAAS,EAAE;IAAE;EAAE,GACvEjG,WAAW,GAAG,CAAC,iBACd5B,KAAA,CAAAiF,aAAA,CAACtE,MAAM;IAAC4D,IAAI,EAAC,QAAQ;IAACmD,OAAO,EAAEjC,UAAW;IAACL,KAAK,EAAE;MAAEC,IAAI,EAAE,CAAC;MAAEmC,WAAW,EAAE;IAAE,CAAE;IAACV,KAAK,EAAC;EAAM,CAAE,CAC9F,EACA,CAAClE,IAAI,CAACkF,SAAS,iBACd9H,KAAA,CAAAiF,aAAA,CAACtE,MAAM;IAAC4D,IAAI,EAAC,SAAS;IAACmD,OAAO,EAAEnC,UAAW;IAACH,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAE,CAAE;IAACyB,KAAK,EAAEjB,UAAU,GAAG,MAAM,GAAG;EAAO,CAAE,CAEpG,CACF,CACF,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../commonjs/Guide/index.js"],"names":[],"mappings":";;AAYA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../commonjs/Guide/index.js"],"names":[],"mappings":";;AAYA;;;QAwOC"}
|
|
@@ -3,6 +3,6 @@ export default function GuideWrapper({ children, guide }: {
|
|
|
3
3
|
guide: any;
|
|
4
4
|
}): React.FunctionComponentElement<{
|
|
5
5
|
children?: React.ReactNode | undefined;
|
|
6
|
-
}> | React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement
|
|
6
|
+
}> | React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> | React.FunctionComponentElement<React.RefAttributes<any>>;
|
|
7
7
|
import React from "react";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../module/Guide/index.js"],"names":[],"mappings":"AAKA;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../module/Guide/index.js"],"names":[],"mappings":"AAKA;;;;;8JAwOC;kBA7OkD,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Guide/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Guide/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAU3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,iBAAiB,qBAiO1E"}
|
package/package.json
CHANGED
package/src/Guide/index.tsx
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
useWindowDimensions,
|
|
5
|
+
UIManager,
|
|
6
|
+
findNodeHandle,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
TouchableHighlight,
|
|
9
|
+
TouchableWithoutFeedback,
|
|
10
|
+
} from "react-native";
|
|
3
11
|
import type { GuideWrapProps } from "../types";
|
|
4
12
|
import { Button, Text, View } from "../Components/Themed";
|
|
5
13
|
import { useColors } from "../constants/useColors";
|
|
@@ -10,82 +18,127 @@ export type GuideWrapperProps = {
|
|
|
10
18
|
guide?: GuideWrapProps;
|
|
11
19
|
};
|
|
12
20
|
|
|
13
|
-
type Layout = { x: number; y: number;
|
|
21
|
+
type Layout = { x: number; y: number; width: number; height: number };
|
|
14
22
|
|
|
15
23
|
export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
|
|
16
|
-
|
|
24
|
+
const Colors = useColors();
|
|
17
25
|
const wrapper_guid = guide ?? {};
|
|
26
|
+
const [ tooltip_height, setTooltipHeight ] = useState(0);
|
|
18
27
|
const { tour, active, onComplete } = wrapper_guid;
|
|
28
|
+
|
|
19
29
|
const refs = useRef<{ [key: string]: any }>({});
|
|
30
|
+
const containerRef = useRef<any>(null);
|
|
31
|
+
|
|
20
32
|
const [currentStep, setCurrentStep] = useState(0);
|
|
21
33
|
const [layout, setLayout] = useState<Layout | null>(null);
|
|
22
|
-
const [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const [containerLayout, setContainerLayout] = useState<Layout>({
|
|
35
|
+
x: 0,
|
|
36
|
+
y: 0,
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 0,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const { width: screenWidth } = useWindowDimensions();
|
|
42
|
+
|
|
43
|
+
const sortedTour = tour
|
|
44
|
+
? [...tour].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0))
|
|
45
|
+
: [];
|
|
34
46
|
const step = sortedTour[currentStep];
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
const stepRef = step ? refs.current[step.nativeID] : undefined;
|
|
48
|
+
console.log(Object.keys(refs.current))
|
|
49
|
+
// Measure the current step element relative to container
|
|
50
|
+
const measureStep = () => {
|
|
51
|
+
if (!stepRef || !containerRef.current) return;
|
|
52
|
+
if (Platform.OS === "web") {
|
|
53
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
54
|
+
const rect = stepRef.getBoundingClientRect();
|
|
55
|
+
setLayout({
|
|
56
|
+
x: rect.left - containerRect.left,
|
|
57
|
+
y: rect.top - containerRect.top,
|
|
58
|
+
width: rect.width,
|
|
59
|
+
height: rect.height,
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
const handle = findNodeHandle(stepRef);
|
|
63
|
+
const containerHandle = findNodeHandle(containerRef.current);
|
|
64
|
+
if (!handle || !containerHandle) return;
|
|
65
|
+
|
|
66
|
+
UIManager.measureLayout(
|
|
67
|
+
handle,
|
|
68
|
+
containerHandle,
|
|
69
|
+
() => console.log("measureLayout failed"),
|
|
70
|
+
(x: number, y: number, width: number, height: number) =>
|
|
71
|
+
setLayout({ x, y, width, height })
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
37
75
|
|
|
38
|
-
|
|
76
|
+
// Re-measure on active, currentStep, or container layout changes
|
|
39
77
|
useEffect(() => {
|
|
40
|
-
if (!
|
|
78
|
+
if (!active || !step) return;
|
|
41
79
|
|
|
80
|
+
// Timeout ensures element is mounted
|
|
81
|
+
setTimeout(() => measureStep(), 0);
|
|
82
|
+
}, [active, currentStep, step, containerLayout]);
|
|
83
|
+
|
|
84
|
+
// Re-measure on web resize
|
|
85
|
+
useEffect(() => {
|
|
42
86
|
if (Platform.OS === "web") {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
y: rect.top - container_layout.y,
|
|
47
|
-
width: rect.width,
|
|
48
|
-
height: rect.height
|
|
49
|
-
});
|
|
50
|
-
} else if (ref && typeof ref.measure === "function") {
|
|
51
|
-
ref.measure(
|
|
52
|
-
(width: number, height: number, pageX: number, pageY: number) => {
|
|
53
|
-
setLayout({ x: pageX, y: pageY, width, height });
|
|
54
|
-
}
|
|
55
|
-
);
|
|
87
|
+
const handleResize = () => measureStep();
|
|
88
|
+
window.addEventListener("resize", handleResize);
|
|
89
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
56
90
|
}
|
|
57
|
-
|
|
91
|
+
return
|
|
92
|
+
}, [currentStep, step]);
|
|
58
93
|
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (nativeID) {
|
|
69
|
-
return React.cloneElement(child, {
|
|
70
|
-
ref: (ref: any) => {
|
|
71
|
-
if (ref) refs.current[nativeID] = ref;
|
|
72
|
-
},
|
|
73
|
-
children: newChildren,
|
|
74
|
-
} as any);
|
|
75
|
-
} else if (newChildren !== props.children) {
|
|
76
|
-
return React.cloneElement(child, { children: newChildren } as any);
|
|
77
|
-
}
|
|
94
|
+
const isTouchable = (child: any) => {
|
|
95
|
+
const typeName = (child.type as any)?.displayName || child.type;
|
|
96
|
+
return (
|
|
97
|
+
child.type === TouchableOpacity ||
|
|
98
|
+
child.type === TouchableHighlight ||
|
|
99
|
+
child.type === TouchableWithoutFeedback ||
|
|
100
|
+
(typeof typeName === "string" && typeName.startsWith("Touchable"))
|
|
101
|
+
);
|
|
102
|
+
};
|
|
78
103
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
104
|
+
// Recursively attach refs to children with nativeID (only native elements)
|
|
105
|
+
const attachRefs = (nodes: React.ReactNode): React.ReactNode => {
|
|
106
|
+
return React.Children.map(nodes, (child) => {
|
|
107
|
+
if (!React.isValidElement(child)) return child;
|
|
82
108
|
|
|
83
|
-
|
|
109
|
+
const props = child.props as { nativeID?: string; children?: React.ReactNode };
|
|
110
|
+
const nativeID = props.nativeID;
|
|
111
|
+
const newChildren = props.children ? attachRefs(props.children) : props.children;
|
|
84
112
|
|
|
85
|
-
if (!step) return <>{attachRefs(children)}</>;
|
|
86
113
|
|
|
114
|
+
if (nativeID) {
|
|
115
|
+
// Wrap touchables in a View to get a proper measure if needed
|
|
116
|
+
if (isTouchable(child)) {
|
|
117
|
+
return (
|
|
118
|
+
<View
|
|
119
|
+
ref={(r: any) => {
|
|
120
|
+
if (r) refs.current[nativeID] = r;
|
|
121
|
+
}}
|
|
122
|
+
style={{ flex: 0 }}
|
|
123
|
+
>
|
|
124
|
+
{React.cloneElement(child as React.ReactElement<any>, { children: newChildren } as any)}
|
|
125
|
+
</View>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
87
128
|
|
|
129
|
+
return React.cloneElement(child as React.ReactElement<any>, {
|
|
130
|
+
ref: (r: any) => {
|
|
131
|
+
if (r) refs.current[nativeID] = r;
|
|
132
|
+
},
|
|
133
|
+
children: newChildren,
|
|
134
|
+
} as any);
|
|
135
|
+
} else if (newChildren !== props.children) {
|
|
136
|
+
return React.cloneElement(child as React.ReactElement<any>, { children: newChildren } as any);
|
|
137
|
+
}
|
|
88
138
|
|
|
139
|
+
return child;
|
|
140
|
+
});
|
|
141
|
+
};
|
|
89
142
|
const handleNext = () => {
|
|
90
143
|
if (currentStep + 1 < sortedTour.length) {
|
|
91
144
|
setCurrentStep(currentStep + 1);
|
|
@@ -98,83 +151,98 @@ export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
|
|
|
98
151
|
if (currentStep > 0) setCurrentStep(currentStep - 1);
|
|
99
152
|
};
|
|
100
153
|
|
|
101
|
-
if (!
|
|
154
|
+
if (!tour) return <>{children}</>;
|
|
155
|
+
|
|
156
|
+
if (!layout || !active || !step)
|
|
157
|
+
return <View ref={containerRef}>{attachRefs(children)}</View>;
|
|
158
|
+
|
|
159
|
+
const MIN_WIDTH = 300;
|
|
160
|
+
const right = layout.x + MIN_WIDTH > containerLayout.width;
|
|
102
161
|
const isLastStep = currentStep === sortedTour.length - 1;
|
|
162
|
+
|
|
103
163
|
return (
|
|
104
|
-
<View
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
164
|
+
<View
|
|
165
|
+
ref={containerRef}
|
|
166
|
+
onLayout={(ev) => {
|
|
167
|
+
const l = ev.nativeEvent.layout;
|
|
168
|
+
setContainerLayout({
|
|
169
|
+
x: l.x,
|
|
170
|
+
y: l.y,
|
|
171
|
+
width: l.width,
|
|
172
|
+
height: l.height,
|
|
173
|
+
});
|
|
174
|
+
}}
|
|
175
|
+
style={{ flex: 1 }}
|
|
176
|
+
>
|
|
109
177
|
{attachRefs(children)}
|
|
110
|
-
|
|
111
|
-
{/* Highlight
|
|
178
|
+
|
|
179
|
+
{/* Highlight */}
|
|
112
180
|
<View
|
|
113
181
|
transparent
|
|
182
|
+
pointerEvents="none"
|
|
183
|
+
style={{
|
|
184
|
+
position: "absolute",
|
|
185
|
+
zIndex: 9999999,
|
|
186
|
+
borderWidth: 2,
|
|
187
|
+
borderColor: Colors.text.success,
|
|
188
|
+
borderRadius: 4,
|
|
189
|
+
top: layout.y - 5,
|
|
190
|
+
left: layout.x - 5,
|
|
191
|
+
width: layout.width + 10,
|
|
192
|
+
height: layout.height + 10,
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
|
|
196
|
+
{/* Tooltip */}
|
|
197
|
+
<View
|
|
198
|
+
onLayout={(ev) => {
|
|
199
|
+
const { height } = ev.nativeEvent.layout
|
|
200
|
+
setTooltipHeight(height)
|
|
201
|
+
}}
|
|
114
202
|
style={{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
203
|
+
position: "absolute",
|
|
204
|
+
maxWidth: screenWidth - 10,
|
|
205
|
+
minWidth: 300,
|
|
206
|
+
borderColor: Colors.text.success,
|
|
207
|
+
borderWidth: 1,
|
|
208
|
+
borderRadius: 8,
|
|
209
|
+
padding: 10,
|
|
210
|
+
top: layout.y - tooltip_height - 10,
|
|
211
|
+
left: right ? undefined : layout.x,
|
|
212
|
+
right: right ? 5 : undefined,
|
|
213
|
+
zIndex: 9999999,
|
|
214
|
+
}}
|
|
125
215
|
>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
{
|
|
153
|
-
|
|
154
|
-
<Text theme="h2">{step.body}</Text>
|
|
155
|
-
</View>
|
|
156
|
-
:<></>}
|
|
157
|
-
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
158
|
-
{currentStep > 0 && (
|
|
159
|
-
<Button
|
|
160
|
-
type='action'
|
|
161
|
-
onPress={handlePrev}
|
|
162
|
-
style={{ padding:10, flex:1, margin:2 }}
|
|
163
|
-
title="BACK"
|
|
164
|
-
/>
|
|
165
|
-
)}
|
|
166
|
-
{!step.clickable && (
|
|
167
|
-
<Button
|
|
168
|
-
type='success'
|
|
169
|
-
style={{ padding:10, flex:1, margin:2 }}
|
|
170
|
-
onPress={handleNext}
|
|
171
|
-
title={isLastStep ? "Done" : "Next"}
|
|
172
|
-
/>
|
|
173
|
-
)}
|
|
174
|
-
</View>
|
|
216
|
+
{step.title && (
|
|
217
|
+
<View style={{ flexDirection: "row", alignItems: "center", marginBottom: 5 }}>
|
|
218
|
+
<Icons.AlertIcon size={14} color={Colors.text.warning} />
|
|
219
|
+
<Text theme="h1" style={{ flex: 1, marginLeft: 10, marginRight: 10 }}>
|
|
220
|
+
{step.title}
|
|
221
|
+
</Text>
|
|
222
|
+
<Button
|
|
223
|
+
style={{ height: 30, width: 30, borderRadius: 100, padding: 0, justifyContent: "center", alignItems: "center" }}
|
|
224
|
+
title="X"
|
|
225
|
+
type="error"
|
|
226
|
+
onPress={() => (onComplete ? onComplete("cancelled") : null)}
|
|
227
|
+
/>
|
|
228
|
+
</View>
|
|
229
|
+
)}
|
|
230
|
+
|
|
231
|
+
{step.body && (
|
|
232
|
+
<View style={{ paddingVertical: 5 }}>
|
|
233
|
+
<Text theme="h2">{step.body}</Text>
|
|
234
|
+
</View>
|
|
235
|
+
)}
|
|
236
|
+
|
|
237
|
+
<View style={{ flexDirection: "row", alignItems: "center", marginTop: 5 }}>
|
|
238
|
+
{currentStep > 0 && (
|
|
239
|
+
<Button type="action" onPress={handlePrev} style={{ flex: 1, marginRight: 5 }} title="BACK" />
|
|
240
|
+
)}
|
|
241
|
+
{!step.clickable && (
|
|
242
|
+
<Button type="success" onPress={handleNext} style={{ flex: 1 }} title={isLastStep ? "Done" : "Next"} />
|
|
243
|
+
)}
|
|
175
244
|
</View>
|
|
176
|
-
|
|
245
|
+
</View>
|
|
177
246
|
</View>
|
|
178
247
|
);
|
|
179
248
|
}
|
|
180
|
-
|