@mpxjs/webpack-plugin 2.9.62 → 2.9.65

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.
Files changed (95) hide show
  1. package/lib/config.js +38 -10
  2. package/lib/index.js +1 -3
  3. package/lib/platform/style/wx/index.js +115 -66
  4. package/lib/platform/template/wx/index.js +12 -8
  5. package/lib/react/processStyles.js +1 -0
  6. package/lib/react/processTemplate.js +2 -3
  7. package/lib/react/style-helper.js +9 -7
  8. package/lib/runtime/components/react/context.ts +9 -7
  9. package/lib/runtime/components/react/dist/context.js +1 -0
  10. package/lib/runtime/components/react/dist/getInnerListeners.js +12 -1
  11. package/lib/runtime/components/react/dist/mpx-button.jsx +53 -74
  12. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +20 -18
  13. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +30 -42
  14. package/lib/runtime/components/react/dist/mpx-form.jsx +18 -15
  15. package/lib/runtime/components/react/dist/mpx-icon.jsx +15 -17
  16. package/lib/runtime/components/react/dist/mpx-image/index.jsx +36 -34
  17. package/lib/runtime/components/react/dist/mpx-image/svg.jsx +3 -1
  18. package/lib/runtime/components/react/dist/mpx-input.jsx +36 -31
  19. package/lib/runtime/components/react/dist/mpx-label.jsx +30 -37
  20. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +15 -19
  21. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +10 -9
  22. package/lib/runtime/components/react/dist/mpx-picker/date.jsx +2 -1
  23. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +11 -10
  24. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +9 -5
  25. package/lib/runtime/components/react/dist/mpx-picker/region.jsx +13 -8
  26. package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +3 -2
  27. package/lib/runtime/components/react/dist/mpx-picker/time.jsx +22 -20
  28. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +103 -10
  29. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +149 -54
  30. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +20 -18
  31. package/lib/runtime/components/react/dist/mpx-radio.jsx +29 -43
  32. package/lib/runtime/components/react/dist/mpx-root-portal.jsx +8 -4
  33. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +36 -27
  34. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +141 -75
  35. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +16 -7
  36. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +20 -11
  37. package/lib/runtime/components/react/dist/mpx-switch.jsx +18 -14
  38. package/lib/runtime/components/react/dist/mpx-text.jsx +20 -35
  39. package/lib/runtime/components/react/dist/mpx-textarea.jsx +1 -1
  40. package/lib/runtime/components/react/dist/mpx-view.jsx +296 -210
  41. package/lib/runtime/components/react/dist/mpx-web-view.jsx +11 -7
  42. package/lib/runtime/components/react/dist/parser.js +218 -0
  43. package/lib/runtime/components/react/dist/useNodesRef.js +1 -5
  44. package/lib/runtime/components/react/dist/utils.jsx +445 -0
  45. package/lib/runtime/components/react/getInnerListeners.ts +18 -8
  46. package/lib/runtime/components/react/mpx-button.tsx +83 -91
  47. package/lib/runtime/components/react/mpx-checkbox-group.tsx +50 -43
  48. package/lib/runtime/components/react/mpx-checkbox.tsx +56 -64
  49. package/lib/runtime/components/react/mpx-form.tsx +51 -22
  50. package/lib/runtime/components/react/mpx-icon.tsx +31 -27
  51. package/lib/runtime/components/react/mpx-image/index.tsx +54 -47
  52. package/lib/runtime/components/react/mpx-image/svg.tsx +5 -3
  53. package/lib/runtime/components/react/mpx-input.tsx +59 -38
  54. package/lib/runtime/components/react/mpx-label.tsx +55 -59
  55. package/lib/runtime/components/react/mpx-movable-area.tsx +40 -25
  56. package/lib/runtime/components/react/mpx-movable-view.tsx +29 -29
  57. package/lib/runtime/components/react/mpx-navigator.tsx +2 -2
  58. package/lib/runtime/components/react/mpx-picker/date.tsx +4 -4
  59. package/lib/runtime/components/react/mpx-picker/index.tsx +12 -11
  60. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +17 -13
  61. package/lib/runtime/components/react/mpx-picker/region.tsx +23 -19
  62. package/lib/runtime/components/react/mpx-picker/selector.tsx +7 -7
  63. package/lib/runtime/components/react/mpx-picker/time.tsx +29 -31
  64. package/lib/runtime/components/react/mpx-picker/type.ts +1 -1
  65. package/lib/runtime/components/react/mpx-picker-view-column.tsx +149 -20
  66. package/lib/runtime/components/react/mpx-picker-view.tsx +180 -63
  67. package/lib/runtime/components/react/mpx-radio-group.tsx +51 -47
  68. package/lib/runtime/components/react/mpx-radio.tsx +57 -72
  69. package/lib/runtime/components/react/mpx-root-portal.tsx +10 -8
  70. package/lib/runtime/components/react/mpx-scroll-view.tsx +136 -104
  71. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +175 -96
  72. package/lib/runtime/components/react/mpx-swiper/index.tsx +21 -9
  73. package/lib/runtime/components/react/mpx-swiper/type.ts +16 -5
  74. package/lib/runtime/components/react/mpx-swiper-item.tsx +48 -14
  75. package/lib/runtime/components/react/mpx-switch.tsx +46 -24
  76. package/lib/runtime/components/react/mpx-text.tsx +38 -45
  77. package/lib/runtime/components/react/mpx-textarea.tsx +1 -1
  78. package/lib/runtime/components/react/mpx-view.tsx +401 -241
  79. package/lib/runtime/components/react/mpx-web-view.tsx +22 -22
  80. package/lib/runtime/components/react/parser.ts +245 -0
  81. package/lib/runtime/components/react/types/common.ts +4 -4
  82. package/lib/runtime/components/react/types/global.d.ts +24 -2
  83. package/lib/runtime/components/react/useNodesRef.ts +1 -7
  84. package/lib/runtime/components/react/utils.tsx +524 -0
  85. package/lib/runtime/components/web/mpx-scroll-view.vue +25 -5
  86. package/lib/style-compiler/index.js +5 -4
  87. package/lib/template-compiler/compiler.js +133 -161
  88. package/lib/template-compiler/gen-node-react.js +1 -3
  89. package/lib/utils/const.js +2 -1
  90. package/lib/web/processStyles.js +2 -1
  91. package/lib/web/processTemplate.js +2 -3
  92. package/lib/wxml/loader.js +1 -1
  93. package/package.json +7 -4
  94. package/lib/runtime/components/react/dist/utils.js +0 -148
  95. package/lib/runtime/components/react/utils.ts +0 -170
