be-components 6.5.3 → 6.5.5
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 +115 -96
- package/lib/commonjs/Guide/index.js.map +1 -1
- package/lib/module/Guide/index.js +116 -97
- 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 +185 -117
|
@@ -22,65 +22,50 @@ function GuideWrapper({
|
|
|
22
22
|
onComplete
|
|
23
23
|
} = wrapper_guid;
|
|
24
24
|
const refs = (0, _react.useRef)({});
|
|
25
|
+
const containerRef = (0, _react.useRef)(null);
|
|
25
26
|
const [currentStep, setCurrentStep] = (0, _react.useState)(0);
|
|
26
27
|
const [layout, setLayout] = (0, _react.useState)(null);
|
|
27
|
-
const [
|
|
28
|
-
height: 0,
|
|
29
|
-
width: 0,
|
|
28
|
+
const [containerLayout, setContainerLayout] = (0, _react.useState)({
|
|
30
29
|
x: 0,
|
|
31
|
-
y: 0
|
|
30
|
+
y: 0,
|
|
31
|
+
width: 0,
|
|
32
|
+
height: 0
|
|
32
33
|
});
|
|
34
|
+
const [tooltipHeight, setTooltipHeight] = (0, _react.useState)(0);
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (_reactNative.Platform.OS === "web") {
|
|
54
|
-
const rect = ref.getBoundingClientRect();
|
|
55
|
-
setLayout({
|
|
56
|
-
x: rect.left - container_layout.x,
|
|
57
|
-
y: rect.top - container_layout.y,
|
|
58
|
-
width: rect.width,
|
|
59
|
-
height: rect.height
|
|
60
|
-
});
|
|
61
|
-
} else if (ref && typeof ref.measure === "function") {
|
|
62
|
-
ref.measure((width, height, pageX, pageY) => {
|
|
63
|
-
setLayout({
|
|
64
|
-
x: pageX,
|
|
65
|
-
y: pageY,
|
|
66
|
-
width,
|
|
67
|
-
height
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}, [active, currentStep, step, ref, container_layout.x]);
|
|
40
|
+
const stepRef = step ? refs.current[step.nativeID] : undefined;
|
|
41
|
+
const isTouchable = child => {
|
|
42
|
+
const typeName = child.type?.displayName || child.type;
|
|
43
|
+
return child.type === _reactNative.TouchableOpacity || child.type === _reactNative.TouchableHighlight || child.type === _reactNative.TouchableWithoutFeedback || typeof typeName === "string" && typeName.startsWith("Touchable");
|
|
44
|
+
};
|
|
72
45
|
|
|
73
46
|
// Recursively attach refs to children with nativeID
|
|
74
47
|
const attachRefs = nodes => {
|
|
75
48
|
return _react.default.Children.map(nodes, child => {
|
|
76
49
|
if (! /*#__PURE__*/_react.default.isValidElement(child)) return child;
|
|
77
|
-
const props = child.props
|
|
50
|
+
const props = child.props;
|
|
78
51
|
const nativeID = props.nativeID;
|
|
79
52
|
const newChildren = props.children ? attachRefs(props.children) : props.children;
|
|
80
53
|
if (nativeID) {
|
|
54
|
+
if (isTouchable(child)) {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
56
|
+
ref: r => {
|
|
57
|
+
if (r) refs.current[nativeID] = r;
|
|
58
|
+
},
|
|
59
|
+
style: {
|
|
60
|
+
flex: 0
|
|
61
|
+
}
|
|
62
|
+
}, /*#__PURE__*/_react.default.cloneElement(child, {
|
|
63
|
+
children: newChildren
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
81
66
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
82
|
-
ref:
|
|
83
|
-
if (
|
|
67
|
+
ref: r => {
|
|
68
|
+
if (r) refs.current[nativeID] = r;
|
|
84
69
|
},
|
|
85
70
|
children: newChildren
|
|
86
71
|
});
|
|
@@ -92,8 +77,45 @@ function GuideWrapper({
|
|
|
92
77
|
return child;
|
|
93
78
|
});
|
|
94
79
|
};
|
|
95
|
-
|
|
96
|
-
|
|
80
|
+
|
|
81
|
+
// Efficient measuring: only runs when tour is active
|
|
82
|
+
(0, _react.useEffect)(() => {
|
|
83
|
+
if (!active || !step) return;
|
|
84
|
+
const measureStep = () => {
|
|
85
|
+
if (!stepRef || !containerRef.current) return;
|
|
86
|
+
if (_reactNative.Platform.OS === "web") {
|
|
87
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
88
|
+
const rect = stepRef.getBoundingClientRect();
|
|
89
|
+
setLayout({
|
|
90
|
+
x: rect.left - containerRect.left,
|
|
91
|
+
y: rect.top - containerRect.top,
|
|
92
|
+
width: rect.width,
|
|
93
|
+
height: rect.height
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
const handle = (0, _reactNative.findNodeHandle)(stepRef);
|
|
97
|
+
const containerHandle = (0, _reactNative.findNodeHandle)(containerRef.current);
|
|
98
|
+
if (!handle || !containerHandle) return;
|
|
99
|
+
_reactNative.UIManager.measureLayout(handle, containerHandle, () => console.log("measureLayout failed"), (x, y, width, height) => setLayout({
|
|
100
|
+
x,
|
|
101
|
+
y,
|
|
102
|
+
width,
|
|
103
|
+
height
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Ensure component is mounted
|
|
109
|
+
setTimeout(measureStep, 0);
|
|
110
|
+
|
|
111
|
+
// Web: re-measure on window resize
|
|
112
|
+
if (_reactNative.Platform.OS === "web") {
|
|
113
|
+
const resizeHandler = () => measureStep();
|
|
114
|
+
window.addEventListener("resize", resizeHandler);
|
|
115
|
+
return () => window.removeEventListener("resize", resizeHandler);
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
}, [active, currentStep, step]);
|
|
97
119
|
const handleNext = () => {
|
|
98
120
|
if (currentStep + 1 < sortedTour.length) {
|
|
99
121
|
setCurrentStep(currentStep + 1);
|
|
@@ -104,114 +126,111 @@ function GuideWrapper({
|
|
|
104
126
|
const handlePrev = () => {
|
|
105
127
|
if (currentStep > 0) setCurrentStep(currentStep - 1);
|
|
106
128
|
};
|
|
107
|
-
if (!
|
|
129
|
+
if (!tour) return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
130
|
+
if (!layout || !active || !step) return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
131
|
+
ref: containerRef
|
|
132
|
+
}, attachRefs(children));
|
|
133
|
+
const MIN_WIDTH = 300;
|
|
134
|
+
const right = layout.x + MIN_WIDTH > containerLayout.width;
|
|
108
135
|
const isLastStep = currentStep === sortedTour.length - 1;
|
|
109
136
|
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
110
|
-
|
|
111
|
-
flexGrow: 1
|
|
112
|
-
},
|
|
137
|
+
ref: containerRef,
|
|
113
138
|
onLayout: ev => {
|
|
114
139
|
const l = ev.nativeEvent.layout;
|
|
115
140
|
setContainerLayout({
|
|
116
|
-
height: l.height,
|
|
117
|
-
width: l.width,
|
|
118
141
|
x: l.x,
|
|
119
|
-
y: l.y
|
|
142
|
+
y: l.y,
|
|
143
|
+
width: l.width,
|
|
144
|
+
height: l.height
|
|
120
145
|
});
|
|
146
|
+
},
|
|
147
|
+
style: {
|
|
148
|
+
flex: 1
|
|
121
149
|
}
|
|
122
150
|
}, attachRefs(children), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
123
|
-
|
|
151
|
+
pointerEvents: "none",
|
|
124
152
|
style: {
|
|
125
|
-
position:
|
|
153
|
+
position: "absolute",
|
|
126
154
|
zIndex: 9999999,
|
|
127
155
|
borderWidth: 2,
|
|
128
156
|
borderColor: Colors.text.success,
|
|
129
157
|
borderRadius: 4,
|
|
130
158
|
top: layout.y - 5,
|
|
131
159
|
left: layout.x - 5,
|
|
132
|
-
width: layout.width +
|
|
160
|
+
width: layout.width + 10,
|
|
133
161
|
height: layout.height + 10
|
|
134
162
|
}
|
|
135
|
-
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
136
|
-
|
|
163
|
+
}), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
164
|
+
onLayout: ev => setTooltipHeight(ev.nativeEvent.layout.height),
|
|
137
165
|
style: {
|
|
138
|
-
position:
|
|
139
|
-
maxWidth:
|
|
166
|
+
position: "absolute",
|
|
167
|
+
maxWidth: screenWidth - 10,
|
|
140
168
|
minWidth: 300,
|
|
141
169
|
borderColor: Colors.text.success,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
170
|
+
borderWidth: 1,
|
|
171
|
+
borderRadius: 8,
|
|
172
|
+
padding: 10,
|
|
173
|
+
top: layout.y - tooltipHeight - 10,
|
|
174
|
+
// 10px margin above overlay
|
|
175
|
+
left: right ? undefined : layout.x,
|
|
176
|
+
right: right ? 5 : undefined,
|
|
177
|
+
zIndex: 99999999
|
|
145
178
|
}
|
|
146
|
-
}, step.title
|
|
147
|
-
type: "header",
|
|
179
|
+
}, step.title && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
148
180
|
style: {
|
|
149
|
-
flexDirection:
|
|
150
|
-
alignItems:
|
|
151
|
-
|
|
152
|
-
borderTopRightRadius: 8,
|
|
153
|
-
borderTopLeftRadius: 8
|
|
181
|
+
flexDirection: "row",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
marginBottom: 5
|
|
154
184
|
}
|
|
155
185
|
}, /*#__PURE__*/_react.default.createElement(_Components.Icons.AlertIcon, {
|
|
156
186
|
size: 14,
|
|
157
187
|
color: Colors.text.warning
|
|
158
|
-
}), /*#__PURE__*/_react.default.createElement(_Themed.
|
|
159
|
-
|
|
188
|
+
}), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
189
|
+
theme: "h1",
|
|
160
190
|
style: {
|
|
161
191
|
flex: 1,
|
|
162
192
|
marginLeft: 10,
|
|
163
|
-
marginRight: 10
|
|
164
|
-
borderLeftWidth: 1,
|
|
165
|
-
borderColor: Colors.borders.light
|
|
193
|
+
marginRight: 10
|
|
166
194
|
}
|
|
167
|
-
}, /*#__PURE__*/_react.default.createElement(_Themed.
|
|
168
|
-
theme: "h1"
|
|
169
|
-
}, step.title)), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
195
|
+
}, step.title), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
170
196
|
style: {
|
|
171
197
|
height: 30,
|
|
172
198
|
width: 30,
|
|
173
199
|
borderRadius: 100,
|
|
174
200
|
padding: 0,
|
|
175
|
-
justifyContent:
|
|
176
|
-
alignItems:
|
|
201
|
+
justifyContent: "center",
|
|
202
|
+
alignItems: "center"
|
|
177
203
|
},
|
|
178
204
|
title: "X",
|
|
179
205
|
type: "error",
|
|
180
|
-
onPress: () => onComplete ? onComplete(
|
|
181
|
-
}))
|
|
182
|
-
type: "body",
|
|
206
|
+
onPress: () => onComplete ? onComplete("cancelled") : null
|
|
207
|
+
})), step.body && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
183
208
|
style: {
|
|
184
|
-
|
|
209
|
+
paddingVertical: 5
|
|
185
210
|
}
|
|
186
211
|
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
187
212
|
theme: "h2"
|
|
188
|
-
}, step.body))
|
|
189
|
-
type: "footer",
|
|
213
|
+
}, step.body)), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
190
214
|
style: {
|
|
191
|
-
flexDirection:
|
|
192
|
-
alignItems:
|
|
193
|
-
|
|
194
|
-
borderBottomRightRadius: 8,
|
|
195
|
-
borderBottomLeftRadius: 8
|
|
215
|
+
flexDirection: "row",
|
|
216
|
+
alignItems: "center",
|
|
217
|
+
marginTop: 5
|
|
196
218
|
}
|
|
197
219
|
}, currentStep > 0 && /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
198
220
|
type: "action",
|
|
199
221
|
onPress: handlePrev,
|
|
200
222
|
style: {
|
|
201
|
-
padding: 10,
|
|
202
223
|
flex: 1,
|
|
203
|
-
|
|
224
|
+
marginRight: 5
|
|
204
225
|
},
|
|
205
226
|
title: "BACK"
|
|
206
227
|
}), !step.clickable && /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
207
228
|
type: "success",
|
|
229
|
+
onPress: handleNext,
|
|
208
230
|
style: {
|
|
209
|
-
|
|
210
|
-
flex: 1,
|
|
211
|
-
margin: 2
|
|
231
|
+
flex: 1
|
|
212
232
|
},
|
|
213
|
-
onPress: handleNext,
|
|
214
233
|
title: isLastStep ? "Done" : "Next"
|
|
215
|
-
}))))
|
|
234
|
+
}))));
|
|
216
235
|
}
|
|
217
236
|
//# 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,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CA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C2E,IAAW,CAChC,CAAC,gBACNpI,MAAA,CAAAiB,OAAA,CAAAiE,aAAA,CAAAlF,MAAA,CAAAiB,OAAA,CAAAkE,QAAA,MAAI,CAAC,eACNnF,MAAA,CAAAiB,OAAA,CAAAiE,aAAA,CAAC9E,OAAA,CAAAoF,IAAI;IAACoB,IAAI,EAAC,QAAQ;IAACnB,KAAK,EAAE;MAAEoB,aAAa,EAAC,KAAK;MAAEC,UAAU,EAAC,QAAQ;MAAEC,OAAO,EAAC,EAAE;MAAEsB,uBAAuB,EAAC,CAAC;MAAEC,sBAAsB,EAAC;IAAE;EAAE,GACpIjG,WAAW,GAAG,CAAC,iBAChBrC,MAAA,CAAAiB,OAAA,CAAAiE,aAAA,CAAC9E,OAAA,CAAA2H,MAAM;IACHnB,IAAI,EAAC,QAAQ;IACbqB,OAAO,EAAE3C,UAAW;IACpBG,KAAK,EAAE;MAAEsB,OAAO,EAAC,EAAE;MAAEQ,IAAI,EAAC,CAAC;MAAEgB,MAAM,EAAC;IAAE,CAAE;IACxC5B,KAAK,EAAC;EAAM,CACf,CACJ,EACA,CAAClD,IAAI,CAAC+E,SAAS,iBACZxI,MAAA,CAAAiB,OAAA,CAAAiE,aAAA,CAAC9E,OAAA,CAAA2H,MAAM;IACHnB,IAAI,EAAC,SAAS;IACdnB,KAAK,EAAE;MAAEsB,OAAO,EAAC,EAAE;MAAEQ,IAAI,EAAC,CAAC;MAAEgB,MAAM,EAAC;IAAE,CAAE;IACxCN,OAAO,EAAE7C,UAAW;IACpBuB,KAAK,EAAEpB,UAAU,GAAG,MAAM,GAAG;EAAO,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","tour","active","onComplete","refs","useRef","containerRef","currentStep","setCurrentStep","useState","layout","setLayout","containerLayout","setContainerLayout","x","y","width","height","tooltipHeight","setTooltipHeight","screenWidth","useWindowDimensions","sortedTour","sort","a","b","priority","step","stepRef","current","nativeID","undefined","isTouchable","child","typeName","type","displayName","TouchableOpacity","TouchableHighlight","TouchableWithoutFeedback","startsWith","attachRefs","nodes","React","Children","map","isValidElement","props","newChildren","createElement","View","ref","style","flex","cloneElement","useEffect","measureStep","Platform","OS","containerRect","getBoundingClientRect","rect","left","top","handle","findNodeHandle","containerHandle","UIManager","measureLayout","console","log","setTimeout","resizeHandler","window","addEventListener","removeEventListener","handleNext","length","handlePrev","Fragment","MIN_WIDTH","right","isLastStep","onLayout","ev","l","nativeEvent","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,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,GAA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ClJ,MAAA,CAAAiB,OAAA,CAAA+D,aAAA,CAAC5E,OAAA,CAAAsI,IAAI;IAACC,KAAK,EAAC;EAAI,GAAEjF,IAAI,CAACuF,IAAW,CAC9B,CACP,eAEDjJ,MAAA,CAAAiB,OAAA,CAAA+D,aAAA,CAAC5E,OAAA,CAAA6E,IAAI;IAACE,KAAK,EAAE;MAAE+C,aAAa,EAAE,KAAK;MAAEC,UAAU,EAAE,QAAQ;MAAEgB,SAAS,EAAE;IAAE;EAAE,GACvE7G,WAAW,GAAG,CAAC,iBACdtC,MAAA,CAAAiB,OAAA,CAAA+D,aAAA,CAAC5E,OAAA,CAAA0I,MAAM;IAAC5E,IAAI,EAAC,QAAQ;IAAC8E,OAAO,EAAEnC,UAAW;IAAC1B,KAAK,EAAE;MAAEC,IAAI,EAAE,CAAC;MAAEyD,WAAW,EAAE;IAAE,CAAE;IAACZ,KAAK,EAAC;EAAM,CAAE,CAC9F,EACA,CAACvE,IAAI,CAAC0F,SAAS,iBACdpJ,MAAA,CAAAiB,OAAA,CAAA+D,aAAA,CAAC5E,OAAA,CAAA0I,MAAM;IAAC5E,IAAI,EAAC,SAAS;IAAC8E,OAAO,EAAErC,UAAW;IAACxB,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAE,CAAE;IAAC6C,KAAK,EAAEhB,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";
|
|
@@ -15,65 +15,50 @@ export default function GuideWrapper({
|
|
|
15
15
|
onComplete
|
|
16
16
|
} = wrapper_guid;
|
|
17
17
|
const refs = useRef({});
|
|
18
|
+
const containerRef = useRef(null);
|
|
18
19
|
const [currentStep, setCurrentStep] = useState(0);
|
|
19
20
|
const [layout, setLayout] = useState(null);
|
|
20
|
-
const [
|
|
21
|
-
height: 0,
|
|
22
|
-
width: 0,
|
|
21
|
+
const [containerLayout, setContainerLayout] = useState({
|
|
23
22
|
x: 0,
|
|
24
|
-
y: 0
|
|
23
|
+
y: 0,
|
|
24
|
+
width: 0,
|
|
25
|
+
height: 0
|
|
25
26
|
});
|
|
27
|
+
const [tooltipHeight, setTooltipHeight] = useState(0);
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (Platform.OS === "web") {
|
|
47
|
-
const rect = ref.getBoundingClientRect();
|
|
48
|
-
setLayout({
|
|
49
|
-
x: rect.left - container_layout.x,
|
|
50
|
-
y: rect.top - container_layout.y,
|
|
51
|
-
width: rect.width,
|
|
52
|
-
height: rect.height
|
|
53
|
-
});
|
|
54
|
-
} else if (ref && typeof ref.measure === "function") {
|
|
55
|
-
ref.measure((width, height, pageX, pageY) => {
|
|
56
|
-
setLayout({
|
|
57
|
-
x: pageX,
|
|
58
|
-
y: pageY,
|
|
59
|
-
width,
|
|
60
|
-
height
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}, [active, currentStep, step, ref, container_layout.x]);
|
|
33
|
+
const stepRef = step ? refs.current[step.nativeID] : undefined;
|
|
34
|
+
const isTouchable = child => {
|
|
35
|
+
const typeName = child.type?.displayName || child.type;
|
|
36
|
+
return child.type === TouchableOpacity || child.type === TouchableHighlight || child.type === TouchableWithoutFeedback || typeof typeName === "string" && typeName.startsWith("Touchable");
|
|
37
|
+
};
|
|
65
38
|
|
|
66
39
|
// Recursively attach refs to children with nativeID
|
|
67
40
|
const attachRefs = nodes => {
|
|
68
41
|
return React.Children.map(nodes, child => {
|
|
69
42
|
if (! /*#__PURE__*/React.isValidElement(child)) return child;
|
|
70
|
-
const props = child.props
|
|
43
|
+
const props = child.props;
|
|
71
44
|
const nativeID = props.nativeID;
|
|
72
45
|
const newChildren = props.children ? attachRefs(props.children) : props.children;
|
|
73
46
|
if (nativeID) {
|
|
47
|
+
if (isTouchable(child)) {
|
|
48
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
49
|
+
ref: r => {
|
|
50
|
+
if (r) refs.current[nativeID] = r;
|
|
51
|
+
},
|
|
52
|
+
style: {
|
|
53
|
+
flex: 0
|
|
54
|
+
}
|
|
55
|
+
}, /*#__PURE__*/React.cloneElement(child, {
|
|
56
|
+
children: newChildren
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
74
59
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
75
|
-
ref:
|
|
76
|
-
if (
|
|
60
|
+
ref: r => {
|
|
61
|
+
if (r) refs.current[nativeID] = r;
|
|
77
62
|
},
|
|
78
63
|
children: newChildren
|
|
79
64
|
});
|
|
@@ -85,8 +70,45 @@ export default function GuideWrapper({
|
|
|
85
70
|
return child;
|
|
86
71
|
});
|
|
87
72
|
};
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
|
|
74
|
+
// Efficient measuring: only runs when tour is active
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!active || !step) return;
|
|
77
|
+
const measureStep = () => {
|
|
78
|
+
if (!stepRef || !containerRef.current) return;
|
|
79
|
+
if (Platform.OS === "web") {
|
|
80
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
81
|
+
const rect = stepRef.getBoundingClientRect();
|
|
82
|
+
setLayout({
|
|
83
|
+
x: rect.left - containerRect.left,
|
|
84
|
+
y: rect.top - containerRect.top,
|
|
85
|
+
width: rect.width,
|
|
86
|
+
height: rect.height
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
const handle = findNodeHandle(stepRef);
|
|
90
|
+
const containerHandle = findNodeHandle(containerRef.current);
|
|
91
|
+
if (!handle || !containerHandle) return;
|
|
92
|
+
UIManager.measureLayout(handle, containerHandle, () => console.log("measureLayout failed"), (x, y, width, height) => setLayout({
|
|
93
|
+
x,
|
|
94
|
+
y,
|
|
95
|
+
width,
|
|
96
|
+
height
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Ensure component is mounted
|
|
102
|
+
setTimeout(measureStep, 0);
|
|
103
|
+
|
|
104
|
+
// Web: re-measure on window resize
|
|
105
|
+
if (Platform.OS === "web") {
|
|
106
|
+
const resizeHandler = () => measureStep();
|
|
107
|
+
window.addEventListener("resize", resizeHandler);
|
|
108
|
+
return () => window.removeEventListener("resize", resizeHandler);
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}, [active, currentStep, step]);
|
|
90
112
|
const handleNext = () => {
|
|
91
113
|
if (currentStep + 1 < sortedTour.length) {
|
|
92
114
|
setCurrentStep(currentStep + 1);
|
|
@@ -97,114 +119,111 @@ export default function GuideWrapper({
|
|
|
97
119
|
const handlePrev = () => {
|
|
98
120
|
if (currentStep > 0) setCurrentStep(currentStep - 1);
|
|
99
121
|
};
|
|
100
|
-
if (!
|
|
122
|
+
if (!tour) return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
123
|
+
if (!layout || !active || !step) return /*#__PURE__*/React.createElement(View, {
|
|
124
|
+
ref: containerRef
|
|
125
|
+
}, attachRefs(children));
|
|
126
|
+
const MIN_WIDTH = 300;
|
|
127
|
+
const right = layout.x + MIN_WIDTH > containerLayout.width;
|
|
101
128
|
const isLastStep = currentStep === sortedTour.length - 1;
|
|
102
129
|
return /*#__PURE__*/React.createElement(View, {
|
|
103
|
-
|
|
104
|
-
flexGrow: 1
|
|
105
|
-
},
|
|
130
|
+
ref: containerRef,
|
|
106
131
|
onLayout: ev => {
|
|
107
132
|
const l = ev.nativeEvent.layout;
|
|
108
133
|
setContainerLayout({
|
|
109
|
-
height: l.height,
|
|
110
|
-
width: l.width,
|
|
111
134
|
x: l.x,
|
|
112
|
-
y: l.y
|
|
135
|
+
y: l.y,
|
|
136
|
+
width: l.width,
|
|
137
|
+
height: l.height
|
|
113
138
|
});
|
|
139
|
+
},
|
|
140
|
+
style: {
|
|
141
|
+
flex: 1
|
|
114
142
|
}
|
|
115
143
|
}, attachRefs(children), /*#__PURE__*/React.createElement(View, {
|
|
116
|
-
|
|
144
|
+
pointerEvents: "none",
|
|
117
145
|
style: {
|
|
118
|
-
position:
|
|
146
|
+
position: "absolute",
|
|
119
147
|
zIndex: 9999999,
|
|
120
148
|
borderWidth: 2,
|
|
121
149
|
borderColor: Colors.text.success,
|
|
122
150
|
borderRadius: 4,
|
|
123
151
|
top: layout.y - 5,
|
|
124
152
|
left: layout.x - 5,
|
|
125
|
-
width: layout.width +
|
|
153
|
+
width: layout.width + 10,
|
|
126
154
|
height: layout.height + 10
|
|
127
155
|
}
|
|
128
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
129
|
-
|
|
156
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
157
|
+
onLayout: ev => setTooltipHeight(ev.nativeEvent.layout.height),
|
|
130
158
|
style: {
|
|
131
|
-
position:
|
|
132
|
-
maxWidth:
|
|
159
|
+
position: "absolute",
|
|
160
|
+
maxWidth: screenWidth - 10,
|
|
133
161
|
minWidth: 300,
|
|
134
162
|
borderColor: Colors.text.success,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
163
|
+
borderWidth: 1,
|
|
164
|
+
borderRadius: 8,
|
|
165
|
+
padding: 10,
|
|
166
|
+
top: layout.y - tooltipHeight - 10,
|
|
167
|
+
// 10px margin above overlay
|
|
168
|
+
left: right ? undefined : layout.x,
|
|
169
|
+
right: right ? 5 : undefined,
|
|
170
|
+
zIndex: 99999999
|
|
138
171
|
}
|
|
139
|
-
}, step.title
|
|
140
|
-
type: "header",
|
|
172
|
+
}, step.title && /*#__PURE__*/React.createElement(View, {
|
|
141
173
|
style: {
|
|
142
|
-
flexDirection:
|
|
143
|
-
alignItems:
|
|
144
|
-
|
|
145
|
-
borderTopRightRadius: 8,
|
|
146
|
-
borderTopLeftRadius: 8
|
|
174
|
+
flexDirection: "row",
|
|
175
|
+
alignItems: "center",
|
|
176
|
+
marginBottom: 5
|
|
147
177
|
}
|
|
148
178
|
}, /*#__PURE__*/React.createElement(Icons.AlertIcon, {
|
|
149
179
|
size: 14,
|
|
150
180
|
color: Colors.text.warning
|
|
151
|
-
}), /*#__PURE__*/React.createElement(
|
|
152
|
-
|
|
181
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
182
|
+
theme: "h1",
|
|
153
183
|
style: {
|
|
154
184
|
flex: 1,
|
|
155
185
|
marginLeft: 10,
|
|
156
|
-
marginRight: 10
|
|
157
|
-
borderLeftWidth: 1,
|
|
158
|
-
borderColor: Colors.borders.light
|
|
186
|
+
marginRight: 10
|
|
159
187
|
}
|
|
160
|
-
}, /*#__PURE__*/React.createElement(
|
|
161
|
-
theme: "h1"
|
|
162
|
-
}, step.title)), /*#__PURE__*/React.createElement(Button, {
|
|
188
|
+
}, step.title), /*#__PURE__*/React.createElement(Button, {
|
|
163
189
|
style: {
|
|
164
190
|
height: 30,
|
|
165
191
|
width: 30,
|
|
166
192
|
borderRadius: 100,
|
|
167
193
|
padding: 0,
|
|
168
|
-
justifyContent:
|
|
169
|
-
alignItems:
|
|
194
|
+
justifyContent: "center",
|
|
195
|
+
alignItems: "center"
|
|
170
196
|
},
|
|
171
197
|
title: "X",
|
|
172
198
|
type: "error",
|
|
173
|
-
onPress: () => onComplete ? onComplete(
|
|
174
|
-
}))
|
|
175
|
-
type: "body",
|
|
199
|
+
onPress: () => onComplete ? onComplete("cancelled") : null
|
|
200
|
+
})), step.body && /*#__PURE__*/React.createElement(View, {
|
|
176
201
|
style: {
|
|
177
|
-
|
|
202
|
+
paddingVertical: 5
|
|
178
203
|
}
|
|
179
204
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
180
205
|
theme: "h2"
|
|
181
|
-
}, step.body))
|
|
182
|
-
type: "footer",
|
|
206
|
+
}, step.body)), /*#__PURE__*/React.createElement(View, {
|
|
183
207
|
style: {
|
|
184
|
-
flexDirection:
|
|
185
|
-
alignItems:
|
|
186
|
-
|
|
187
|
-
borderBottomRightRadius: 8,
|
|
188
|
-
borderBottomLeftRadius: 8
|
|
208
|
+
flexDirection: "row",
|
|
209
|
+
alignItems: "center",
|
|
210
|
+
marginTop: 5
|
|
189
211
|
}
|
|
190
212
|
}, currentStep > 0 && /*#__PURE__*/React.createElement(Button, {
|
|
191
213
|
type: "action",
|
|
192
214
|
onPress: handlePrev,
|
|
193
215
|
style: {
|
|
194
|
-
padding: 10,
|
|
195
216
|
flex: 1,
|
|
196
|
-
|
|
217
|
+
marginRight: 5
|
|
197
218
|
},
|
|
198
219
|
title: "BACK"
|
|
199
220
|
}), !step.clickable && /*#__PURE__*/React.createElement(Button, {
|
|
200
221
|
type: "success",
|
|
222
|
+
onPress: handleNext,
|
|
201
223
|
style: {
|
|
202
|
-
|
|
203
|
-
flex: 1,
|
|
204
|
-
margin: 2
|
|
224
|
+
flex: 1
|
|
205
225
|
},
|
|
206
|
-
onPress: handleNext,
|
|
207
226
|
title: isLastStep ? "Done" : "Next"
|
|
208
|
-
}))))
|
|
227
|
+
}))));
|
|
209
228
|
}
|
|
210
229
|
//# 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","tour","active","onComplete","refs","containerRef","currentStep","setCurrentStep","layout","setLayout","containerLayout","setContainerLayout","x","y","width","height","tooltipHeight","setTooltipHeight","screenWidth","sortedTour","sort","a","b","priority","step","stepRef","current","nativeID","undefined","isTouchable","child","typeName","type","displayName","startsWith","attachRefs","nodes","Children","map","isValidElement","props","newChildren","createElement","ref","r","style","flex","cloneElement","measureStep","OS","containerRect","getBoundingClientRect","rect","left","top","handle","containerHandle","measureLayout","console","log","setTimeout","resizeHandler","window","addEventListener","removeEventListener","handleNext","length","handlePrev","Fragment","MIN_WIDTH","right","isLastStep","onLayout","ev","l","nativeEvent","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;A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ACVY,cAAc,EAAE,QAAQ;MACxBT,UAAU,EAAE;IACd,CAAE;IACFF,KAAK,EAAC,GAAG;IACTvD,IAAI,EAAC,OAAO;IACZmE,OAAO,EAAEA,CAAA,KAAOhG,UAAU,GAAGA,UAAU,CAAC,WAAW,CAAC,GAAG;EAAM,CAC9D,CACG,CACP,EAEAqB,IAAI,CAAC4E,IAAI,iBACRxH,KAAA,CAAA8D,aAAA,CAACjD,IAAI;IAACoD,KAAK,EAAE;MAAEwD,eAAe,EAAE;IAAE;EAAE,gBAClCzH,KAAA,CAAA8D,aAAA,CAAClD,IAAI;IAACuG,KAAK,EAAC;EAAI,GAAEvE,IAAI,CAAC4E,IAAW,CAC9B,CACP,eAEDxH,KAAA,CAAA8D,aAAA,CAACjD,IAAI;IAACoD,KAAK,EAAE;MAAE2C,aAAa,EAAE,KAAK;MAAEC,UAAU,EAAE,QAAQ;MAAEa,SAAS,EAAE;IAAE;EAAE,GACvEhG,WAAW,GAAG,CAAC,iBACd1B,KAAA,CAAA8D,aAAA,CAACnD,MAAM;IAACyC,IAAI,EAAC,QAAQ;IAACmE,OAAO,EAAEhC,UAAW;IAACtB,KAAK,EAAE;MAAEC,IAAI,EAAE,CAAC;MAAEmD,WAAW,EAAE;IAAE,CAAE;IAACV,KAAK,EAAC;EAAM,CAAE,CAC9F,EACA,CAAC/D,IAAI,CAAC+E,SAAS,iBACd3H,KAAA,CAAA8D,aAAA,CAACnD,MAAM;IAACyC,IAAI,EAAC,SAAS;IAACmE,OAAO,EAAElC,UAAW;IAACpB,KAAK,EAAE;MAAEC,IAAI,EAAE;IAAE,CAAE;IAACyC,KAAK,EAAEhB,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;;;QA8NC"}
|
|
@@ -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;;;;;8JA8NC;kBAnOkD,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,81 +18,123 @@ 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 ?? {};
|
|
18
26
|
const { tour, active, onComplete } = wrapper_guid;
|
|
27
|
+
|
|
19
28
|
const refs = useRef<{ [key: string]: any }>({});
|
|
29
|
+
const containerRef = useRef<any>(null);
|
|
30
|
+
|
|
20
31
|
const [currentStep, setCurrentStep] = useState(0);
|
|
21
32
|
const [layout, setLayout] = useState<Layout | null>(null);
|
|
22
|
-
const [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const [containerLayout, setContainerLayout] = useState<Layout>({
|
|
34
|
+
x: 0,
|
|
35
|
+
y: 0,
|
|
36
|
+
width: 0,
|
|
37
|
+
height: 0,
|
|
38
|
+
});
|
|
39
|
+
const [tooltipHeight, setTooltipHeight] = useState(0);
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}, [active, currentStep, step, ref, container_layout.x]);
|
|
47
|
+
const stepRef = step ? refs.current[step.nativeID] : undefined;
|
|
48
|
+
|
|
49
|
+
const isTouchable = (child: any) => {
|
|
50
|
+
const typeName = (child.type as any)?.displayName || child.type;
|
|
51
|
+
return (
|
|
52
|
+
child.type === TouchableOpacity ||
|
|
53
|
+
child.type === TouchableHighlight ||
|
|
54
|
+
child.type === TouchableWithoutFeedback ||
|
|
55
|
+
(typeof typeName === "string" && typeName.startsWith("Touchable"))
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
58
|
|
|
59
59
|
// Recursively attach refs to children with nativeID
|
|
60
60
|
const attachRefs = (nodes: React.ReactNode): React.ReactNode => {
|
|
61
|
-
return React.Children.map(nodes, (child
|
|
61
|
+
return React.Children.map(nodes, (child) => {
|
|
62
62
|
if (!React.isValidElement(child)) return child;
|
|
63
63
|
|
|
64
|
-
const props =
|
|
64
|
+
const props = child.props as { nativeID?: string; children?: React.ReactNode };
|
|
65
65
|
const nativeID = props.nativeID;
|
|
66
66
|
const newChildren = props.children ? attachRefs(props.children) : props.children;
|
|
67
67
|
|
|
68
68
|
if (nativeID) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
if (isTouchable(child)) {
|
|
70
|
+
return (
|
|
71
|
+
<View
|
|
72
|
+
ref={(r: any) => {
|
|
73
|
+
if (r) refs.current[nativeID] = r;
|
|
74
|
+
}}
|
|
75
|
+
style={{ flex: 0 }}
|
|
76
|
+
>
|
|
77
|
+
{React.cloneElement(child as React.ReactElement<any>, { children: newChildren } as any)}
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return React.cloneElement(child as React.ReactElement<any>, {
|
|
83
|
+
ref: (r: any) => {
|
|
84
|
+
if (r) refs.current[nativeID] = r;
|
|
72
85
|
},
|
|
73
86
|
children: newChildren,
|
|
74
87
|
} as any);
|
|
75
88
|
} else if (newChildren !== props.children) {
|
|
76
|
-
return React.cloneElement(child
|
|
89
|
+
return React.cloneElement(child as React.ReactElement<any>, { children: newChildren } as any);
|
|
77
90
|
}
|
|
78
91
|
|
|
79
92
|
return child;
|
|
80
93
|
});
|
|
81
94
|
};
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
// Efficient measuring: only runs when tour is active
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!active || !step) return;
|
|
99
|
+
|
|
100
|
+
const measureStep = () => {
|
|
101
|
+
if (!stepRef || !containerRef.current) return;
|
|
102
|
+
|
|
103
|
+
if (Platform.OS === "web") {
|
|
104
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
105
|
+
const rect = stepRef.getBoundingClientRect();
|
|
106
|
+
setLayout({
|
|
107
|
+
x: rect.left - containerRect.left,
|
|
108
|
+
y: rect.top - containerRect.top,
|
|
109
|
+
width: rect.width,
|
|
110
|
+
height: rect.height,
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
const handle = findNodeHandle(stepRef);
|
|
114
|
+
const containerHandle = findNodeHandle(containerRef.current);
|
|
115
|
+
if (!handle || !containerHandle) return;
|
|
116
|
+
|
|
117
|
+
UIManager.measureLayout(
|
|
118
|
+
handle,
|
|
119
|
+
containerHandle,
|
|
120
|
+
() => console.log("measureLayout failed"),
|
|
121
|
+
(x: number, y: number, width: number, height: number) =>
|
|
122
|
+
setLayout({ x, y, width, height })
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
86
126
|
|
|
127
|
+
// Ensure component is mounted
|
|
128
|
+
setTimeout(measureStep, 0);
|
|
87
129
|
|
|
130
|
+
// Web: re-measure on window resize
|
|
131
|
+
if (Platform.OS === "web") {
|
|
132
|
+
const resizeHandler = () => measureStep();
|
|
133
|
+
window.addEventListener("resize", resizeHandler);
|
|
134
|
+
return () => window.removeEventListener("resize", resizeHandler);
|
|
135
|
+
}
|
|
136
|
+
return
|
|
137
|
+
}, [active, currentStep, step]);
|
|
88
138
|
|
|
89
139
|
const handleNext = () => {
|
|
90
140
|
if (currentStep + 1 < sortedTour.length) {
|
|
@@ -98,83 +148,101 @@ export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
|
|
|
98
148
|
if (currentStep > 0) setCurrentStep(currentStep - 1);
|
|
99
149
|
};
|
|
100
150
|
|
|
101
|
-
if (!
|
|
151
|
+
if (!tour) return <>{children}</>;
|
|
152
|
+
|
|
153
|
+
if (!layout || !active || !step)
|
|
154
|
+
return <View ref={containerRef}>{attachRefs(children)}</View>;
|
|
155
|
+
|
|
156
|
+
const MIN_WIDTH = 300;
|
|
157
|
+
const right = layout.x + MIN_WIDTH > containerLayout.width;
|
|
102
158
|
const isLastStep = currentStep === sortedTour.length - 1;
|
|
159
|
+
|
|
103
160
|
return (
|
|
104
|
-
<View
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
161
|
+
<View
|
|
162
|
+
ref={containerRef}
|
|
163
|
+
onLayout={(ev) => {
|
|
164
|
+
const l = ev.nativeEvent.layout;
|
|
165
|
+
setContainerLayout({
|
|
166
|
+
x: l.x,
|
|
167
|
+
y: l.y,
|
|
168
|
+
width: l.width,
|
|
169
|
+
height: l.height,
|
|
170
|
+
});
|
|
171
|
+
}}
|
|
172
|
+
style={{ flex: 1 }}
|
|
173
|
+
>
|
|
109
174
|
{attachRefs(children)}
|
|
110
|
-
|
|
111
|
-
{/* Highlight
|
|
175
|
+
|
|
176
|
+
{/* Highlight */}
|
|
177
|
+
<View
|
|
178
|
+
pointerEvents="none"
|
|
179
|
+
style={{
|
|
180
|
+
position: "absolute",
|
|
181
|
+
zIndex: 9999999,
|
|
182
|
+
borderWidth: 2,
|
|
183
|
+
borderColor: Colors.text.success,
|
|
184
|
+
borderRadius: 4,
|
|
185
|
+
top: layout.y - 5,
|
|
186
|
+
left: layout.x - 5,
|
|
187
|
+
width: layout.width + 10,
|
|
188
|
+
height: layout.height + 10,
|
|
189
|
+
}}
|
|
190
|
+
/>
|
|
191
|
+
|
|
192
|
+
{/* Tooltip: always above overlay */}
|
|
112
193
|
<View
|
|
113
|
-
|
|
194
|
+
onLayout={(ev) => setTooltipHeight(ev.nativeEvent.layout.height)}
|
|
114
195
|
style={{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
196
|
+
position: "absolute",
|
|
197
|
+
maxWidth: screenWidth - 10,
|
|
198
|
+
minWidth: 300,
|
|
199
|
+
borderColor: Colors.text.success,
|
|
200
|
+
borderWidth: 1,
|
|
201
|
+
borderRadius: 8,
|
|
202
|
+
padding: 10,
|
|
203
|
+
top: layout.y - tooltipHeight - 10, // 10px margin above overlay
|
|
204
|
+
left: right ? undefined : layout.x,
|
|
205
|
+
right: right ? 5 : undefined,
|
|
206
|
+
zIndex: 99999999,
|
|
207
|
+
}}
|
|
125
208
|
>
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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>
|
|
209
|
+
{step.title && (
|
|
210
|
+
<View style={{ flexDirection: "row", alignItems: "center", marginBottom: 5 }}>
|
|
211
|
+
<Icons.AlertIcon size={14} color={Colors.text.warning} />
|
|
212
|
+
<Text theme="h1" style={{ flex: 1, marginLeft: 10, marginRight: 10 }}>
|
|
213
|
+
{step.title}
|
|
214
|
+
</Text>
|
|
215
|
+
<Button
|
|
216
|
+
style={{
|
|
217
|
+
height: 30,
|
|
218
|
+
width: 30,
|
|
219
|
+
borderRadius: 100,
|
|
220
|
+
padding: 0,
|
|
221
|
+
justifyContent: "center",
|
|
222
|
+
alignItems: "center",
|
|
223
|
+
}}
|
|
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
|
-
|