@mpxjs/webpack-plugin 2.9.67 → 2.9.70-alpha.0

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 (161) hide show
  1. package/README.md +1 -1
  2. package/lib/config.js +14 -0
  3. package/lib/dependencies/AddEntryDependency.js +24 -0
  4. package/lib/dependencies/ResolveDependency.js +5 -0
  5. package/lib/index.js +51 -15
  6. package/lib/json-compiler/helper.js +3 -3
  7. package/lib/loader.js +53 -0
  8. package/lib/platform/template/wx/component-config/button.js +14 -2
  9. package/lib/platform/template/wx/component-config/canvas.js +8 -0
  10. package/lib/platform/template/wx/component-config/image.js +4 -0
  11. package/lib/platform/template/wx/component-config/input.js +5 -1
  12. package/lib/platform/template/wx/component-config/rich-text.js +4 -0
  13. package/lib/platform/template/wx/component-config/scroll-view.js +4 -0
  14. package/lib/platform/template/wx/component-config/swiper.js +1 -1
  15. package/lib/platform/template/wx/component-config/switch.js +4 -0
  16. package/lib/platform/template/wx/component-config/text.js +4 -0
  17. package/lib/platform/template/wx/component-config/textarea.js +6 -1
  18. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  19. package/lib/platform/template/wx/component-config/view.js +4 -0
  20. package/lib/platform/template/wx/index.js +127 -1
  21. package/lib/react/processStyles.js +14 -4
  22. package/lib/react/processTemplate.js +3 -0
  23. package/lib/resolve-loader.js +4 -1
  24. package/lib/resolver/AddModePlugin.js +8 -8
  25. package/lib/runtime/components/react/context.ts +6 -0
  26. package/lib/runtime/components/react/dist/context.js +2 -0
  27. package/lib/runtime/components/react/dist/event.config.js +24 -24
  28. package/lib/runtime/components/react/dist/getInnerListeners.js +183 -174
  29. package/lib/runtime/components/react/dist/mpx-button.jsx +77 -49
  30. package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
  31. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
  32. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
  33. package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
  34. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
  35. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
  36. package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
  37. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +232 -0
  38. package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
  39. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +13 -19
  40. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +29 -38
  41. package/lib/runtime/components/react/dist/mpx-form.jsx +16 -19
  42. package/lib/runtime/components/react/dist/mpx-icon.jsx +8 -16
  43. package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
  44. package/lib/runtime/components/react/dist/mpx-input.jsx +54 -27
  45. package/lib/runtime/components/react/dist/mpx-label.jsx +15 -22
  46. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +13 -16
  47. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +13 -13
  48. package/lib/runtime/components/react/dist/mpx-navigator.jsx +2 -4
  49. package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
  50. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
  51. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
  52. package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
  53. package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
  54. package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
  55. package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
  56. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +160 -88
  57. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +80 -121
  58. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +11 -19
  59. package/lib/runtime/components/react/dist/mpx-radio.jsx +27 -42
  60. package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
  61. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
  62. package/lib/runtime/components/react/dist/mpx-root-portal.jsx +6 -4
  63. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +47 -41
  64. package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
  65. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -2
  66. package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
  67. package/lib/runtime/components/react/dist/mpx-switch.jsx +20 -10
  68. package/lib/runtime/components/react/dist/mpx-text.jsx +11 -10
  69. package/lib/runtime/components/react/dist/mpx-textarea.jsx +8 -3
  70. package/lib/runtime/components/react/dist/mpx-view.jsx +65 -61
  71. package/lib/runtime/components/react/dist/mpx-web-view.jsx +112 -35
  72. package/lib/runtime/components/react/dist/pickerFaces.js +81 -0
  73. package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
  74. package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
  75. package/lib/runtime/components/react/dist/pickerViewOverlay.jsx +23 -0
  76. package/lib/runtime/components/react/dist/useAnimationHooks.js +35 -9
  77. package/lib/runtime/components/react/dist/utils.jsx +70 -23
  78. package/lib/runtime/components/react/getInnerListeners.ts +36 -43
  79. package/lib/runtime/components/react/mpx-button.tsx +95 -43
  80. package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
  81. package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
  82. package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
  83. package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
  84. package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
  85. package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
  86. package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
  87. package/lib/runtime/components/react/mpx-canvas/index.tsx +302 -0
  88. package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
  89. package/lib/runtime/components/react/mpx-checkbox-group.tsx +13 -12
  90. package/lib/runtime/components/react/mpx-checkbox.tsx +28 -28
  91. package/lib/runtime/components/react/mpx-form.tsx +10 -8
  92. package/lib/runtime/components/react/mpx-icon.tsx +10 -15
  93. package/lib/runtime/components/react/mpx-image.tsx +396 -0
  94. package/lib/runtime/components/react/mpx-input.tsx +61 -33
  95. package/lib/runtime/components/react/mpx-label.tsx +14 -13
  96. package/lib/runtime/components/react/mpx-movable-area.tsx +8 -7
  97. package/lib/runtime/components/react/mpx-movable-view.tsx +1 -1
  98. package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
  99. package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
  100. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
  101. package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
  102. package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
  103. package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
  104. package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
  105. package/lib/runtime/components/react/mpx-picker-view-column.tsx +236 -104
  106. package/lib/runtime/components/react/mpx-picker-view.tsx +132 -122
  107. package/lib/runtime/components/react/mpx-radio-group.tsx +11 -12
  108. package/lib/runtime/components/react/mpx-radio.tsx +26 -29
  109. package/lib/runtime/components/react/mpx-scroll-view.tsx +32 -30
  110. package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
  111. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +4 -2
  112. package/lib/runtime/components/react/mpx-swiper-item.tsx +3 -2
  113. package/lib/runtime/components/react/mpx-switch.tsx +10 -8
  114. package/lib/runtime/components/react/mpx-text.tsx +6 -2
  115. package/lib/runtime/components/react/mpx-view.tsx +81 -59
  116. package/lib/runtime/components/react/mpx-web-view.tsx +46 -19
  117. package/lib/runtime/components/react/pickerFaces.ts +104 -0
  118. package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
  119. package/lib/runtime/components/react/types/common.ts +2 -0
  120. package/lib/runtime/components/react/types/global.d.ts +3 -16
  121. package/lib/runtime/components/react/utils.tsx +98 -27
  122. package/lib/runtime/components/tenon/getInnerListeners.js +334 -0
  123. package/lib/runtime/components/tenon/tenon-button.vue +309 -0
  124. package/lib/runtime/components/tenon/tenon-image.vue +66 -0
  125. package/lib/runtime/components/tenon/tenon-input.vue +171 -0
  126. package/lib/runtime/components/tenon/tenon-rich-text.vue +26 -0
  127. package/lib/runtime/components/tenon/tenon-scroll-view.vue +127 -0
  128. package/lib/runtime/components/tenon/tenon-switch.vue +96 -0
  129. package/lib/runtime/components/tenon/tenon-text.vue +70 -0
  130. package/lib/runtime/components/tenon/tenon-textarea.vue +86 -0
  131. package/lib/runtime/components/tenon/tenon-view.vue +93 -0
  132. package/lib/runtime/components/web/getInnerListeners.js +6 -6
  133. package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
  134. package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
  135. package/lib/runtime/components/web/mpx-picker.vue +382 -385
  136. package/lib/runtime/components/web/mpx-web-view.vue +162 -162
  137. package/lib/runtime/optionProcessor.js +7 -16
  138. package/lib/runtime/optionProcessor.tenon.js +84 -0
  139. package/lib/runtime/utils.js +2 -0
  140. package/lib/style-compiler/index.js +1 -1
  141. package/lib/style-compiler/plugins/hm.js +20 -0
  142. package/lib/template-compiler/bind-this.js +7 -2
  143. package/lib/template-compiler/compiler.js +70 -42
  144. package/lib/template-compiler/gen-node-react.js +3 -3
  145. package/lib/tenon/index.js +117 -0
  146. package/lib/tenon/processJSON.js +352 -0
  147. package/lib/tenon/processScript.js +203 -0
  148. package/lib/tenon/processStyles.js +21 -0
  149. package/lib/tenon/processTemplate.js +126 -0
  150. package/lib/tenon/script-helper.js +223 -0
  151. package/lib/utils/env.js +6 -1
  152. package/lib/utils/get-relative-path.js +25 -0
  153. package/package.json +9 -4
  154. package/LICENSE +0 -433
  155. package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
  156. package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
  157. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
  158. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
  159. package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
  160. package/lib/runtime/components/react/mpx-image/index.tsx +0 -345
  161. package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
