@mpxjs/webpack-plugin 2.10.4 → 2.10.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.
Files changed (70) hide show
  1. package/lib/platform/style/wx/index.js +22 -21
  2. package/lib/react/processScript.js +9 -1
  3. package/lib/react/script-helper.js +5 -1
  4. package/lib/runtime/components/react/dist/event.config.js +0 -2
  5. package/lib/runtime/components/react/dist/getInnerListeners.js +127 -153
  6. package/lib/runtime/components/react/dist/mpx-button.jsx +2 -3
  7. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +3 -4
  8. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +2 -2
  9. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +2 -3
  10. package/lib/runtime/components/react/dist/mpx-form.jsx +2 -2
  11. package/lib/runtime/components/react/dist/mpx-icon/index.jsx +2 -2
  12. package/lib/runtime/components/react/dist/mpx-image.jsx +2 -2
  13. package/lib/runtime/components/react/dist/mpx-input.jsx +17 -11
  14. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +22 -29
  15. package/lib/runtime/components/react/dist/mpx-label.jsx +2 -3
  16. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +2 -2
  17. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +1 -1
  18. package/lib/runtime/components/react/dist/mpx-navigator.jsx +11 -3
  19. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +2 -2
  20. package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +2 -3
  21. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +4 -4
  22. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +2 -2
  23. package/lib/runtime/components/react/dist/mpx-radio.jsx +2 -3
  24. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +2 -2
  25. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +1 -1
  26. package/lib/runtime/components/react/dist/mpx-simple-text.jsx +3 -2
  27. package/lib/runtime/components/react/dist/mpx-simple-view.jsx +3 -3
  28. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -5
  29. package/lib/runtime/components/react/dist/mpx-swiper.jsx +9 -9
  30. package/lib/runtime/components/react/dist/mpx-switch.jsx +3 -5
  31. package/lib/runtime/components/react/dist/mpx-text.jsx +4 -7
  32. package/lib/runtime/components/react/dist/mpx-video.jsx +2 -2
  33. package/lib/runtime/components/react/dist/mpx-view.jsx +13 -6
  34. package/lib/runtime/components/react/dist/useAnimationHooks.js +27 -4
  35. package/lib/runtime/components/react/dist/utils.jsx +85 -95
  36. package/lib/runtime/components/react/event.config.ts +1 -8
  37. package/lib/runtime/components/react/getInnerListeners.ts +146 -192
  38. package/lib/runtime/components/react/mpx-button.tsx +4 -5
  39. package/lib/runtime/components/react/mpx-canvas/index.tsx +23 -15
  40. package/lib/runtime/components/react/mpx-checkbox-group.tsx +4 -3
  41. package/lib/runtime/components/react/mpx-checkbox.tsx +8 -9
  42. package/lib/runtime/components/react/mpx-form.tsx +25 -19
  43. package/lib/runtime/components/react/mpx-icon/index.tsx +4 -3
  44. package/lib/runtime/components/react/mpx-image.tsx +4 -3
  45. package/lib/runtime/components/react/mpx-input.tsx +22 -15
  46. package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +30 -41
  47. package/lib/runtime/components/react/mpx-label.tsx +4 -5
  48. package/lib/runtime/components/react/mpx-movable-area.tsx +22 -13
  49. package/lib/runtime/components/react/mpx-movable-view.tsx +47 -40
  50. package/lib/runtime/components/react/mpx-navigator.tsx +4 -6
  51. package/lib/runtime/components/react/mpx-picker/index.tsx +7 -4
  52. package/lib/runtime/components/react/mpx-picker-view/index.tsx +17 -14
  53. package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +4 -4
  54. package/lib/runtime/components/react/mpx-radio-group.tsx +4 -3
  55. package/lib/runtime/components/react/mpx-radio.tsx +8 -9
  56. package/lib/runtime/components/react/mpx-rich-text/index.tsx +15 -6
  57. package/lib/runtime/components/react/mpx-scroll-view.tsx +96 -90
  58. package/lib/runtime/components/react/mpx-simple-text.tsx +10 -3
  59. package/lib/runtime/components/react/mpx-simple-view.tsx +10 -4
  60. package/lib/runtime/components/react/mpx-swiper-item.tsx +31 -24
  61. package/lib/runtime/components/react/mpx-swiper.tsx +67 -61
  62. package/lib/runtime/components/react/mpx-switch.tsx +19 -14
  63. package/lib/runtime/components/react/mpx-text.tsx +16 -13
  64. package/lib/runtime/components/react/mpx-video.tsx +34 -33
  65. package/lib/runtime/components/react/mpx-view.tsx +30 -14
  66. package/lib/runtime/components/react/types/getInnerListeners.d.ts +65 -35
  67. package/lib/runtime/components/react/useAnimationHooks.ts +30 -9
  68. package/lib/runtime/components/react/utils.tsx +91 -98
  69. package/lib/template-compiler/compiler.js +1 -1
  70. package/package.json +3 -3