@@ -32,11 +32,13 @@
32
32
  * ✔ bindscroll
33
33
  */
34
34
  import { ScrollView } from 'react-native-gesture-handler'
35
- import { View, RefreshControl, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent, ViewStyle } from 'react-native';
36
- import { JSX, ReactNode, RefObject, useRef, useState, useEffect, forwardRef } from 'react';
37
- import useInnerProps, { getCustomEvent } from './getInnerListeners';
35
+ import { View, RefreshControl, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent, ViewStyle } from 'react-native'
36
+ import { JSX, ReactNode, RefObject, useRef, useState, useEffect, forwardRef } from 'react'
37
+ import { useAnimatedRef } from 'react-native-reanimated'
38
+ import { warn } from '@mpxjs/utils'
39
+ import useInnerProps, { getCustomEvent } from './getInnerListeners'
38
40
  import useNodesRef, { HandlerRef } from './useNodesRef'
39
- import { throwReactWarning } from './utils'
41
+ import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren } from './utils'
40
42
 
41
43
  interface ScrollViewProps {
42
44
  children?: ReactNode;
@@ -58,6 +60,11 @@ interface ScrollViewProps {
58
60
  'scroll-top'?: number;
59
61
  'scroll-left'?: number;
60
62
  'enable-offset'?: boolean;
63
+ 'enable-var'?: boolean;
64
+ 'external-var-context'?: Record<string, any>;
65
+ 'parent-font-size'?: number;
66
+ 'parent-width'?: number;
67
+ 'parent-height'?: number;
61
68
  bindscrolltoupper?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
62
69
  bindscrolltolower?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
63
70
  bindscroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
@@ -91,11 +98,12 @@ type ScrollAdditionalProps = {
91
98
  onScrollEndDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
92
99
  onMomentumScrollEnd?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
93
100
  };
94
- const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, ScrollViewProps>((props: ScrollViewProps = {}, ref): JSX.Element => {
101
+ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, ScrollViewProps>((scrollViewProps: ScrollViewProps = {}, ref): JSX.Element => {
102
+ const { textProps, innerProps: props = {} } = splitProps(scrollViewProps)
95
103
  const {
96
- children,
97
104
  enhanced = false,
98
105
  bounces = true,
106
+ style = {},
99
107
  'scroll-x': scrollX = false,
100
108
  'scroll-y': scrollY = false,
101
109
  'enable-back-to-top': enableBackToTop = false,
@@ -106,30 +114,45 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
106
114
  'refresher-enabled': refresherEnabled,
107
115
  'refresher-default-style': refresherDefaultStyle,
108
116
  'refresher-background': refresherBackground,
109
- 'enable-offset': enableOffset,
110
- 'show-scrollbar': showScrollbar = true
111
- } = props;
117
+ 'show-scrollbar': showScrollbar = true,
118
+ 'enable-var': enableVar,
119
+ 'external-var-context': externalVarContext,
120
+ 'parent-font-size': parentFontSize,
121
+ 'parent-width': parentWidth,
122
+ 'parent-height': parentHeight
123
+ } = props
112
124
 
113
- const [refreshing, setRefreshing] = useState(true);
125
+ const [refreshing, setRefreshing] = useState(true)
114
126
 
115
- const snapScrollTop = useRef(0);
116
- const snapScrollLeft = useRef(0);
127
+ const snapScrollTop = useRef(0)
128
+ const snapScrollLeft = useRef(0)
117
129
 
118
- const layoutRef = useRef({})
119
130
  const scrollOptions = useRef({
120
131
  contentLength: 0,
121
132
  offset: 0,
122
133
  scrollLeft: 0,
123
134
  scrollTop: 0,
124
- visibleLength: 0,
125
- });
135
+ visibleLength: 0
136
+ })
126
137
 
127
- const scrollEventThrottle = 50;
128
- const hasCallScrollToUpper = useRef(true);
129
- const hasCallScrollToLower = useRef(false);
138
+ const scrollEventThrottle = 50
139
+ const hasCallScrollToUpper = useRef(true)
140
+ const hasCallScrollToLower = useRef(false)
130
141
  const initialTimeout = useRef<ReturnType<typeof setTimeout> | null>(null)
131
142
 
132
- const { nodeRef: scrollViewRef } = useNodesRef(props, ref, {
143
+ const {
144
+ normalStyle,
145
+ hasVarDec,
146
+ varContextRef,
147
+ hasSelfPercent,
148
+ setWidth,
149
+ setHeight
150
+ } = useTransformStyle(style, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight })
151
+
152
+ const { textStyle, innerStyle } = splitStyle(normalStyle)
153
+
154
+ const scrollViewRef = useAnimatedRef<ScrollView>()
155
+ useNodesRef(props, ref, scrollViewRef, {
133
156
  scrollOffset: scrollOptions,
134
157
  node: {
135
158
  scrollEnabled: scrollX || scrollY,
@@ -141,113 +164,111 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
141
164
  scrollTo: scrollToOffset
142
165
  }
143
166
  })
167
+
168
+ const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: scrollViewRef, onLayout })
169
+
144
170
  if (scrollX && scrollY) {
145
- throwReactWarning('[Mpx runtime warn]: scroll-x and scroll-y cannot be set to true at the same time, Mpx will use the value of scroll-y as the criterion')
171
+ warn('scroll-x and scroll-y cannot be set to true at the same time, Mpx will use the value of scroll-y as the criterion')
146
172
  }
147
173
  useEffect(() => {
148
174
  if (
149
175
  snapScrollTop.current !== props['scroll-top'] ||
150
176
  snapScrollLeft.current !== props['scroll-left']
151
177
  ) {
152
-
153
178
  snapScrollTop.current = props['scroll-top'] || 0
154
179
  snapScrollLeft.current = props['scroll-left'] || 0
155
180
 
156
181
  initialTimeout.current = setTimeout(() => {
157
- scrollToOffset(snapScrollLeft.current, snapScrollTop.current);
158
- }, 0);
182
+ scrollToOffset(snapScrollLeft.current, snapScrollTop.current)
183
+ }, 0)
159
184
 
160
185
  return () => {
161
- initialTimeout.current && clearTimeout(initialTimeout.current);
162
- };
186
+ initialTimeout.current && clearTimeout(initialTimeout.current)
187
+ }
163
188
  }
164
- }, [props['scroll-top'], props['scroll-left']]);
189
+ }, [props['scroll-top'], props['scroll-left']])
165
190
 
