@mpxjs/webpack-plugin 2.10.4-beta.16 → 2.10.4-beta.18
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.
|
@@ -90,7 +90,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
90
90
|
});
|
|
91
91
|
const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef });
|
|
92
92
|
useEffect(() => {
|
|
93
|
-
if (
|
|
93
|
+
if (value !== tmpValue.current) {
|
|
94
94
|
const parsed = parseValue(value);
|
|
95
95
|
tmpValue.current = parsed;
|
|
96
96
|
setInputValue(parsed);
|
|
@@ -43,7 +43,7 @@ import { IntersectionObserverContext, ScrollViewContext } from './context';
|
|
|
43
43
|
const AnimatedScrollView = RNAnimated.createAnimatedComponent(ScrollView);
|
|
44
44
|
const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
45
45
|
const { textProps, innerProps: props = {} } = splitProps(scrollViewProps);
|
|
46
|
-
const { enhanced = false, bounces = true, style = {}, binddragstart, binddragging, binddragend, bindtouchstart, bindtouchmove, bindtouchend, 'scroll-x': scrollX = false, 'scroll-y': scrollY = false, 'enable-back-to-top': enableBackToTop = false, 'enable-trigger-intersection-observer': enableTriggerIntersectionObserver = false, 'paging-enabled': pagingEnabled = false, 'upper-threshold': upperThreshold = 50, 'lower-threshold': lowerThreshold = 50, 'scroll-with-animation': scrollWithAnimation = false, 'refresher-enabled': refresherEnabled, 'refresher-default-style': refresherDefaultStyle, 'refresher-background': refresherBackground, 'refresher-threshold': refresherThreshold = 45, 'show-scrollbar': showScrollbar = true, 'scroll-into-view': scrollIntoView = '', 'scroll-top': scrollTop = 0, 'scroll-left': scrollLeft = 0, 'refresher-triggered': refresherTriggered, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'simultaneous-handlers': originSimultaneousHandlers, 'wait-for': waitFor, 'enable-sticky': enableSticky, 'scroll-event-throttle': scrollEventThrottle = 0, __selectRef } = props;
|
|
46
|
+
const { enhanced = false, bounces = true, style = {}, binddragstart, binddragging, binddragend, bindtouchstart, bindtouchmove, bindtouchend, 'scroll-x': scrollX = false, 'scroll-y': scrollY = false, 'enable-back-to-top': enableBackToTop = false, 'enable-trigger-intersection-observer': enableTriggerIntersectionObserver = false, 'paging-enabled': pagingEnabled = false, 'upper-threshold': upperThreshold = 50, 'lower-threshold': lowerThreshold = 50, 'scroll-with-animation': scrollWithAnimation = false, 'refresher-enabled': refresherEnabled, 'refresher-default-style': refresherDefaultStyle, 'refresher-background': refresherBackground, 'refresher-threshold': refresherThreshold = 45, 'show-scrollbar': showScrollbar = true, 'scroll-into-view': scrollIntoView = '', 'scroll-top': scrollTop = 0, 'scroll-left': scrollLeft = 0, 'refresher-triggered': refresherTriggered, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'simultaneous-handlers': originSimultaneousHandlers, 'wait-for': waitFor, 'enable-sticky': enableSticky, 'scroll-event-throttle': scrollEventThrottle = 0, 'scroll-into-view-offset': scrollIntoViewOffset = 0, __selectRef } = props;
|
|
47
47
|
const scrollOffset = useRef(new RNAnimated.Value(0)).current;
|
|
48
48
|
const simultaneousHandlers = flatGesture(originSimultaneousHandlers);
|
|
49
49
|
const waitForHandlers = flatGesture(waitFor);
|
|
@@ -68,7 +68,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
68
68
|
const hasCallScrollToLower = useRef(false);
|
|
69
69
|
const initialTimeout = useRef(null);
|
|
70
70
|
const intersectionObservers = useContext(IntersectionObserverContext);
|
|
71
|
-
const firstScrollIntoViewChange = useRef(
|
|
71
|
+
const firstScrollIntoViewChange = useRef(true);
|
|
72
72
|
const refreshColor = {
|
|
73
73
|
black: ['#000'],
|
|
74
74
|
white: ['#fff']
|
|
@@ -88,7 +88,8 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
88
88
|
pagingEnabled,
|
|
89
89
|
fastDeceleration: false,
|
|
90
90
|
decelerationDisabled: false,
|
|
91
|
-
scrollTo
|
|
91
|
+
scrollTo,
|
|
92
|
+
scrollIntoView: handleScrollIntoView
|
|
92
93
|
},
|
|
93
94
|
gestureRef: scrollViewRef
|
|
94
95
|
});
|
|
@@ -118,14 +119,16 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
118
119
|
}, [scrollTop, scrollLeft]);
|
|
119
120
|
useEffect(() => {
|
|
120
121
|
if (scrollIntoView && __selectRef) {
|
|
121
|
-
if (
|
|
122
|
-
setTimeout(
|
|
122
|
+
if (firstScrollIntoViewChange.current) {
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
handleScrollIntoView(scrollIntoView, { offset: scrollIntoViewOffset, animated: scrollWithAnimation });
|
|
125
|
+
});
|
|
123
126
|
}
|
|
124
127
|
else {
|
|
125
|
-
handleScrollIntoView();
|
|
128
|
+
handleScrollIntoView(scrollIntoView, { offset: scrollIntoViewOffset, animated: scrollWithAnimation });
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
|
-
firstScrollIntoViewChange.current =
|
|
131
|
+
firstScrollIntoViewChange.current = false;
|
|
129
132
|
}, [scrollIntoView]);
|
|
130
133
|
useEffect(() => {
|
|
131
134
|
if (refresherEnabled) {
|
|
@@ -145,13 +148,15 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
145
148
|
function scrollTo({ top = 0, left = 0, animated = false }) {
|
|
146
149
|
scrollToOffset(left, top, animated);
|
|
147
150
|
}
|
|
148
|
-
function handleScrollIntoView() {
|
|
149
|
-
const refs = __selectRef(`#${
|
|
151
|
+
function handleScrollIntoView(selector = '', { offset = 0, animated = true } = {}) {
|
|
152
|
+
const refs = __selectRef(`#${selector}`, 'node');
|
|
150
153
|
if (!refs)
|
|
151
154
|
return;
|
|
152
155
|
const { nodeRef } = refs.getNodeInstance();
|
|
153
156
|
nodeRef.current?.measureLayout(scrollViewRef.current, (left, top) => {
|
|
154
|
-
|
|
157
|
+
const adjustedLeft = scrollX ? left + offset : left;
|
|
158
|
+
const adjustedTop = scrollY ? top + offset : top;
|
|
159
|
+
scrollToOffset(adjustedLeft, adjustedTop, animated);
|
|
155
160
|
});
|
|
156
161
|
}
|
|
157
162
|
function selectLength(size) {
|
|
@@ -216,7 +216,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
|
|
|
216
216
|
const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef })
|
|
217
217
|
|
|
218
218
|
useEffect(() => {
|
|
219
|
-
if (
|
|
219
|
+
if (value !== tmpValue.current) {
|
|
220
220
|
const parsed = parseValue(value)
|
|
221
221
|
tmpValue.current = parsed
|
|
222
222
|
setInputValue(parsed)
|
|
@@ -73,6 +73,7 @@ interface ScrollViewProps {
|
|
|
73
73
|
'wait-for'?: Array<GestureHandler>;
|
|
74
74
|
'simultaneous-handlers'?: Array<GestureHandler>;
|
|
75
75
|
'scroll-event-throttle'?:number;
|
|
76
|
+
'scroll-into-view-offset'?: number;
|
|
76
77
|
bindscrolltoupper?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
77
78
|
bindscrolltolower?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
78
79
|
bindscroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
@@ -148,6 +149,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
148
149
|
'wait-for': waitFor,
|
|
149
150
|
'enable-sticky': enableSticky,
|
|
150
151
|
'scroll-event-throttle': scrollEventThrottle = 0,
|
|
152
|
+
'scroll-into-view-offset': scrollIntoViewOffset = 0,
|
|
151
153
|
__selectRef
|
|
152
154
|
} = props
|
|
153
155
|
|
|
@@ -184,7 +186,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
184
186
|
const initialTimeout = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
185
187
|
const intersectionObservers = useContext(IntersectionObserverContext)
|
|
186
188
|
|
|
187
|
-
const firstScrollIntoViewChange = useRef<boolean>(
|
|
189
|
+
const firstScrollIntoViewChange = useRef<boolean>(true)
|
|
188
190
|
|
|
189
191
|
const refreshColor = {
|
|
190
192
|
black: ['#000'],
|
|
@@ -216,7 +218,8 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
216
218
|
pagingEnabled,
|
|
217
219
|
fastDeceleration: false,
|
|
218
220
|
decelerationDisabled: false,
|
|
219
|
-
scrollTo
|
|
221
|
+
scrollTo,
|
|
222
|
+
scrollIntoView: handleScrollIntoView
|
|
220
223
|
},
|
|
221
224
|
gestureRef: scrollViewRef
|
|
222
225
|
})
|
|
@@ -255,13 +258,15 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
255
258
|
|
|
256
259
|
useEffect(() => {
|
|
257
260
|
if (scrollIntoView && __selectRef) {
|
|
258
|
-
if (
|
|
259
|
-
setTimeout(
|
|
261
|
+
if (firstScrollIntoViewChange.current) {
|
|
262
|
+
setTimeout(() => {
|
|
263
|
+
handleScrollIntoView(scrollIntoView, { offset: scrollIntoViewOffset, animated: scrollWithAnimation })
|
|
264
|
+
})
|
|
260
265
|
} else {
|
|
261
|
-
handleScrollIntoView()
|
|
266
|
+
handleScrollIntoView(scrollIntoView, { offset: scrollIntoViewOffset, animated: scrollWithAnimation })
|
|
262
267
|
}
|
|
263
268
|
}
|
|
264
|
-
firstScrollIntoViewChange.current =
|
|
269
|
+
firstScrollIntoViewChange.current = false
|
|
265
270
|
}, [scrollIntoView])
|
|
266
271
|
|
|
267
272
|
useEffect(() => {
|
|
@@ -284,14 +289,16 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
284
289
|
scrollToOffset(left, top, animated)
|
|
285
290
|
}
|
|
286
291
|
|
|
287
|
-
function handleScrollIntoView () {
|
|
288
|
-
const refs = __selectRef!(`#${
|
|
292
|
+
function handleScrollIntoView (selector = '', { offset = 0, animated = true } = {}) {
|
|
293
|
+
const refs = __selectRef!(`#${selector}`, 'node')
|
|
289
294
|
if (!refs) return
|
|
290
295
|
const { nodeRef } = refs.getNodeInstance()
|
|
291
296
|
nodeRef.current?.measureLayout(
|
|
292
297
|
scrollViewRef.current,
|
|
293
298
|
(left: number, top: number) => {
|
|
294
|
-
|
|
299
|
+
const adjustedLeft = scrollX ? left + offset : left
|
|
300
|
+
const adjustedTop = scrollY ? top + offset : top
|
|
301
|
+
scrollToOffset(adjustedLeft, adjustedTop, animated)
|
|
295
302
|
}
|
|
296
303
|
)
|
|
297
304
|
}
|