@@ -42,71 +42,71 @@ import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, ext
42
42
  import { IntersectionObserverContext, ScrollViewContext } from './context'
43
43
 
44
44
  interface ScrollViewProps {
45
- children?: ReactNode;
46
- enhanced?: boolean;
47
- bounces?: boolean;
48
- style?: ViewStyle;
49
- scrollEventThrottle?: number;
50
- 'scroll-x'?: boolean;
51
- 'scroll-y'?: boolean;
52
- 'enable-back-to-top'?: boolean;
53
- 'show-scrollbar'?: boolean;
54
- 'paging-enabled'?: boolean;
55
- 'upper-threshold'?: number;
56
- 'lower-threshold'?: number;
57
- 'scroll-with-animation'?: boolean;
58
- 'refresher-triggered'?: boolean;
59
- 'refresher-enabled'?: boolean;
60
- 'refresher-default-style'?: 'black' | 'white' | 'none';
61
- 'refresher-background'?: string;
62
- 'refresher-threshold'?: number;
63
- 'scroll-top'?: number;
64
- 'scroll-left'?: number;
65
- 'enable-offset'?: boolean;
66
- 'scroll-into-view'?: string;
67
- 'enable-trigger-intersection-observer'?: boolean;
68
- 'enable-var'?: boolean;
69
- 'external-var-context'?: Record<string, any>;
70
- 'parent-font-size'?: number;
71
- 'parent-width'?: number;
72
- 'parent-height'?: number;
73
- 'wait-for'?: Array<GestureHandler>;
74
- 'simultaneous-handlers'?: Array<GestureHandler>;
75
- 'scroll-event-throttle'?:number;
76
- bindscrolltoupper?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
77
- bindscrolltolower?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
78
- bindscroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
79
- bindrefresherrefresh?: (event: NativeSyntheticEvent<unknown>) => void;
80
- binddragstart?: (event: NativeSyntheticEvent<DragEvent>) => void;
81
- binddragging?: (event: NativeSyntheticEvent<DragEvent>) => void;
82
- binddragend?: (event: NativeSyntheticEvent<DragEvent>) => void;
83
- bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent>) => void;
84
- bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent>) => void;
85
- bindtouchend?: (event: NativeSyntheticEvent<TouchEvent>) => void;
86
- bindscrollend?: (event: NativeSyntheticEvent<TouchEvent>) => void;
45
+ children?: ReactNode
46
+ enhanced?: boolean
47
+ bounces?: boolean
48
+ style?: ViewStyle
49
+ scrollEventThrottle?: number
50
+ 'scroll-x'?: boolean
51
+ 'scroll-y'?: boolean
52
+ 'enable-back-to-top'?: boolean
53
+ 'show-scrollbar'?: boolean
54
+ 'paging-enabled'?: boolean
55
+ 'upper-threshold'?: number
56
+ 'lower-threshold'?: number
57
+ 'scroll-with-animation'?: boolean
58
+ 'refresher-triggered'?: boolean
59
+ 'refresher-enabled'?: boolean
60
+ 'refresher-default-style'?: 'black' | 'white' | 'none'
61
+ 'refresher-background'?: string
62
+ 'refresher-threshold'?: number
63
+ 'scroll-top'?: number
64
+ 'scroll-left'?: number
65
+ 'enable-offset'?: boolean
66
+ 'scroll-into-view'?: string
67
+ 'enable-trigger-intersection-observer'?: boolean
68
+ 'enable-var'?: boolean
69
+ 'external-var-context'?: Record<string, any>
70
+ 'parent-font-size'?: number
71
+ 'parent-width'?: number
72
+ 'parent-height'?: number
73
+ 'wait-for'?: Array<GestureHandler>
74
+ 'simultaneous-handlers'?: Array<GestureHandler>
75
+ 'scroll-event-throttle'?: number
76
+ bindscrolltoupper?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void
77
+ bindscrolltolower?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void
78
+ bindscroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void
79
+ bindrefresherrefresh?: (event: NativeSyntheticEvent<unknown>) => void
80
+ binddragstart?: (event: NativeSyntheticEvent<DragEvent>) => void
81
+ binddragging?: (event: NativeSyntheticEvent<DragEvent>) => void
82
+ binddragend?: (event: NativeSyntheticEvent<DragEvent>) => void
83
+ bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent>) => void
84
+ bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent>) => void
85
+ bindtouchend?: (event: NativeSyntheticEvent<TouchEvent>) => void
86
+ bindscrollend?: (event: NativeSyntheticEvent<TouchEvent>) => void
87
87
  __selectRef?: (selector: string, nodeType: 'node' | 'component', all?: boolean) => HandlerRef<any, any>