166
191
  useEffect(() => {
167
192
  if (refreshing !== props['refresher-triggered']) {
168
- setRefreshing(!!props['refresher-triggered']);
193
+ setRefreshing(!!props['refresher-triggered'])
169
194
  }
170
- }, [props['refresher-triggered']]);
195
+ }, [props['refresher-triggered']])
171
196
 
172
- function selectLength(size: { height: number; width: number }) {
173
- return !scrollX ? size.height : size.width;
197
+ function selectLength (size: { height: number; width: number }) {
198
+ return !scrollX ? size.height : size.width
174
199
  }
175
200
 
176
- function selectOffset(position: { x: number; y: number }) {
177
- return !scrollX ? position.y : position.x;
201
+ function selectOffset (position: { x: number; y: number }) {
202
+ return !scrollX ? position.y : position.x
178
203
  }
179
204
 
180
- function onStartReached(e: NativeSyntheticEvent<NativeScrollEvent>) {
181
- const { bindscrolltoupper } = props;
182
- const { offset } = scrollOptions.current;
205
+ function onStartReached (e: NativeSyntheticEvent<NativeScrollEvent>) {
206
+ const { bindscrolltoupper } = props
207
+ const { offset } = scrollOptions.current
183
208
  if (bindscrolltoupper && (offset <= upperThreshold)) {
184
209
  if (!hasCallScrollToUpper.current) {
185
210
  bindscrolltoupper(
186
211
  getCustomEvent('scrolltoupper', e, {
187
212
  detail: {
188
- direction: scrollX ? 'left' : 'top',
213
+ direction: scrollX ? 'left' : 'top'
189
214
  },
190
215
  layoutRef
191
- }, props),
192
- );
193
- hasCallScrollToUpper.current = true;
216
+ }, props)
217
+ )
218
+ hasCallScrollToUpper.current = true
194
219
  }
195
220
  } else {
196
- hasCallScrollToUpper.current = false;
221
+ hasCallScrollToUpper.current = false
197
222
  }
198
223
  }
