@jsb188/react 1.1.8 → 1.1.11
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/package.json +20 -20
- package/states/apiData.ts +18 -14
- package/states/appContext.ts +366 -314
- package/states/connected.ts +135 -11
- package/states/index.ts +1 -1
- package/states/keyDown.ts +32 -27
- package/states/modal.ts +314 -243
- package/states/popOver.ts +270 -223
- package/states/reactiveEvents.ts +56 -0
- package/states/uploads.ts +41 -27
- package/types/PopOver.d.ts +461 -205
- package/utils/hooks.ts +319 -249
- package/utils/schema.ts +146 -129
- package/states/toasts.ts +0 -30
package/utils/hooks.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { areObjectsEqual } from '@jsb188/app/utils/object';
|
|
1
|
+
import { areObjectsEqual } from '@jsb188/app/utils/object.ts';
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,93 +8,103 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
function getDatabaseAction(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
currentData: any,
|
|
12
|
+
data: any,
|
|
13
|
+
allowNull?: boolean,
|
|
14
|
+
mergeCurrentData?: boolean,
|
|
15
15
|
): any {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
16
|
+
if (!currentData) {
|
|
17
|
+
return {
|
|
18
|
+
action: 'INSERT',
|
|
19
|
+
documentData: data,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const documentData: Record<string, any> = {};
|
|
24
|
+
|
|
25
|
+
let hasChanges = false;
|
|
26
|
+
for (const key in data) {
|
|
27
|
+
if (
|
|
28
|
+
Object.prototype.hasOwnProperty.call(data, key) &&
|
|
29
|
+
data[key] !== undefined
|
|
30
|
+
) {
|
|
31
|
+
// trim() on all string databse fields should be OK;
|
|
32
|
+
// But if not, add an extra param.
|
|
33
|
+
const value =
|
|
34
|
+
typeof data[key] === 'string' ? data[key].trim() : data[key];
|
|
35
|
+
|
|
36
|
+
const isNotNull = value !== null || allowNull;
|
|
37
|
+
if (isNotNull) {
|
|
38
|
+
documentData[key] = value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (
|
|
42
|
+
// Doing loose != check instead of !== type check
|
|
43
|
+
currentData[key] != value &&
|
|
44
|
+
isNotNull
|
|
45
|
+
) {
|
|
46
|
+
if (value && typeof value === 'object') {
|
|
47
|
+
hasChanges = !areObjectsEqual(currentData[key], value);
|
|
48
|
+
} else {
|
|
49
|
+
hasChanges = true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (hasChanges) {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (mergeCurrentData) {
|
|
60
|
+
for (const key in currentData) {
|
|
61
|
+
if (
|
|
62
|
+
Object.prototype.hasOwnProperty.call(currentData, key) &&
|
|
63
|
+
documentData[key] === undefined
|
|
64
|
+
) {
|
|
65
|
+
documentData[key] = currentData[key];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const action = hasChanges ? 'UPDATE' : 'NONE';
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
action,
|
|
74
|
+
documentData,
|
|
75
|
+
};
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
/**
|
|
72
79
|
* Basic diff check
|
|
73
80
|
*/
|
|
74
81
|
|
|
75
|
-
export function formValuesAreDiff(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
export function formValuesAreDiff(
|
|
83
|
+
currentValues: any,
|
|
84
|
+
formValues: any,
|
|
85
|
+
): boolean {
|
|
86
|
+
if (!formValues && formValues !== 0) {
|
|
87
|
+
// If formValues are null, it's not set yet
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (typeof formValues === 'object') {
|
|
92
|
+
// for (const key in currentValues) {
|
|
93
|
+
// if (
|
|
94
|
+
// currentValues[key] !== formValues[key] &&
|
|
95
|
+
// // This would not work for values with number 0, but I don't think that's an issue for any mutations right now
|
|
96
|
+
// (currentValues[key] !== null || formValues[key] !== undefined)
|
|
97
|
+
// ) {
|
|
98
|
+
// console.log('DIFF!:', key, currentValues[key], formValues[key]);
|
|
99
|
+
// return true;
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
102
|
+
|
|
103
|
+
const result = getDatabaseAction(currentValues, formValues);
|
|
104
|
+
return result.action !== 'NONE';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return currentValues !== formValues;
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
/**
|
|
@@ -102,18 +112,37 @@ export function formValuesAreDiff(currentValues: any, formValues: any): boolean
|
|
|
102
112
|
*/
|
|
103
113
|
|
|
104
114
|
export function useMounted() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const mounted = useRef(true);
|
|
116
|
+
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
// This is necessary, I don't know why, this hook unmounteds itself and remounts even though the dependencies are empty
|
|
119
|
+
// NOTE: This behavior was seen in [gqlClient.ts]
|
|
120
|
+
mounted.current = true;
|
|
121
|
+
return () => {
|
|
122
|
+
mounted.current = false;
|
|
123
|
+
};
|
|
124
|
+
}, []);
|
|
125
|
+
|
|
126
|
+
return mounted;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Return the computer timezone after client hydration.
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
let cachedComputerTimeZone: string | null = null;
|
|
134
|
+
|
|
135
|
+
export function useComputerTimeZone() {
|
|
136
|
+
const [timeZone, setTimeZone] = useState<string | null>(
|
|
137
|
+
cachedComputerTimeZone,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
cachedComputerTimeZone ??= Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
142
|
+
setTimeZone(cachedComputerTimeZone);
|
|
143
|
+
}, []);
|
|
144
|
+
|
|
145
|
+
return timeZone;
|
|
117
146
|
}
|
|
118
147
|
|
|
119
148
|
/**
|
|
@@ -121,26 +150,26 @@ export function useMounted() {
|
|
|
121
150
|
*/
|
|
122
151
|
|
|
123
152
|
export function useWatchChange(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
153
|
+
currentValues: any,
|
|
154
|
+
formValues: any,
|
|
155
|
+
saving: boolean,
|
|
156
|
+
onChangeDiff: (hasChanges: boolean, saving: boolean) => void,
|
|
157
|
+
onDataUpdated: () => void,
|
|
129
158
|
) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
159
|
+
const isDiff = useMemo(() => {
|
|
160
|
+
return formValuesAreDiff(currentValues, formValues);
|
|
161
|
+
}, [currentValues, formValues]);
|
|
162
|
+
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
onChangeDiff(isDiff, saving);
|
|
165
|
+
}, [isDiff, saving]);
|
|
166
|
+
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
if (!saving) {
|
|
169
|
+
// Always update, because isDiff memo() only listens to formValues (and not currentValues)
|
|
170
|
+
onDataUpdated();
|
|
171
|
+
}
|
|
172
|
+
}, [saving]);
|
|
144
173
|
}
|
|
145
174
|
|
|
146
175
|
/**
|
|
@@ -148,31 +177,31 @@ export function useWatchChange(
|
|
|
148
177
|
*/
|
|
149
178
|
|
|
150
179
|
export function checkPropsDiff(pp: any, np: any) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
180
|
+
let isSame = true;
|
|
181
|
+
for (const k in pp) {
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(pp, k) && pp[k] !== np[k]) {
|
|
183
|
+
console.log('Diff:', k);
|
|
184
|
+
isSame = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
for (const k in np) {
|
|
189
|
+
if (
|
|
190
|
+
Object.prototype.hasOwnProperty.call(np, k) &&
|
|
191
|
+
!Object.prototype.hasOwnProperty.call(pp, k) &&
|
|
192
|
+
np[k] !== pp[k]
|
|
193
|
+
) {
|
|
194
|
+
console.log('New Prop:', k);
|
|
195
|
+
isSame = false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return isSame;
|
|
171
200
|
}
|
|
172
201
|
|
|
173
202
|
if (globalThis && globalThis.location?.origin?.indexOf('localhost') >= 0) {
|
|
174
|
-
|
|
175
|
-
|
|
203
|
+
// @ts-ignore - Dev only shim
|
|
204
|
+
globalThis.checkPropsDiff = checkPropsDiff;
|
|
176
205
|
}
|
|
177
206
|
|
|
178
207
|
/**
|
|
@@ -180,75 +209,83 @@ if (globalThis && globalThis.location?.origin?.indexOf('localhost') >= 0) {
|
|
|
180
209
|
*/
|
|
181
210
|
|
|
182
211
|
export function arePropsEqualExceptChildren(pp: any, np: any) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
212
|
+
for (const k in np) {
|
|
213
|
+
if (
|
|
214
|
+
Object.prototype.hasOwnProperty.call(np, k) &&
|
|
215
|
+
k !== 'children' &&
|
|
216
|
+
(!Object.prototype.hasOwnProperty.call(pp, k) || np[k] !== pp[k])
|
|
217
|
+
) {
|
|
218
|
+
// console.log('DIFF:', k, pp[k], np[k]);
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return true;
|
|
197
223
|
}
|
|
198
224
|
|
|
199
225
|
/**
|
|
200
226
|
* Keep track of visibility state change and copy props;
|
|
201
|
-
* To be used in animation components
|
|
227
|
+
* To be used in animation components.
|
|
228
|
+
*
|
|
229
|
+
* You can use this hook to animate an element to fade out before returning
|
|
230
|
+
* null. Pass a truthy value while the element should be visible, render while
|
|
231
|
+
* visibility is not 0, and apply fade classes from the visibility value.
|
|
232
|
+
*
|
|
233
|
+
* Example:
|
|
234
|
+
*
|
|
235
|
+
* const [, visibility] = useAnimationVisibility(visible);
|
|
236
|
+
* const active = visibility >= 2;
|
|
237
|
+
*
|
|
238
|
+
* if (!visibility) {
|
|
239
|
+
* return null;
|
|
240
|
+
* }
|
|
241
|
+
*
|
|
242
|
+
* return <div className={cn('trans_op spd_2', active ? 'op_100' : 'op_0')} />;
|
|
202
243
|
*/
|
|
203
244
|
|
|
204
|
-
type VisibilityValue = 0 | .5 | 1 | 2;
|
|
245
|
+
type VisibilityValue = 0 | 0.5 | 1 | 2;
|
|
205
246
|
|
|
206
247
|
export function useAnimationVisibility<T>(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
): [
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
}, [visibility, hasData]);
|
|
250
|
-
|
|
251
|
-
return [persistedProps, visibility, setVisibility];
|
|
248
|
+
props: T,
|
|
249
|
+
onHasProps?: (hasProps: boolean) => void,
|
|
250
|
+
): [any, VisibilityValue, (VisibilityValue: VisibilityValue) => void] {
|
|
251
|
+
const [visibility, setVisibility] = useState(0 as VisibilityValue);
|
|
252
|
+
const [persistedProps, setPersistedProps] = useState<T>(props as T);
|
|
253
|
+
const hasData = !!props;
|
|
254
|
+
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
if (props) {
|
|
257
|
+
setPersistedProps(props);
|
|
258
|
+
}
|
|
259
|
+
onHasProps?.(hasData);
|
|
260
|
+
}, [props]);
|
|
261
|
+
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
if (visibility === 1) {
|
|
264
|
+
if (hasData) {
|
|
265
|
+
const timer = setTimeout(() => {
|
|
266
|
+
setVisibility(2);
|
|
267
|
+
}, 100);
|
|
268
|
+
return () => clearTimeout(timer);
|
|
269
|
+
} else {
|
|
270
|
+
const timer = setTimeout(() => {
|
|
271
|
+
setVisibility(0);
|
|
272
|
+
}, 300);
|
|
273
|
+
return () => clearTimeout(timer);
|
|
274
|
+
}
|
|
275
|
+
} else if (visibility === 0.5) {
|
|
276
|
+
const timer = setTimeout(() => {
|
|
277
|
+
setVisibility(0);
|
|
278
|
+
}, 300);
|
|
279
|
+
return () => clearTimeout(timer);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const shouldBeValue = hasData ? 2 : 0;
|
|
283
|
+
if (shouldBeValue !== visibility) {
|
|
284
|
+
setVisibility(hasData ? 1 : 0.5);
|
|
285
|
+
}
|
|
286
|
+
}, [visibility, hasData]);
|
|
287
|
+
|
|
288
|
+
return [persistedProps, visibility, setVisibility];
|
|
252
289
|
}
|
|
253
290
|
|
|
254
291
|
/**
|
|
@@ -257,59 +294,92 @@ export function useAnimationVisibility<T>(
|
|
|
257
294
|
*/
|
|
258
295
|
|
|
259
296
|
export function useImagesLoadStatus(
|
|
260
|
-
|
|
261
|
-
|
|
297
|
+
imageUrls: string[],
|
|
298
|
+
timeoutMS = 10000, // default timeout miliseconds
|
|
262
299
|
): boolean {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
300
|
+
const [loaded, setLoaded] = useState(false);
|
|
301
|
+
|
|
302
|
+
useEffect(() => {
|
|
303
|
+
if (!imageUrls || imageUrls.length === 0) {
|
|
304
|
+
setLoaded(true);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
let isCancelled = false;
|
|
309
|
+
let loadedCount = 0;
|
|
310
|
+
const timeout = setTimeout(() => {
|
|
311
|
+
if (!isCancelled) {
|
|
312
|
+
setLoaded(true);
|
|
313
|
+
}
|
|
314
|
+
}, timeoutMS);
|
|
315
|
+
|
|
316
|
+
const handleLoad = () => {
|
|
317
|
+
loadedCount += 1;
|
|
318
|
+
if (loadedCount === imageUrls.length && !isCancelled) {
|
|
319
|
+
clearTimeout(timeout);
|
|
320
|
+
setLoaded(true);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const handleError = () => {
|
|
325
|
+
loadedCount += 1; // count errors too, so they don’t block loading
|
|
326
|
+
if (loadedCount === imageUrls.length && !isCancelled) {
|
|
327
|
+
clearTimeout(timeout);
|
|
328
|
+
setLoaded(true);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const imageElements = imageUrls.map((url) => {
|
|
333
|
+
const img = new Image();
|
|
334
|
+
img.onload = handleLoad;
|
|
335
|
+
img.onerror = handleError;
|
|
336
|
+
img.src = url;
|
|
337
|
+
return img;
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
return () => {
|
|
341
|
+
isCancelled = true;
|
|
342
|
+
clearTimeout(timeout);
|
|
343
|
+
// Optional: clear handlers to prevent leaks
|
|
344
|
+
imageElements.forEach((img) => {
|
|
345
|
+
img.onload = null;
|
|
346
|
+
img.onerror = null;
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
}, []);
|
|
350
|
+
|
|
351
|
+
return loaded;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/*
|
|
355
|
+
* Track whether a referenced div's scroll position has passed a pixel offset.
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
export function useScrollPastPosition(pixels: number) {
|
|
359
|
+
const divRef = useRef<HTMLDivElement>(null);
|
|
360
|
+
const [hasScrolledPast, setHasScrolledPast] = useState(false);
|
|
361
|
+
|
|
362
|
+
useEffect(() => {
|
|
363
|
+
const element = divRef.current;
|
|
364
|
+
if (!element) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const handleScroll = () => {
|
|
369
|
+
const nextValue = element.scrollTop > pixels;
|
|
370
|
+
|
|
371
|
+
setHasScrolledPast((currentValue) => {
|
|
372
|
+
return currentValue === nextValue ? currentValue : nextValue;
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
element.addEventListener('scroll', handleScroll, { passive: true });
|
|
377
|
+
handleScroll();
|
|
378
|
+
|
|
379
|
+
return () => {
|
|
380
|
+
element.removeEventListener('scroll', handleScroll);
|
|
381
|
+
};
|
|
382
|
+
}, [pixels]);
|
|
383
|
+
|
|
384
|
+
return [divRef, hasScrolledPast] as const;
|
|
315
385
|
}
|