88
88
  }
89
89
  type ScrollAdditionalProps = {
90
- pinchGestureEnabled: boolean;
91
- horizontal: boolean;
92
- onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
93
- onContentSizeChange: (width: number, height: number) => void;
94
- onLayout?: (event: LayoutChangeEvent) => void;
95
- scrollsToTop: boolean;
96
- showsHorizontalScrollIndicator: boolean;
97
- showsVerticalScrollIndicator: boolean;
98
- scrollEnabled: boolean;
99
- ref: RefObject<ScrollView>;
100
- bounces?: boolean;
101
- pagingEnabled?: boolean;
102
- style?: ViewStyle;
103
- bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent>) => void;
104
- bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent>) => void;
105
- bindtouchend?: (event: NativeSyntheticEvent<TouchEvent>) => void;
106
- onScrollBeginDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
107
- onScrollEndDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
108
- onMomentumScrollEnd?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
109
- };
90
+ pinchGestureEnabled: boolean
91
+ horizontal: boolean
92
+ onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void
93
+ onContentSizeChange: (width: number, height: number) => void
94
+ onLayout?: (event: LayoutChangeEvent) => void
95
+ scrollsToTop: boolean
96
+ showsHorizontalScrollIndicator: boolean
97
+ showsVerticalScrollIndicator: boolean
98
+ scrollEnabled: boolean
99
+ ref: RefObject<ScrollView>
100
+ bounces?: boolean
101
+ pagingEnabled?: boolean
102
+ style?: ViewStyle
103
+ bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent>) => void
104
+ bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent>) => void
105
+ bindtouchend?: (event: NativeSyntheticEvent<TouchEvent>) => void
106
+ onScrollBeginDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void
107
+ onScrollEndDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void
108
+ onMomentumScrollEnd?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void
109
+ }
110
110
 
111
111
  const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, ScrollViewProps>((scrollViewProps: ScrollViewProps = {}, ref): JSX.Element => {
112
112
  const { textProps, innerProps: props = {} } = splitProps(scrollViewProps)
@@ -274,7 +274,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
274
274
  }
275
275
  }, [refresherTriggered])
276
276
 
277
- function scrollTo ({ top = 0, left = 0, animated = false } : { top?: number; left?: number; animated?: boolean }) {
277
+ function scrollTo ({ top = 0, left = 0, animated = false }: { top?: number; left?: number; animated?: boolean }) {
278
278
  scrollToOffset(left, top, animated)
279
279
  }
280
280
 
@@ -676,33 +676,39 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
676
676
  })
677
677
  }
678
678
 