199
224
 
200
- function onEndReached(e: NativeSyntheticEvent<NativeScrollEvent>) {
201
- const { bindscrolltolower } = props;
202
- const { contentLength, visibleLength, offset } = scrollOptions.current;
203
- const distanceFromEnd = contentLength - visibleLength - offset;
225
+ function onEndReached (e: NativeSyntheticEvent<NativeScrollEvent>) {
226
+ const { bindscrolltolower } = props
227
+ const { contentLength, visibleLength, offset } = scrollOptions.current
228
+ const distanceFromEnd = contentLength - visibleLength - offset
204
229
  if (bindscrolltolower && (distanceFromEnd < lowerThreshold)) {
205
230
  if (!hasCallScrollToLower.current) {
206
- hasCallScrollToLower.current = true;
231
+ hasCallScrollToLower.current = true
207
232
  bindscrolltolower(
208
233
  getCustomEvent('scrolltolower', e, {
209
234
  detail: {
210
- direction: scrollX ? 'right' : 'botttom',
235
+ direction: scrollX ? 'right' : 'botttom'
211
236
  },
212
237
  layoutRef
213
- }, props),
214
- );
238
+ }, props)
239
+ )
215
240
  }
216
241
  } else {
217
- hasCallScrollToLower.current = false;
242
+ hasCallScrollToLower.current = false
218
243
  }
219
244
  }
220
245
 
