@mpxjs/webpack-plugin 2.10.15-4 → 2.10.15-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.
|
@@ -79,6 +79,16 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
79
79
|
const { normalStyle, hasVarDec, varContextRef, hasSelfPercent, hasPositionFixed, setWidth, setHeight } = useTransformStyle(style, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
80
80
|
const { textStyle, innerStyle = {} } = splitStyle(normalStyle);
|
|
81
81
|
const scrollViewRef = useRef(null);
|
|
82
|
+
const propsRef = useRef(props);
|
|
83
|
+
const refresherStateRef = useRef({
|
|
84
|
+
hasRefresher,
|
|
85
|
+
refresherTriggered
|
|
86
|
+
});
|
|
87
|
+
propsRef.current = props;
|
|
88
|
+
refresherStateRef.current = {
|
|
89
|
+
hasRefresher,
|
|
90
|
+
refresherTriggered
|
|
91
|
+
};
|
|
82
92
|
const runOnJSCallbackRef = useRef({
|
|
83
93
|
setEnableScroll,
|
|
84
94
|
setScrollBounces,
|
|
@@ -347,6 +357,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
347
357
|
}
|
|
348
358
|
// 处理刷新
|
|
349
359
|
function onRefresh() {
|
|
360
|
+
const { hasRefresher, refresherTriggered } = refresherStateRef.current;
|
|
350
361
|
if (hasRefresher && refresherTriggered === undefined) {
|
|
351
362
|
// 处理使用了自定义刷新组件,又没设置 refresherTriggered 的情况
|
|
352
363
|
setRefreshing(true);
|
|
@@ -358,9 +369,9 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
358
369
|
}
|
|
359
370
|
}, 500);
|
|
360
371
|
}
|
|
361
|
-
const { bindrefresherrefresh } =
|
|
372
|
+
const { bindrefresherrefresh } = propsRef.current;
|
|
362
373
|
bindrefresherrefresh &&
|
|
363
|
-
bindrefresherrefresh(getCustomEvent('refresherrefresh', {}, { layoutRef },
|
|
374
|
+
bindrefresherrefresh(getCustomEvent('refresherrefresh', {}, { layoutRef }, propsRef.current));
|
|
364
375
|
}
|
|
365
376
|
function getRefresherContent(children) {
|
|
366
377
|
let refresherContent = null;
|
|
@@ -211,6 +211,18 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
211
211
|
|
|
212
212
|
const scrollViewRef = useRef<ScrollView>(null)
|
|
213
213
|
|
|
214
|
+
const propsRef = useRef(props)
|
|
215
|
+
const refresherStateRef = useRef({
|
|
216
|
+
hasRefresher,
|
|
217
|
+
refresherTriggered
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
propsRef.current = props
|
|
221
|
+
refresherStateRef.current = {
|
|
222
|
+
hasRefresher,
|
|
223
|
+
refresherTriggered
|
|
224
|
+
}
|
|
225
|
+
|
|
214
226
|
const runOnJSCallbackRef = useRef({
|
|
215
227
|
setEnableScroll,
|
|
216
228
|
setScrollBounces,
|
|
@@ -524,6 +536,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
524
536
|
|
|
525
537
|
// 处理刷新
|
|
526
538
|
function onRefresh () {
|
|
539
|
+
const { hasRefresher, refresherTriggered } = refresherStateRef.current
|
|
527
540
|
if (hasRefresher && refresherTriggered === undefined) {
|
|
528
541
|
// 处理使用了自定义刷新组件,又没设置 refresherTriggered 的情况
|
|
529
542
|
setRefreshing(true)
|
|
@@ -535,10 +548,10 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
535
548
|
}
|
|
536
549
|
}, 500)
|
|
537
550
|
}
|
|
538
|
-
const { bindrefresherrefresh } =
|
|
551
|
+
const { bindrefresherrefresh } = propsRef.current
|
|
539
552
|
bindrefresherrefresh &&
|
|
540
553
|
bindrefresherrefresh(
|
|
541
|
-
getCustomEvent('refresherrefresh', {}, { layoutRef },
|
|
554
|
+
getCustomEvent('refresherrefresh', {}, { layoutRef }, propsRef.current)
|
|
542
555
|
)
|
|
543
556
|
}
|
|
544
557
|
|