679
- const innerProps = useInnerProps(props, scrollAdditionalProps, [
680
- 'id',
681
- 'scroll-x',
682
- 'scroll-y',
683
- 'enable-back-to-top',
684
- 'enable-trigger-intersection-observer',
685
- 'paging-enabled',
686
- 'show-scrollbar',
687
- 'upper-threshold',
688
- 'lower-threshold',
689
- 'scroll-top',
690
- 'scroll-left',
691
- 'scroll-with-animation',
692
- 'refresher-triggered',
693
- 'refresher-enabled',
694
- 'refresher-default-style',
695
- 'refresher-background',
696
- 'children',
697
- 'enhanced',
698
- 'binddragstart',
699
- 'binddragging',
700
- 'binddragend',
701
- 'bindscroll',
702
- 'bindscrolltoupper',
703
- 'bindscrolltolower',
704
- 'bindrefresherrefresh'
705
- ], { layoutRef })
679
+ const innerProps = useInnerProps(
680
+ extendObject(
681
+ {},
682
+ props,
683
+ scrollAdditionalProps
684
+ ),
685
+ [
686
+ 'id',
687
+ 'scroll-x',
688
+ 'scroll-y',
689
+ 'enable-back-to-top',
690
+ 'enable-trigger-intersection-observer',
691
+ 'paging-enabled',
692
+ 'show-scrollbar',
693
+ 'upper-threshold',
694
+ 'lower-threshold',
695
+ 'scroll-top',
696
+ 'scroll-left',
697
+ 'scroll-with-animation',
698
+ 'refresher-triggered',
699
+ 'refresher-enabled',
700
+ 'refresher-default-style',
701
+ 'refresher-background',
702
+ 'children',
703
+ 'enhanced',
704
+ 'binddragstart',
705
+ 'binddragging',
706
+ 'binddragend',
707
+ 'bindscroll',
708
+ 'bindscrolltoupper',
709
+ 'bindscrolltolower',
710
+ 'bindrefresherrefresh'
711
+ ], { layoutRef })
706
712
 