221
- function onContentSizeChange(width: number, height: number) {
222
- scrollOptions.current.contentLength = selectLength({ height, width });
246
+ function onContentSizeChange (width: number, height: number) {
247
+ scrollOptions.current.contentLength = selectLength({ height, width })
223
248
  }
224
249
 
225
- function onLayout(e: LayoutChangeEvent) {
226
- scrollOptions.current.visibleLength = selectLength(e.nativeEvent.layout);
227
- if (enableOffset) {
228
- scrollViewRef.current?.measure((x: number, y: number, width: number, height: number, offsetLeft: number, offsetTop: number) => {
229
- layoutRef.current = { x, y, width, height, offsetLeft, offsetTop }
230
- })
231
- }
250
+ function onLayout (e: LayoutChangeEvent) {
251
+ const layout = e.nativeEvent.layout || {}
252
+ scrollOptions.current.visibleLength = selectLength(layout)
232
253
  }
233
254
 
234
- function updateScrollOptions(e: NativeSyntheticEvent<NativeScrollEvent>, position: Record<string, any>) {
235
- const visibleLength = selectLength(e.nativeEvent.layoutMeasurement);
236
- const contentLength = selectLength(e.nativeEvent.contentSize);
237
- const offset = selectOffset(e.nativeEvent.contentOffset);
255
+ function updateScrollOptions (e: NativeSyntheticEvent<NativeScrollEvent>, position: Record<string, any>) {
256
+ const visibleLength = selectLength(e.nativeEvent.layoutMeasurement)
257
+ const contentLength = selectLength(e.nativeEvent.contentSize)
258
+ const offset = selectOffset(e.nativeEvent.contentOffset)
238
259
  scrollOptions.current = {
239
260
  ...scrollOptions.current,
240
261
  contentLength,
241
262
  offset,
242
263
  scrollLeft: position.scrollLeft,
243
264
  scrollTop: position.scrollTop,
244
- visibleLength,
265
+ visibleLength
245
266
  }
246
267
  }
247
268
 
248
- function onScroll(e: NativeSyntheticEvent<NativeScrollEvent>) {
249
- const { bindscroll } = props;
250
- const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
269
+ function onScroll (e: NativeSyntheticEvent<NativeScrollEvent>) {
270
+ const { bindscroll } = props
271
+ const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset
251
272
  const { width: scrollWidth, height: scrollHeight } = e.nativeEvent.contentSize
252
273
  bindscroll &&
253
274
  bindscroll(
@@ -258,18 +279,17 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
258
279
  scrollHeight,
259
280
  scrollWidth,
260
281
  deltaX: scrollLeft - scrollOptions.current.scrollLeft,
261
- deltaY: scrollTop - scrollOptions.current.scrollTop,
282
+ deltaY: scrollTop - scrollOptions.current.scrollTop
262
283
  },
263
284
  layoutRef
264
285
  }, props)
265
- );
286
+ )
266
287
  updateScrollOptions(e, { scrollLeft, scrollTop })
267
-
268
288
  }
269
289
 
270
- function onScrollEnd(e: NativeSyntheticEvent<NativeScrollEvent>) {
271
- const { bindscrollend } = props;
272
- const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
290
+ function onScrollEnd (e: NativeSyntheticEvent<NativeScrollEvent>) {
291
+ const { bindscrollend } = props
292
+ const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset
273
293
  const { width: scrollWidth, height: scrollHeight } = e.nativeEvent.contentSize
274
294
  bindscrollend &&
275
295
  bindscrollend(
@@ -282,30 +302,30 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
282
302
  },
283
303
  layoutRef
284
304
  }, props)
285
- );
305
+ )
286
306
  updateScrollOptions(e, { scrollLeft, scrollTop })
287
- onStartReached(e);
288
- onEndReached(e);
307
+ onStartReached(e)
308
+ onEndReached(e)
289
309
  }
290
310
 
