@mpxjs/webpack-plugin 2.9.66 → 2.9.69

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 (112) hide show
  1. package/lib/dependencies/RecordGlobalComponentsDependency.js +11 -12
  2. package/lib/dependencies/RecordRuntimeInfoDependency.js +1 -1
  3. package/lib/index.js +29 -8
  4. package/lib/json-compiler/index.js +2 -11
  5. package/lib/loader.js +24 -45
  6. package/lib/native-loader.js +49 -64
  7. package/lib/platform/json/wx/index.js +3 -10
  8. package/lib/platform/style/wx/index.js +15 -10
  9. package/lib/platform/template/wx/component-config/canvas.js +8 -0
  10. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  11. package/lib/react/index.js +4 -3
  12. package/lib/react/processJSON.js +5 -13
  13. package/lib/react/processMainScript.js +7 -3
  14. package/lib/react/processScript.js +3 -4
  15. package/lib/react/processStyles.js +14 -4
  16. package/lib/react/processTemplate.js +2 -2
  17. package/lib/resolver/AddModePlugin.js +20 -7
  18. package/lib/runtime/components/react/context.ts +2 -0
  19. package/lib/runtime/components/react/dist/context.js +1 -0
  20. package/lib/runtime/components/react/dist/getInnerListeners.js +3 -12
  21. package/lib/runtime/components/react/dist/mpx-button.jsx +44 -9
  22. package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
  23. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
  24. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
  25. package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
  26. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
  27. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
  28. package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
  29. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +214 -0
  30. package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
  31. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +30 -17
  32. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +1 -1
  33. package/lib/runtime/components/react/dist/mpx-form.jsx +33 -24
  34. package/lib/runtime/components/react/dist/mpx-icon.jsx +1 -1
  35. package/lib/runtime/components/react/dist/mpx-image/index.jsx +1 -1
  36. package/lib/runtime/components/react/dist/mpx-input.jsx +44 -38
  37. package/lib/runtime/components/react/dist/mpx-label.jsx +10 -7
  38. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +10 -17
  39. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +378 -294
  40. package/lib/runtime/components/react/dist/mpx-navigator.jsx +1 -1
  41. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +143 -84
  42. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +69 -113
  43. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +30 -17
  44. package/lib/runtime/components/react/dist/mpx-radio.jsx +1 -1
  45. package/lib/runtime/components/react/dist/mpx-root-portal.jsx +1 -1
  46. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +49 -29
  47. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +1 -1
  48. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +1 -1
  49. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +1 -1
  50. package/lib/runtime/components/react/dist/mpx-switch.jsx +8 -1
  51. package/lib/runtime/components/react/dist/mpx-text.jsx +1 -1
  52. package/lib/runtime/components/react/dist/mpx-textarea.jsx +1 -1
  53. package/lib/runtime/components/react/dist/mpx-view.jsx +46 -27
  54. package/lib/runtime/components/react/dist/mpx-web-view.jsx +20 -6
  55. package/lib/runtime/components/react/dist/pickerFaces.js +75 -0
  56. package/lib/runtime/components/react/dist/pickerOverlay.jsx +21 -0
  57. package/lib/runtime/components/react/dist/useAnimationHooks.js +96 -8
  58. package/lib/runtime/components/react/dist/utils.jsx +66 -6
  59. package/lib/runtime/components/react/getInnerListeners.ts +3 -16
  60. package/lib/runtime/components/react/mpx-button.tsx +42 -9
  61. package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
  62. package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
  63. package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
  64. package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
  65. package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
  66. package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
  67. package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
  68. package/lib/runtime/components/react/mpx-canvas/index.tsx +302 -0
  69. package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
  70. package/lib/runtime/components/react/mpx-checkbox-group.tsx +52 -29
  71. package/lib/runtime/components/react/mpx-checkbox.tsx +1 -1
  72. package/lib/runtime/components/react/mpx-form.tsx +42 -34
  73. package/lib/runtime/components/react/mpx-icon.tsx +1 -1
  74. package/lib/runtime/components/react/mpx-image/index.tsx +2 -3
  75. package/lib/runtime/components/react/mpx-input.tsx +68 -66
  76. package/lib/runtime/components/react/mpx-label.tsx +11 -8
  77. package/lib/runtime/components/react/mpx-movable-area.tsx +11 -19
  78. package/lib/runtime/components/react/mpx-movable-view.tsx +456 -334
  79. package/lib/runtime/components/react/mpx-navigator.tsx +1 -1
  80. package/lib/runtime/components/react/mpx-picker-view-column.tsx +232 -103
  81. package/lib/runtime/components/react/mpx-picker-view.tsx +126 -122
  82. package/lib/runtime/components/react/mpx-radio-group.tsx +55 -29
  83. package/lib/runtime/components/react/mpx-radio.tsx +1 -1
  84. package/lib/runtime/components/react/mpx-root-portal.tsx +1 -1
  85. package/lib/runtime/components/react/mpx-scroll-view.tsx +81 -36
  86. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +2 -2
  87. package/lib/runtime/components/react/mpx-swiper/index.tsx +2 -1
  88. package/lib/runtime/components/react/mpx-swiper-item.tsx +1 -1
  89. package/lib/runtime/components/react/mpx-switch.tsx +10 -2
  90. package/lib/runtime/components/react/mpx-text.tsx +1 -1
  91. package/lib/runtime/components/react/mpx-textarea.tsx +1 -1
  92. package/lib/runtime/components/react/mpx-view.tsx +58 -28
  93. package/lib/runtime/components/react/mpx-web-view.tsx +23 -6
  94. package/lib/runtime/components/react/pickerFaces.ts +104 -0
  95. package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
  96. package/lib/runtime/components/react/types/common.ts +2 -0
  97. package/lib/runtime/components/react/types/global.d.ts +2 -0
  98. package/lib/runtime/components/react/useAnimationHooks.ts +97 -13
  99. package/lib/runtime/components/react/useNodesRef.ts +1 -0
  100. package/lib/runtime/components/react/utils.tsx +94 -8
  101. package/lib/runtime/optionProcessorReact.js +0 -15
  102. package/lib/runtime/swanHelper.wxs +1 -1
  103. package/lib/style-compiler/index.js +1 -1
  104. package/lib/style-compiler/plugins/scope-id.js +1 -0
  105. package/lib/template-compiler/compiler.js +47 -16
  106. package/lib/template-compiler/gen-node-react.js +2 -2
  107. package/lib/template-compiler/index.js +4 -4
  108. package/lib/utils/pre-process-json.js +113 -0
  109. package/lib/web/index.js +5 -4
  110. package/lib/web/processJSON.js +5 -13
  111. package/lib/web/processTemplate.js +2 -2
  112. package/package.json +5 -4