707
713
  const withRefresherScrollView = createElement(
708
714
  GestureDetector,
@@ -1,6 +1,7 @@
1
1
  import { Text, TextProps } from 'react-native'
2
2
  import { JSX, createElement } from 'react'
3
3
  import useInnerProps from './getInnerListeners'
4
+ import { extendObject } from './utils'
4
5
 
5
6
  const SimpleText = (props: TextProps): JSX.Element => {
6
7
  const {
@@ -8,9 +9,15 @@ const SimpleText = (props: TextProps): JSX.Element => {
8
9
  children
9
10
  } = props
10
11
 
11
- const innerProps = useInnerProps(props, {
12
- allowFontScaling
13
- }, [])
12
+ const innerProps = useInnerProps(
13
+ extendObject(
14
+ {},
15
+ props,
16
+ {
17
+ allowFontScaling
18
+ }
19
+ )
20
+ )
14
21
 
15
22
  return createElement(Text, innerProps, children)
16
23
  }
@@ -1,6 +1,6 @@
1
1
  import { View, ViewProps, TextStyle } from 'react-native'
2
2
  import { createElement } from 'react'
3
- import { splitProps, splitStyle, wrapChildren } from './utils'
3
+ import { splitProps, splitStyle, wrapChildren, extendObject } from './utils'
4
4
  import useInnerProps from './getInnerListeners'
5
5
 
6
6
  const SimpleView = (simpleViewProps: ViewProps): JSX.Element => {
@@ -8,9 +8,15 @@ const SimpleView = (simpleViewProps: ViewProps): JSX.Element => {
8
8
 
9
9
  const { textStyle, innerStyle = {} } = splitStyle(props.style || {})
10
10
 
11
- const innerProps = useInnerProps(props, {
12
- style: innerStyle
13
- }, [])
11
+ const innerProps = useInnerProps(
12
+ extendObject(
13
+ {},
14
+ props,
15
+ {
16
+ style: innerStyle
17
+ }
18
+ )
19
+ )
14
20
 
15
21
  return createElement(View, innerProps, wrapChildren(
16
22
  props,
@@ -3,28 +3,28 @@ import Animated, { useAnimatedStyle, interpolate, SharedValue } from 'react-nati
3
3
  import { ReactNode, forwardRef, useRef, useContext } from 'react'
4
4
  import useInnerProps from './getInnerListeners'
5
5
  import useNodesRef, { HandlerRef } from './useNodesRef' // 引入辅助函数
6
- import { useTransformStyle, splitStyle, splitProps, wrapChildren, useLayout } from './utils'
6
+ import { useTransformStyle, splitStyle, splitProps, wrapChildren, useLayout, extendObject } from './utils'
7
7
  import { SwiperContext } from './context'
8
8
 
9
9
  interface SwiperItemProps {
10
- 'item-id'?: string;
11
- 'enable-offset'?: boolean;
12
- 'enable-var': boolean;
13
- 'external-var-context'?: Record<string, any>;
14
- 'parent-font-size'?: number;
15
- 'parent-width'?: number;
16
- 'parent-height'?: number;
17
- children?: ReactNode;
18
- style?: Object;
19
- customStyle: Object;
20
- itemIndex: number;
10
+ 'item-id'?: string
11
+ 'enable-offset'?: boolean
12
+ 'enable-var': boolean
13
+ 'external-var-context'?: Record<string, any>
14
+ 'parent-font-size'?: number
15
+ 'parent-width'?: number
16
+ 'parent-height'?: number
17
+ children?: ReactNode
18
+ style?: Object
19
+ customStyle: Object
20
+ itemIndex: number
21
21
  }
22
22
 
23
23
  interface ContextType {
24
- offset: SharedValue<number>;
25
- step: SharedValue<number>;
26
- scale: boolean;
27
- dir: string;
24
+ offset: SharedValue<number>
25
+ step: SharedValue<number>
26
+ scale: boolean
27
+ dir: string
28
28
  }
29
29
 
30
30
  const _SwiperItem = forwardRef<HandlerRef<View, SwiperItemProps>, SwiperItemProps>((props: SwiperItemProps, ref) => {
@@ -64,14 +64,21 @@ const _SwiperItem = forwardRef<HandlerRef<View, SwiperItemProps>, SwiperItemProp
64
64
  layoutStyle
65
65
  } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: nodeRef })
66
66
 
67
- const innerProps = useInnerProps(props, {
68
- ref: nodeRef,
69
- ...layoutProps
70
- }, [
71
- 'children',
72
- 'enable-offset',
73
- 'style'
74
- ], { layoutRef })
67
+ const innerProps = useInnerProps(
68
+ extendObject(
69
+ {},
70
+ props,
71
+ layoutProps,
72
+ {
73
+ ref: nodeRef
74
+ }
75
+ ),
76
+ [
77
+ 'children',
78
+ 'enable-offset',
79
+ 'style'
80
+ ],
81
+ { layoutRef })
75
82
  const itemAnimatedStyle = useAnimatedStyle(() => {
76
83
  if (!step.value) return {}
77
84
  const inputRange = [step.value, 0]
@@ -5,7 +5,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, runOnJS
5
5
  import React, { JSX, forwardRef, useRef, useEffect, ReactNode, ReactElement, useMemo } from 'react'
6
6
  import useInnerProps, { getCustomEvent } from './getInnerListeners'
7
7
  import useNodesRef, { HandlerRef } from './useNodesRef' // 引入辅助函数
8
- import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren } from './utils'
8
+ import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject } from './utils'
9
9
  import { SwiperContext } from './context'
10
10
  /**
11
11
  * ✔ indicator-dots
@@ -30,32 +30,32 @@ type EventDataType = {
30
30
  }
31
31
 
32
32
  interface SwiperProps {
33
- children?: ReactNode;
34
- circular?: boolean;
35
- current?: number;
36
- interval?: number;
37
- autoplay?: boolean;
33
+ children?: ReactNode
34
+ circular?: boolean
35
+ current?: number
36
+ interval?: number
37
+ autoplay?: boolean
38
38
  // scrollView 只有安卓可以设
39
- duration?: number;
39
+ duration?: number
40
40
  // 滑动过程中元素是否scale变化
41
- scale?: boolean;
42
- 'indicator-dots'?: boolean;
43
- 'indicator-color'?: string;
44
- 'indicator-active-color'?: string;
45
- vertical?: boolean;
41
+ scale?: boolean
42
+ 'indicator-dots'?: boolean
43
+ 'indicator-color'?: string
44
+ 'indicator-active-color'?: string
45
+ vertical?: boolean
46
46
  style: {
47
47
  [key: string]: any
48
- };
49
- 'easing-function'?: EaseType;
50
- 'previous-margin'?: string;
51
- 'next-margin'?: string;
52
- 'enable-offset'?: boolean;
53
- 'enable-var': boolean;
54
- 'parent-font-size'?: number;
55
- 'parent-width'?: number;
56
- 'parent-height'?: number;
57
- 'external-var-context'?: Record<string, any>;
58
- bindchange?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
48
+ }
49
+ 'easing-function'?: EaseType
50
+ 'previous-margin'?: string
51
+ 'next-margin'?: string
52
+ 'enable-offset'?: boolean
53
+ 'enable-var': boolean
54
+ 'parent-font-size'?: number
55
+ 'parent-width'?: number
56
+ 'parent-height'?: number
57
+ 'external-var-context'?: Record<string, any>
58
+ bindchange?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void
59
59
  }
60
60
 
61
61
  /**
@@ -201,23 +201,29 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
201
201
  layoutProps,
202
202
  layoutStyle
203
203
  } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef, onLayout: onWrapperLayout })
204
- const innerProps = useInnerProps(props, {
205
- ref: nodeRef
206
- }, [
207
- 'style',
208
- 'indicator-dots',
209
- 'indicator-color',
210
- 'indicator-active-color',
211
- 'previous-margin',
212
- 'vertical',
213
- 'previous-margin',
214
- 'next-margin',
215
- 'easing-function',
216
- 'autoplay',
217
- 'circular',
218
- 'interval',
219
- 'easing-function'
220
- ], { layoutRef: layoutRef })
204
+ const innerProps = useInnerProps(
205
+ extendObject(
206
+ {},
207
+ props,
208
+ {
209
+ ref: nodeRef
210
+ }
211
+ ),
212
+ [
213
+ 'style',
214
+ 'indicator-dots',
215
+ 'indicator-color',
216
+ 'indicator-active-color',
217
+ 'previous-margin',
218
+ 'vertical',
219
+ 'previous-margin',
220
+ 'next-margin',
221
+ 'easing-function',
222
+ 'autoplay',
223
+ 'circular',
224
+ 'interval',
225
+ 'easing-function'
226
+ ], { layoutRef: layoutRef })
221
227
 
222
228
  function onWrapperLayout (e: LayoutChangeEvent) {
223
229
  const { width, height } = e.nativeEvent.layout
@@ -251,8 +257,8 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
251
257
  dots.push(<View style={[dotCommonStyle, { backgroundColor: unActionColor }]} key={i}></View>)
252
258
  }
253
259
  return (
254
- <View pointerEvents="none" style = {styles['pagination_' + dir]}>
255
- <View style = {[styles['pagerWrapper' + dir]]}>
260
+ <View pointerEvents="none" style={styles['pagination_' + dir]}>
261
+ <View style={[styles['pagerWrapper' + dir]]}>
256
262
  <Animated.View style={[
257
263
  dotCommonStyle,
258
264
  activeDotStyle,
@@ -266,8 +272,8 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
266
272
  ]}
267
273
  />
268
274
  {dots}
269
- </View>
270
- </View>)
275
+ </View>
276
+ </View>)
271
277
  }
272
278
 
273
279
  function renderItems () {
@@ -392,7 +398,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
392
398
  }
393
399
  }
394
400
 
395
- function getOffset (index:number, stepValue: number) {
401
+ function getOffset (index: number, stepValue: number) {
396
402
  if (!stepValue) return 0
397
403
  let targetOffset = 0
398
404
  if (circular && children.length > 1) {
@@ -404,7 +410,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
404
410
  return targetOffset
405
411
  }
406
412
 
407
- function updateCurrent (index:number, stepValue: number) {
413
+ function updateCurrent (index: number, stepValue: number) {
408
414
  const targetOffset = getOffset(index || 0, stepValue)
409
415
  if (targetOffset !== offset.value) {
410
416
  // 内部基于props.current!==currentIndex.value决定是否使用动画及更新currentIndex.value
@@ -712,21 +718,21 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
712
718
  function renderSwiper () {
713
719
  const arrPages: Array<ReactNode> | ReactNode = renderItems()
714
720
  return (<View style={[normalStyle, layoutStyle, styles.swiper]} {...layoutProps} {...innerProps}>
715
- <Animated.View style={[{
716
- flexDirection: dir === 'x' ? 'row' : 'column',
717
- width: '100%',
718
- height: '100%'
719
- }, animatedStyles]}>
720
- {wrapChildren({
721
- children: arrPages
722
- }, {
723
- hasVarDec,
724
- varContext: varContextRef.current,
725
- textStyle,
726
- textProps
727
- })}
728
- </Animated.View>
729
- {showsPagination && renderPagination()}
721
+ <Animated.View style={[{
722
+ flexDirection: dir === 'x' ? 'row' : 'column',
723
+ width: '100%',
724
+ height: '100%'
725
+ }, animatedStyles]}>
726
+ {wrapChildren({
727
+ children: arrPages
728
+ }, {
729
+ hasVarDec,
730
+ varContext: varContextRef.current,
731
+ textStyle,
732
+ textProps
733
+ })}
734
+ </Animated.View>
735
+ {showsPagination && renderPagination()}
730
736
  </View>)
731
737
  }
732
738
 
@@ -120,20 +120,25 @@ const _Switch = forwardRef<HandlerRef<Switch, _SwitchProps>, _SwitchProps>((prop
120
120
  }
121
121
  }, [])
122
122
 
123
- const innerProps = useInnerProps(props, extendObject({
124
- ref: nodeRef,
125
- style: extendObject({}, normalStyle, layoutStyle)
126
- },
127
- layoutProps,
128
- !disabled ? { [type === 'switch' ? 'onValueChange' : '_onChange']: onChange } : {})
129
- , [
130
- 'checked',
131
- 'disabled',
132
- 'type',
133
- 'color'
134
- ], {
135
- layoutRef
136
- })
123
+ const innerProps = useInnerProps(
124
+ extendObject(
125
+ {},
126
+ props,
127
+ layoutProps,
128
+ {
129
+ ref: nodeRef,
130
+ style: extendObject({}, normalStyle, layoutStyle)
131
+ },
132
+ !disabled ? { [type === 'switch' ? 'onValueChange' : '_onChange']: onChange } : {}
133
+ ),
134
+ [
135
+ 'checked',
136
+ 'disabled',
137
+ 'type',
138
+ 'color'
139
+ ],
140
+ { layoutRef }
141
+ )
137
142
 
138
143
  if (type === 'checkbox') {
139
144
  return createElement(
@@ -8,7 +8,7 @@ import { Text, TextStyle, TextProps } from 'react-native'
8
8
  import { useRef, forwardRef, ReactNode, JSX, createElement } from 'react'
9
9
  import useInnerProps from './getInnerListeners'
10
10
  import useNodesRef, { HandlerRef } from './useNodesRef' // 引入辅助函数
11
- import { useTransformStyle, wrapChildren } from './utils'
11
+ import { useTransformStyle, wrapChildren, extendObject } from './utils'
12
12
 
13
13
  interface _TextProps extends TextProps {
14
14
  style?: TextStyle
@@ -35,8 +35,6 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
35
35
  'parent-height': parentHeight
36
36
  } = props
37
37
 
38
- const layoutRef = useRef({})
39
-
40
38
  const {
41
39
  normalStyle,
42
40
  hasVarDec,
@@ -54,16 +52,21 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
54
52
  style: normalStyle
55
53
  })
56
54
 
57
- const innerProps = useInnerProps(props, {
58
- ref: nodeRef,
59
- style: normalStyle,
60
- selectable: !!selectable || !!userSelect,
61
- allowFontScaling
62
- }, [
63
- 'user-select'
64
- ], {
65
- layoutRef
66
- })
55
+ const innerProps = useInnerProps(
56
+ extendObject(
57
+ {},
58
+ props,
59
+ {
60
+ ref: nodeRef,
61
+ style: normalStyle,
62
+ selectable: !!selectable || !!userSelect,
63
+ allowFontScaling
64
+ }
65
+ ),
66
+ [
67
+ 'user-select'
68
+ ]
69
+ )
67
70
 
68
71
  return createElement(Text, innerProps, wrapChildren(
69
72
  props,