291
- function scrollToOffset(x = 0, y = 0) {
311
+ function scrollToOffset (x = 0, y = 0) {
292
312
  if (scrollViewRef.current) {
293
- scrollViewRef.current.scrollTo({ x, y, animated: !!scrollWithAnimation });
313
+ scrollViewRef.current.scrollTo({ x, y, animated: !!scrollWithAnimation })
294
314
  scrollOptions.current.scrollLeft = x
295
315
  scrollOptions.current.scrollTop = y
296
316
  }
297
317
  }
298
318
 
299
- function onRefresh() {
300
- const { bindrefresherrefresh } = props;
319
+ function onRefresh () {
320
+ const { bindrefresherrefresh } = props
301
321
  bindrefresherrefresh &&
302
322
  bindrefresherrefresh(
303
- getCustomEvent('refresherrefresh', {}, { layoutRef }, props),
304
- );
323
+ getCustomEvent('refresherrefresh', {}, { layoutRef }, props)
324
+ )
305
325
  }
306
326
 
307
- function onScrollTouchStart(e: NativeSyntheticEvent<TouchEvent>) {
308
- const { binddragstart, bindtouchstart, enhanced } = props;
327
+ function onScrollTouchStart (e: NativeSyntheticEvent<TouchEvent>) {
328
+ const { binddragstart, bindtouchstart, enhanced } = props
309
329
  bindtouchstart && bindtouchstart(e)
310
330
  if (enhanced) {
311
331
  binddragstart &&
@@ -313,15 +333,15 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
313
333
  getCustomEvent('dragstart', e, {
314
334
  detail: {
315
335
  scrollLeft: scrollOptions.current.scrollLeft,
316
- scrollTop: scrollOptions.current.scrollTop,
336
+ scrollTop: scrollOptions.current.scrollTop
317
337
  },
318
338
  layoutRef
319
339
  }, props)
320
340
  )
321
341
  }
322
342
  }
323
- function onScrollTouchMove(e: NativeSyntheticEvent<TouchEvent>) {
324
- const { binddragging, bindtouchmove, enhanced } = props;
343
+ function onScrollTouchMove (e: NativeSyntheticEvent<TouchEvent>) {
344
+ const { binddragging, bindtouchmove, enhanced } = props
325
345
  bindtouchmove && bindtouchmove(e)
326
346
  if (enhanced) {
327
347
  binddragging &&
@@ -329,7 +349,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
329
349
  getCustomEvent('dragging', e, {
330
350
  detail: {
331
351
  scrollLeft: scrollOptions.current.scrollLeft || 0,
332
- scrollTop: scrollOptions.current.scrollTop || 0,
352
+ scrollTop: scrollOptions.current.scrollTop || 0
333
353
  },
334
354
  layoutRef
335
355
  }, props)
@@ -337,10 +357,10 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
337
357
  }
338
358
  }
339
359
 
340
- function onScrollEndDrag(e: NativeSyntheticEvent<NativeScrollEvent>) {
341
- const { binddragend, enhanced } = props;
360
+ function onScrollEndDrag (e: NativeSyntheticEvent<NativeScrollEvent>) {
361
+ const { binddragend, enhanced } = props
342
362
  if (enhanced) {
343
- const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
363
+ const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset
344
364
  const { width: scrollWidth, height: scrollHeight } = e.nativeEvent.contentSize
345
365
  binddragend &&
346
366
  binddragend(
@@ -359,6 +379,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
359
379
  }
360
380
 
361
381
  let scrollAdditionalProps: ScrollAdditionalProps = {
382
+ style: { ...innerStyle, ...layoutStyle },
362
383
  pinchGestureEnabled: false,
363
384
  horizontal: scrollX && !scrollY,
364
385
  scrollEventThrottle: scrollEventThrottle,
@@ -371,19 +392,18 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
371
392
  onContentSizeChange: onContentSizeChange,
372
393
  bindtouchstart: onScrollTouchStart,
373
394
  bindtouchmove: onScrollTouchMove,
374
- onLayout,
375
395
  onScrollEndDrag,
376
- onMomentumScrollEnd: onScrollEnd
377
- };
396
+ onMomentumScrollEnd: onScrollEnd,
397
+ ...layoutProps
398
+ }
378
399
  if (enhanced) {
379
400
  scrollAdditionalProps = {
380
401
  ...scrollAdditionalProps,
381
402
  bounces,
382
- pagingEnabled,
383
- };
403
+ pagingEnabled
404
+ }
384
405
  }
385
406
  const innerProps = useInnerProps(props, scrollAdditionalProps, [
386
- 'enable-offset',
387
407
  'scroll-x',
388
408
  'scroll-y',
389
409
  'enable-back-to-top',
@@ -407,30 +427,42 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
407
427
  'bindscrolltoupper',
408
428
  'bindscrolltolower',
409
429
  'bindrefresherrefresh'
410
- ], { layoutRef });
430
+ ], { layoutRef })
411
431
 
412
432
  const refreshColor = {
413
- 'black': ['#000'],
414
- 'white': ['#fff']
433
+ black: ['#000'],
434
+ white: ['#fff']
415
435
  }
416
436
 
417
437
  return (
418
438
  <ScrollView
419
439
  {...innerProps}
420
- refreshControl={refresherEnabled ? (
440
+ refreshControl={refresherEnabled
441
+ ? (
421
442
  <RefreshControl
422
443
  progressBackgroundColor={refresherBackground}
423
444
  refreshing={refreshing}
424
445
  onRefresh={onRefresh}
425
446
  {...(refresherDefaultStyle && refresherDefaultStyle !== 'none' ? { colors: refreshColor[refresherDefaultStyle] } : {})}
426
447
  />
427
- ) : undefined}
448
+ )
449
+ : undefined}
428
450
  >
429
- {children}
451
+ {
452
+ wrapChildren(
453
+ props,
454
+ {
455
+ hasVarDec,
456
+ varContext: varContextRef.current,
457
+ textStyle,
458
+ textProps
459
+ }
460
+ )
461
+ }
430
462
  </ScrollView>
431
- );
463
+ )
432
464
  })
433
465
 
434
- _ScrollView.displayName = 'mpx-scroll-view';
466
+ _ScrollView.displayName = 'mpx-scroll-view'
435
467
 
436
468
  export default _ScrollView