@@ -1,9 +1,19 @@
1
1
  import { View } from 'react-native'
2
- import { LinearGradient, LinearGradientProps } from 'react-native-linear-gradient'
3
- import React, { forwardRef, useState, useRef, ReactElement, JSX } from 'react'
2
+ import React, { forwardRef, useState, useRef } from 'react'
4
3
  import useInnerProps, { getCustomEvent } from './getInnerListeners'
5
- import useNodesRef, { HandlerRef } from './useNodesRef' // 引入辅助函数
6
- import { parseInlineStyle, useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren } from './utils'
4
+ import useNodesRef, { HandlerRef } from './useNodesRef'
5
+ import {
6
+ useLayout,
7
+ splitProps,
8
+ splitStyle,
9
+ wrapChildren,
10
+ parseInlineStyle,
11
+ useTransformStyle,
12
+ useDebounceCallback,
13
+ useStableCallback,
14
+ extendObject
15
+ } from './utils'
16
+ import type { AnyFunc } from './types/common'
7
17
  /**
8
18
  * ✔ value
9
19
  * ✔ bindchange
@@ -18,9 +28,10 @@ import { parseInlineStyle, useTransformStyle, splitStyle, splitProps, useLayout,
18
28
 
19
29
  interface PickerViewProps {
20
30
  children: React.ReactNode
21
- // 初始的defaultValue数组中的数字依次表示 picker-view 内的 picker-view-column 选择的第几项(下标从 0 开始),数字大于 picker-view-column 可选项长度时,选择最后一项。
31
+ // 初始的defaultValue数组中的数字依次表示 picker-view 内的 picker-view-column 选择的第几项(下标从 0 开始),
32
+ // 数字大于 picker-view-column 可选项长度时,选择最后一项。
22
33
  value?: Array<number>
23
- bindchange?: Function
34
+ bindchange?: AnyFunc
24
35
  style: {
25
36
  [key: string]: any
26
37
  }
@@ -48,27 +59,29 @@ const styles: { [key: string]: Object } = {
48
59
  justifyContent: 'space-around',
49
60
  overflow: 'hidden',
50
61
  alignItems: 'center'
51
- },
52
- maskTop: {
53
- position: 'absolute',
54
- width: 1000,
55
- zIndex: 100
56
- },
57
- maskBottom: {
58
- position: 'absolute',
59
- width: 1000,
60
- zIndex: 100
61
62
  }
62
63
  }
64
+
63
65
  const _PickerView = forwardRef<HandlerRef<View, PickerViewProps>, PickerViewProps>((props: PickerViewProps, ref) => {
64
- const { children, value = [], bindchange, style, 'enable-var': enableVar, 'external-var-context': externalVarContext } = props
66
+ const {
67
+ children,
68
+ value = [],
69
+ bindchange,
70
+ style,
71
+ 'enable-var': enableVar,
72
+ 'external-var-context': externalVarContext
73
+ } = props
74
+
65
75
  // indicatorStyle 需要转换为rn的style
66
76
  // 微信设置到pick-view上上设置的normalStyle如border等需要转换成RN的style然后进行透传
67
77
  const indicatorStyle = parseInlineStyle(props['indicator-style'])
68
- const { height: indicatorH, width: indicatorW } = indicatorStyle
78
+ const { height: indicatorH, ...pickerOverlayStyle } = indicatorStyle
79
+ const [pickMaxH, setPickMaxH] = useState(0)
69
80
  const nodeRef = useRef(null)
70
- useNodesRef<View, PickerViewProps>(props, ref, nodeRef, {})
71
- // picker-view 设置的color等textStyle,在小程序上的表现是可以继承到最内层的text样式, 但是RN内部column是slot无法设置, 需要业务自己在column内的元素上设置
81
+ const cloneRef = useRef(null)
82
+ const activeValueRef = useRef(value)
83
+ activeValueRef.current = value.slice()
84
+
72
85
  const {
73
86
  normalStyle,
74
87
  hasVarDec,
@@ -77,69 +90,85 @@ const _PickerView = forwardRef<HandlerRef<View, PickerViewProps>, PickerViewProp
77
90
  setWidth,
78
91
  setHeight
79
92
  } = useTransformStyle(style, { enableVar, externalVarContext })
80
- const { textStyle } = splitStyle(normalStyle)
81
- const { textProps } = splitProps(props)
93
+ useNodesRef<View, PickerViewProps>(props, ref, nodeRef, {})
82
94
  const {
83
95
  // 存储layout布局信息
84
96
  layoutRef,
85
97
  layoutProps,
86
98
  layoutStyle
87
99
  } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: nodeRef })
100
+ const { textProps } = splitProps(props)
101
+ const { textStyle } = splitStyle(normalStyle)
88
102
 
89
- const isSetW = indicatorW !== undefined ? 1 : 0
90
- const cloneRef = useRef(null)
91
- const maskPos: PosType = {}
92
- let [pickH, setPickH] = useState(0)
93
- const itemH = pickH / 5
94
- if (normalStyle?.height && pickH && pickH !== normalStyle?.height) {
95
- maskPos.height = itemH * 2 + Math.ceil((normalStyle.height - pickH) / 2)
96
- } else {
97
- maskPos.height = itemH * 2
103
+ const onColumnItemRawHChange = (height: number) => {
104
+ if (height > pickMaxH) {
105
+ setPickMaxH(height)
106
+ }
98
107
  }
99
108
 
100
- const onColumnLayoutChange = (layoutConfig: PickerLayout) => {
101
- pickH = layoutConfig.height
102
- setPickH(layoutConfig.height)
109
+ const bindchangeDebounce = useDebounceCallback(useStableCallback(bindchange), 300)
110
+
111
+ const onSelectChange = (columnIndex: number, selectedIndex: number) => {
112
+ bindchangeDebounce.clear()
113
+ const activeValue = activeValueRef.current
114
+ activeValue[columnIndex] = selectedIndex
115
+ const eventData = getCustomEvent(
116
+ 'change',
117
+ {},
118
+ { detail: { value: activeValue, source: 'change' }, layoutRef }
119
+ )
120
+ bindchangeDebounce(eventData)
103
121
  }
104
122
 
105
- const onSelectChange = (columnIndex: number, selIndex: number) => {
106
- const changeValue = value.slice()
107
- changeValue[columnIndex] = selIndex
108
- const eventData = getCustomEvent('change', {}, { detail: { value: changeValue, source: 'change' }, layoutRef })
109
- bindchange && bindchange(eventData)
123
+ const onInitialChange = (value: number[]) => {
124
+ const eventData = getCustomEvent(
125
+ 'change',
126
+ {},
127
+ { detail: { value, source: 'change' }, layoutRef }
128
+ )
129
+ bindchange?.(eventData) // immediate
110
130
  }
111
131
 
112
- const innerProps = useInnerProps(props, {
113
- ref: nodeRef,
114
- style: {
115
- ...normalStyle,
116
- ...layoutStyle,
117
- position: 'relative',
118
- overflow: 'hidden'
119
- },
120
- ...layoutProps
121
- }, [
122
- 'enable-offset'
123
- ], { layoutRef })
124
-
125
- const cloneChild = (child: React.ReactNode, index: number) => {
126
- // const extraProps = index === 0 ? { getInnerLayout: getInnerLayout, innerProps } : {}
132
+ const innerProps = useInnerProps(
133
+ props,
134
+ extendObject({
135
+ ref: nodeRef,
136
+ style: extendObject(
137
+ normalStyle,
138
+ layoutStyle,
139
+ {
140
+ position: 'relative',
141
+ overflow: 'hidden'
142
+ }
143
+ ),
144
+ layoutProps
145
+ }),
146
+ ['enable-offset'],
147
+ { layoutRef }
148
+ )
149
+
150
+ const renderColumn = (child: React.ReactElement, index: number, columnData: React.ReactNode[], initialIndex: number) => {
127
151
  const extraProps = {}
128
- const childProps = {
129
- ...(child as ReactElement)?.props,
130
- ref: cloneRef,
131
- prefix: index,
132
- key: 'pick-view' + index,
133
- wrapperStyle: {
134
- height: normalStyle?.height || 0,
135
- itemHeight: indicatorH || 0
152
+ const childProps = child?.props || {}
153
+ const wrappedProps = extendObject(
154
+ childProps,
155
+ {
156
+ columnData,
157
+ ref: cloneRef,
158
+ columnIndex: index,
159
+ key: `pick-view-${index}`,
160
+ wrapperStyle: {
161
+ height: normalStyle?.height || 0,
162
+ itemHeight: indicatorH || 0
163
+ },
164
+ onColumnItemRawHChange,
165
+ onSelectChange: onSelectChange.bind(null, index),
166
+ initialIndex,
167
+ pickerOverlayStyle
136
168
  },
137
- onColumnLayoutChange,
138
- onSelectChange: onSelectChange.bind(null, index),
139
- selectedIndex: value?.[index] || 0,
140
- ...extraProps
141
- }
142
- const realElement = React.cloneElement(child as ReactElement, childProps)
169
+ extraProps
170
+ )
171
+ const realElement = React.cloneElement(child, wrappedProps)
143
172
  return wrapChildren(
144
173
  {
145
174
  children: realElement
@@ -153,69 +182,44 @@ const _PickerView = forwardRef<HandlerRef<View, PickerViewProps>, PickerViewProp
153
182
  )
154
183
  }
155
184
 
156
- const renderTopMask = () => {
157
- const linearProps: LinearGradientProps = {
158
- colors: ['rgba(255,255,255,0.8)', 'rgba(255,255,255,0.2)'],
159
- style: [
160
- styles.maskTop,
161
- {
162
- height: maskPos.height,
163
- top: 0,
164
- pointerEvents: 'none'
165
- }
166
- ]
167
- }
168
- return (<LinearGradient {...linearProps}/>)
185
+ const validateChildInitialIndex = (index: number, data: React.ReactNode[]) => {
186
+ return Math.max(0, Math.min(value[index] || 0, data.length - 1))
169
187
  }
170
188
 
171
- const renderBottomMask = () => {
172
- const linearProps: LinearGradientProps = {
173
- colors: ['rgba(255,255,255,0.2)', 'rgba(255,255,255,0.8)'],
174
- style: [
175
- styles.maskBottom,
176
- {
177
- height: maskPos.height,
178
- bottom: 0,
179
- pointerEvents: 'none'
180
- }
181
- ]
189
+ const flatColumnChildren = (data: React.ReactElement) => {
190
+ const columnData = React.Children.toArray(data?.props?.children)
191
+ if (columnData.length === 1 && React.isValidElement(columnData[0]) && columnData[0].type === React.Fragment) {
192
+ // 只有一个 Fragment 嵌套情况
193
+ return React.Children.toArray(columnData[0].props.children)
182
194
  }
183
- return <LinearGradient {...linearProps}></LinearGradient>
195
+ return columnData
184
196
  }
185
197
 
186
- const renderLine = () => {
187
- return <View style={[{
188
- position: 'absolute',
189
- top: '50%',
190
- transform: [{ translateY: -(itemH / 2) }],
191
- height: itemH,
192
- borderTopWidth: 1,
193
- borderBottomWidth: 1,
194
- borderColor: '#f0f0f0',
195
- width: '100%',
196
- zIndex: 101
197
- }]}></View>
198
+ const renderPickerColumns = () => {
199
+ const columns = React.Children.toArray(children)
200
+ const renderColumns: React.ReactNode[] = []
201
+ const validValue: number[] = []
202
+ let isInvalid = false
203
+ columns.forEach((item: React.ReactElement, index) => {
204
+ const columnData = flatColumnChildren(item)
205
+ const validIndex = validateChildInitialIndex(index, columnData)
206
+ if (validIndex !== value[index]) {
207
+ isInvalid = true
208
+ }
209
+ validValue.push(validIndex)
210
+ renderColumns.push(renderColumn(item, index, columnData, validIndex))
211
+ })
212
+ isInvalid && onInitialChange(validValue)
213
+ return renderColumns
198
214
  }
199
215
 
200
- const renderSubChild = () => {
201
- if (Array.isArray(children)) {
202
- return children.map((item, index) => {
203
- return cloneChild(item, index)
204
- })
205
- } else {
206
- return cloneChild(children, 0)
207
- }
208
- }
209
- return (<View {...innerProps}>
210
- {renderTopMask()}
211
- <View style={[styles.wrapper]}>
212
- {renderSubChild()}
216
+ return (
217
+ <View {...innerProps}>
218
+ <View style={[styles.wrapper]}>{renderPickerColumns()}</View>
213
219
  </View>
214
- {renderBottomMask()}
215
- {!isSetW && renderLine()}
216
- </View>)
220
+ )
217
221
  })
218
222
 
219
- _PickerView.displayName = 'mpx-picker-view'
223
+ _PickerView.displayName = 'MpxPickerView'
220
224
 
221
225
  export default _PickerView
@@ -1,9 +1,22 @@
1
1
  /**
2
2
  * ✔ bindchange
3
3
  */