@@ -1,345 +0,0 @@
1
- /**
2
- * ✔ src
3
- * - mode: Partially, Only SVG format do not support
4
- * ✘ show-menu-by-longpress
5
- * ✔ binderror
6
- * ✔ bindload
7
- * ✘ fade-in
8
- * ✔ webp
9
- * ✘ lazy-load
10
- * ✔ bindtap
11
- * ✔ DEFAULT_SIZE
12
- */
13
- import { useEffect, useMemo, useState, useRef, forwardRef } from 'react'
14
-
15
- import {
16
- Image as RNImage,
17
- View,
18
- ImageStyle,
19
- ImageSourcePropType,
20
- ImageResizeMode,
21
- StyleSheet,
22
- NativeSyntheticEvent,
23
- ImageErrorEventData,
24
- LayoutChangeEvent,
25
- DimensionValue,
26
- ImageLoadEventData
27
- } from 'react-native'
28
- import useInnerProps, { getCustomEvent } from '../getInnerListeners'
29
- import useNodesRef, { HandlerRef } from '../useNodesRef'
30
- import { useLayout, useTransformStyle } from '../utils'
31
-
32
- export type Mode =
33
- | 'scaleToFill'
34
- | 'aspectFit'
35
- | 'aspectFill'
36
- | 'widthFix'
37
- | 'heightFix'
38
- | 'top'
39
- | 'bottom'
40
- | 'center'
41
- | 'left'
42
- | 'right'
43
- | 'top left'
44
- | 'top right'
45
- | 'bottom left'
46
- | 'bottom right'
47
-
48
- export type SvgNumberProp = string | number | undefined
49
-
50
- export interface ImageProps {
51
- src?: string
52
- mode?: Mode
53
- svg?: boolean
54
- style?: ImageStyle & Record<string, any>
55
- 'enable-offset'?: boolean;
56
- 'enable-var'?: boolean
57
- 'external-var-context'?: Record<string, any>
58
- 'parent-font-size'?: number
59
- 'parent-width'?: number
60
- 'parent-height'?: number
61
- bindload?: (evt: NativeSyntheticEvent<ImageLoadEventData> | unknown) => void
62
- binderror?: (evt: NativeSyntheticEvent<ImageErrorEventData> | unknown) => void
63
- }
64
-
65
- const DEFAULT_IMAGE_WIDTH = 320
66
- const DEFAULT_IMAGE_HEIGHT = 240
67
- // const REMOTE_SVG_REGEXP = /https?:\/\/.*\.(?:svg)/i
68
-
69
- // const styls = StyleSheet.create({
70
- // suspense: {
71
- // display: 'flex',
72
- // justifyContent: 'center',
73
- // alignItems: 'center',
74
- // width: '100%',
75
- // height: '100%',
76
- // },
77
- // })
78
-
79
- const cropMode: Mode[] = [
80
- 'top',
81
- 'bottom',
82
- 'center',
83
- 'right',
84
- 'left',
85
- 'top left',
86
- 'top right',
87
- 'bottom left',
88
- 'bottom right'
89
- ]
90
-
91
- const ModeMap = new Map<Mode, ImageResizeMode | undefined>([
92
- ['scaleToFill', 'stretch'],
93
- ['aspectFit', 'contain'],
94
- ['aspectFill', 'cover'],
95
- ['widthFix', 'stretch'],
96
- ['heightFix', 'stretch'],
97
- ...cropMode.map<[Mode, ImageResizeMode]>(mode => [mode, 'stretch'])
98
- ])
99
-
100
- const isNumber = (value: DimensionValue) => typeof value === 'number'
101
-
102
- const relativeCenteredSize = (viewSize: number, imageSize: number) => (viewSize - imageSize) / 2
103
-
104
- // const Svg = lazy(() => import('./svg'))
105
-
106
- // const Fallback = (
107
- // <View style={styls.suspense}>
108
- // <Text>loading ...</Text>
109
- // </View>
110
- // )
111
-
112
- const Image = forwardRef<HandlerRef<RNImage, ImageProps>, ImageProps>((props, ref): JSX.Element => {
113
- const {
114
- src = '',
115
- mode = 'scaleToFill',
116
- // svg = false,
117
- style = {},
118
- 'enable-var': enableVar,
119
- 'external-var-context': externalVarContext,
120
- 'parent-font-size': parentFontSize,
121
- 'parent-width': parentWidth,
122
- 'parent-height': parentHeight,
123
- bindload,
124
- binderror
125
- } = props
126
-
127
- const defaultStyle = {
128
- width: DEFAULT_IMAGE_WIDTH,
129
- height: DEFAULT_IMAGE_HEIGHT
130
- }
131
-
132
- const styleObj = {
133
- ...defaultStyle,
134
- ...style,
135
- overflow: 'hidden'
136
- }
137
-
138
- const nodeRef = useRef(null)
139
- useNodesRef(props, ref, nodeRef, {
140
- defaultStyle
141
- })
142
-
143
- const onLayout = ({ nativeEvent: { layout: { width, height } } }: LayoutChangeEvent) => {
144
- setViewWidth(width)
145
- setViewHeight(height)
146
- }
147
-
148
- const { normalStyle, hasSelfPercent, setWidth, setHeight } = useTransformStyle(styleObj, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight })
149
-
150
- const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef, onLayout })
151
-
152
- const { width, height } = normalStyle
153
-
154
- const preSrc = useRef<string | undefined>()
155
-
156
- const resizeMode: ImageResizeMode = ModeMap.get(mode) || 'stretch'
157
- const isWidthFixMode = mode === 'widthFix'
158
- const isHeightFixMode = mode === 'heightFix'
159
- const isCropMode = cropMode.includes(mode)
160
-
161
- const source: ImageSourcePropType = typeof src === 'string' ? { uri: src } : src
162
-
163
- const [viewWidth, setViewWidth] = useState(isNumber(width) ? width : 0)
164
- const [viewHeight, setViewHeight] = useState(isNumber(height) ? height : 0)
165
- const [imageWidth, setImageWidth] = useState(0)
166
- const [imageHeight, setImageHeight] = useState(0)
167
- const [ratio, setRatio] = useState(0)
168
- const [loaded, setLoaded] = useState(false)
169
-
170
- const fixedHeight = useMemo(() => {
171
- const fixed = viewWidth * ratio
172
- return !fixed ? viewHeight : fixed
173
- }, [ratio, viewWidth, viewHeight])
174
-
175
- const fixedWidth = useMemo(() => {
176
- if (!ratio) return viewWidth
177
- const fixed = viewHeight / ratio
178
- return !fixed ? viewWidth : fixed
179
- }, [ratio, viewWidth, viewHeight])
180
-
181
- const cropModeStyle: ImageStyle = useMemo(() => {
182
- switch (mode) {
183
- case 'top':
184
- return { top: 0, left: relativeCenteredSize(viewWidth, imageWidth) }
185
- case 'bottom':
186
- return { top: 'auto', bottom: 0, left: relativeCenteredSize(viewWidth, imageWidth) }
187
- case 'center':
188
- return { top: relativeCenteredSize(viewHeight, imageHeight), left: relativeCenteredSize(viewWidth, imageWidth) }
189
- case 'left':
190
- return { top: relativeCenteredSize(viewHeight, imageHeight), left: 0 }
191
- case 'right':
192
- return { top: relativeCenteredSize(viewHeight, imageHeight), left: 'auto', right: 0 }
193
- case 'top left':
194
- return { top: 0, left: 0 }
195
- case 'top right':
196
- return { top: 0, left: 'auto', right: 0 }
197
- case 'bottom left':
198
- return { top: 'auto', bottom: 0, left: 0 }
199
- case 'bottom right':
200
- return { top: 'auto', bottom: 0, left: 'auto', right: 0 }
201
- default:
202
- return {}
203
- }
204
- }, [mode, viewWidth, viewHeight, imageWidth, imageHeight])
205
-
206
- const onImageLoad = (evt: NativeSyntheticEvent<ImageLoadEventData>) => {
207
- if (!bindload) return
208
- if (typeof src === 'string') {
209
- evt.persist()
210
- RNImage.getSize(src, (width: number, height: number) => {
211
- bindload(
212
- getCustomEvent(
213
- 'load',
214
- evt,
215
- {
216
- detail: { width, height },
217
- layoutRef
218
- },
219
- props
220
- )
221
- )
222
- })
223
- } else {
224
- const { width = 0, height = 0 } = RNImage.resolveAssetSource(src) || {}
225
- bindload(
226
- getCustomEvent(
227
- 'load',
228
- evt,
229
- {
230
- detail: { width, height },
231
- layoutRef
232
- },
233
- props
234
- )
235
- )
236
- }
237
- }
238
-
239
- const onImageError = (evt: NativeSyntheticEvent<ImageErrorEventData>) => {
240
- binderror &&
241
- binderror(
242
- getCustomEvent(
243
- 'error',
244
- evt,
245
- {
246
- detail: { errMsg: evt.nativeEvent.error },
247
- layoutRef
248
- },
249
- props
250
- )
251
- )
252
- }
253
-
254
- useEffect(() => {
255
- if (!isWidthFixMode && !isHeightFixMode && !isCropMode) {
256
- setLoaded(true)
257
- return
258
- }
259
-
260
- const changed = preSrc.current !== src
261
- preSrc.current = src
262
- changed && setLoaded(false)
263
-
264
- if (typeof src === 'string') {
265
- RNImage.getSize(src, (width: number, height: number) => {
266
- if (isWidthFixMode || isHeightFixMode) {
267
- setRatio(width === 0 ? 0 : height / width)
268
- }
269
- if (isCropMode) {
270
- setImageWidth(width)
271
- setImageHeight(height)
272
- }
273
- changed && setLoaded(true)
274
- })
275
- } else {
276
- const { width = 0, height = 0 } = RNImage.resolveAssetSource(src) || {}
277
- if (isWidthFixMode || isHeightFixMode) {
278
- setRatio(width === 0 ? 0 : height / width)
279
- }
280
- if (isCropMode) {
281
- setImageWidth(width)
282
- setImageHeight(height)
283
- }
284
- changed && setLoaded(true)
285
- }
286
- }, [isWidthFixMode, isHeightFixMode, isCropMode, src])
287
-
288
- const innerProps = useInnerProps(props, {
289
- ref: nodeRef,
290
- style: {
291
- ...normalStyle,
292
- ...layoutStyle,
293
- ...(isHeightFixMode && { width: fixedWidth }),
294
- ...(isWidthFixMode && { height: fixedHeight })
295
- },
296
- ...layoutProps
297
- },
298
- [],
299
- {
300
- layoutRef
301
- })
302
-
303
- // if (typeof src === 'string' && REMOTE_SVG_REGEXP.test(src)) {
304
- // return (
305
- // <Suspense fallback={Fallback} {...innerProps}>
306
- // <View {...innerProps}>
307
- // <Svg src={src} style={style} width={width as SvgNumberProp} height={height as SvgNumberProp} />
308
- // </View>
309
- // </Suspense>
310
- // )
311
- // }
312
-
313
- // if (svg) {
314
- // return (
315
- // <Suspense fallback={Fallback}>
316
- // <View {...innerProps}>
317
- // <Svg local src={src} style={style} width={width as SvgNumberProp} height={height as SvgNumberProp} />
318
- // </View>
319
- // </Suspense>
320
- // )
321
- // }
322
-
323
- return (
324
- <View {...innerProps}>
325
- {
326
- loaded && <RNImage
327
- source={source}
328
- resizeMode={resizeMode}
329
- onLoad={onImageLoad}
330
- onError={onImageError}
331
- style={{
332
- ...StyleSheet.absoluteFillObject,
333
- width: isCropMode ? imageWidth : '100%',
334
- height: isCropMode ? imageHeight : '100%',
335
- ...(isCropMode && cropModeStyle)
336
- }}
337
- />
338
- }
339
- </View>
340
- )
341
- })
342
-
343
- Image.displayName = 'MpxImage'
344
-
345
- export default Image
@@ -1,22 +0,0 @@
1
- import { JSX } from 'react'
2
- import type { ImageSourcePropType, ImageStyle, StyleProp } from 'react-native'
3
- import { SvgCssUri, WithLocalSvg } from 'react-native-svg/css'
4
- interface SvgProps {
5
- local?: boolean
6
- src: string | ImageSourcePropType
7
- style?: StyleProp<ImageStyle>
8
- width?: string | number
9
- height?: string | number
10
- }
11
-
12
- const Svg = ({ local = false, src, style, width, height }: SvgProps): JSX.Element => {
13
- return local
14
- ? (
15
- <WithLocalSvg style={style} asset={src as ImageSourcePropType} width={width} height={height} />
16
- )
17
- : (
18
- <SvgCssUri style={style} uri={src as string} width={width} height={height} />
19
- )
20
- }
21
-
22
- export default Svg