4
- import { JSX, useRef, forwardRef, ReactNode, useContext } from 'react'
5
- import { View, NativeSyntheticEvent, ViewStyle } from 'react-native'
4
+ import {
5
+ JSX,
6
+ useRef,
7
+ forwardRef,
8
+ ReactNode,
9
+ useContext,
10
+ useMemo,
11
+ useEffect
12
+ } from 'react'
13
+ import {
14
+ View,
15
+ NativeSyntheticEvent,
16
+ ViewStyle
17
+ } from 'react-native'
6
18
  import { warn } from '@mpxjs/utils'
19
+
7
20
  import { FormContext, FormFieldValue, RadioGroupContext, GroupValue } from './context'
8
21
  import useInnerProps, { getCustomEvent } from './getInnerListeners'
9
22
  import useNodesRef, { HandlerRef } from './useNodesRef'
@@ -32,10 +45,13 @@ const radioGroup = forwardRef<
32
45
  'external-var-context': externalVarContext,
33
46
  'parent-font-size': parentFontSize,
34
47
  'parent-width': parentWidth,
35
- 'parent-height': parentHeight,
36
- bindchange
48
+ 'parent-height': parentHeight
37
49
  } = props
38
50
 
51
+ const propsRef = useRef<any>({})
52
+
53
+ propsRef.current = props
54
+
39
55
  const formContext = useContext(FormContext)
40
56
 
41
57
  let formValuesMap: Map<string, FormFieldValue> | undefined
@@ -70,7 +86,7 @@ const radioGroup = forwardRef<
70
86
 
71
87
  const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef })
72
88
 
73
- const getSelectionValue = (): string | undefined => {
89
+ const getValue = (): string | undefined => {
74
90
  for (const key in groupValue) {
75
91
  if (groupValue[key].checked) {
76
92
  return key
@@ -78,10 +94,6 @@ const radioGroup = forwardRef<
78
94
  }
79
95
  }
80
96
 
81
- const getValue = () => {
82
- return getSelectionValue()
83
- }
84
-
85
97
  const resetValue = () => {
86
98
  Object.keys(groupValue).forEach((key) => {
87
99
  groupValue[key].checked = false
@@ -96,25 +108,39 @@ const radioGroup = forwardRef<
96
108
  formValuesMap.set(props.name, { getValue, resetValue })
97
109
  }
98
110
  }
99
-
100
- const notifyChange = (
101
- evt: NativeSyntheticEvent<TouchEvent>
102
- ) => {
103
- bindchange &&
104
- bindchange(
105
- getCustomEvent(
106
- 'tap',
107
- evt,
108
- {
109
- layoutRef,
110
- detail: {
111
- value: getSelectionValue()
112
- }
113
- },
114
- props
111
+ useEffect(() => {
112
+ return () => {
113
+ if (formValuesMap && props.name) {
114
+ formValuesMap.delete(props.name)
115
+ }
116
+ }
117
+ }, [])
118
+
119
+ const contextValue = useMemo(() => {
120
+ const notifyChange = (
121
+ evt: NativeSyntheticEvent<TouchEvent>
122
+ ) => {
123
+ const { bindchange } = propsRef.current
124
+ bindchange &&
125
+ bindchange(
126
+ getCustomEvent(
127
+ 'tap',
128
+ evt,
129
+ {
130
+ layoutRef,
131
+ detail: {
132
+ value: getValue()
133
+ }
134
+ },
135
+ propsRef.current
136
+ )
115
137
  )
116
- )
117
- }
138
+ }
139
+ return {
140
+ groupValue,
141
+ notifyChange
142
+ }
143
+ }, [])
118
144
 
119
145
  const innerProps = useInnerProps(
120
146
  props,
@@ -131,7 +157,7 @@ const radioGroup = forwardRef<
131
157
 
132
158
  return (
133
159
  <View {...innerProps}>
134
- <RadioGroupContext.Provider value={{ groupValue, notifyChange }}>
160
+ <RadioGroupContext.Provider value={contextValue}>
135
161
  {
136
162
  wrapChildren(
137
163
  props,
@@ -146,6 +172,6 @@ const radioGroup = forwardRef<
146
172
  )
147
173
  })
148
174
 
149
- radioGroup.displayName = 'mpx-radio-group'
175
+ radioGroup.displayName = 'MpxRadioGroup'
150
176
 
151
177
  export default radioGroup
@@ -226,6 +226,6 @@ const Radio = forwardRef<HandlerRef<View, RadioProps>, RadioProps>(
226
226
  }
227
227
  )
228
228
 
229
- Radio.displayName = 'mpx-radio'
229
+ Radio.displayName = 'MpxRadio'
230
230
 
231
231
  export default Radio
@@ -22,6 +22,6 @@ const _RootPortal = (props: RootPortalProps) => {
22
22
  : <>{children}</>
23
23
  }
24
24
 
25
- _RootPortal.displayName = 'mpx-root-portal'
25
+ _RootPortal.displayName = 'MpxRootPortal'
26
26
 
27
27
  export default _RootPortal