@elvora/react-native 1.0.0-rc.1
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.
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/index.cjs +5785 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1253 -0
- package/dist/index.d.ts +1253 -0
- package/dist/index.js +5683 -0
- package/dist/index.js.map +1 -0
- package/package.json +88 -0
- package/src/Accordion.tsx +11 -0
- package/src/Affix.tsx +20 -0
- package/src/Alert.tsx +102 -0
- package/src/Anchor.tsx +58 -0
- package/src/AutoComplete.tsx +122 -0
- package/src/Avatar.tsx +58 -0
- package/src/BackTop.tsx +71 -0
- package/src/Backdrop.tsx +32 -0
- package/src/Badge.tsx +87 -0
- package/src/Box.tsx +67 -0
- package/src/Breadcrumb.tsx +46 -0
- package/src/Button.test.tsx +39 -0
- package/src/Button.tsx +127 -0
- package/src/ButtonGroup.tsx +74 -0
- package/src/Calendar.tsx +165 -0
- package/src/Card.tsx +69 -0
- package/src/Carousel.tsx +99 -0
- package/src/Cascader.tsx +160 -0
- package/src/Checkbox.tsx +85 -0
- package/src/ChipInput.tsx +130 -0
- package/src/Collapse.tsx +120 -0
- package/src/ColorPicker.tsx +114 -0
- package/src/Container.tsx +22 -0
- package/src/DataGrid.tsx +170 -0
- package/src/DatePicker.tsx +195 -0
- package/src/DateRangePicker.tsx +249 -0
- package/src/Descriptions.tsx +98 -0
- package/src/Divider.tsx +32 -0
- package/src/Drawer.tsx +103 -0
- package/src/Dropdown.tsx +15 -0
- package/src/ElvoraProvider.tsx +31 -0
- package/src/Empty.tsx +34 -0
- package/src/FloatButton.tsx +78 -0
- package/src/Form.tsx +119 -0
- package/src/Grid.tsx +68 -0
- package/src/Icon.tsx +49 -0
- package/src/IconButton.tsx +28 -0
- package/src/Image.tsx +68 -0
- package/src/ImageList.tsx +58 -0
- package/src/Input.tsx +87 -0
- package/src/Label.tsx +46 -0
- package/src/List.tsx +82 -0
- package/src/Mentions.tsx +148 -0
- package/src/Menu.tsx +77 -0
- package/src/Modal.tsx +114 -0
- package/src/NumberInput.tsx +156 -0
- package/src/Pagination.tsx +148 -0
- package/src/PaginationVariants.tsx +64 -0
- package/src/Popover.tsx +74 -0
- package/src/ProForm.tsx +219 -0
- package/src/ProLayout.tsx +151 -0
- package/src/ProTable.tsx +91 -0
- package/src/Progress.tsx +92 -0
- package/src/QRCode.tsx +65 -0
- package/src/Radio.tsx +98 -0
- package/src/Rate.tsx +66 -0
- package/src/Result.tsx +64 -0
- package/src/Segmented.tsx +75 -0
- package/src/Select.tsx +146 -0
- package/src/Skeleton.tsx +49 -0
- package/src/Slider.tsx +122 -0
- package/src/SpeedDial.tsx +87 -0
- package/src/Spinner.tsx +29 -0
- package/src/Splitter.tsx +91 -0
- package/src/Stack.tsx +38 -0
- package/src/Statistic.tsx +60 -0
- package/src/Stepper.tsx +113 -0
- package/src/Steps.tsx +146 -0
- package/src/Switch.tsx +52 -0
- package/src/Table.tsx +178 -0
- package/src/Tabs.tsx +122 -0
- package/src/Tag.tsx +83 -0
- package/src/Textarea.tsx +22 -0
- package/src/TimePicker.tsx +187 -0
- package/src/Timeline.tsx +92 -0
- package/src/Toast.tsx +140 -0
- package/src/ToggleButton.tsx +66 -0
- package/src/Tooltip.tsx +56 -0
- package/src/Tour.tsx +118 -0
- package/src/Transfer.tsx +219 -0
- package/src/Tree.tsx +144 -0
- package/src/TreeSelect.tsx +221 -0
- package/src/Upload.tsx +109 -0
- package/src/Watermark.tsx +76 -0
- package/src/index.ts +221 -0
- package/src/smoke.test.tsx +113 -0
- package/src/test/react-native-stub.tsx +413 -0
- package/src/test/react-native-svg-stub.tsx +33 -0
- package/src/test/setup.ts +7 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/**
|
|
3
|
+
* Vitest-only stub for `react-native` that maps RN primitives to DOM
|
|
4
|
+
* elements so component logic can be exercised in jsdom. This is *not*
|
|
5
|
+
* an attempt to replicate React Native — it covers the surface the
|
|
6
|
+
* Elvora adapter uses (View, Text, Pressable, ScrollView, Modal, TextInput,
|
|
7
|
+
* FlatList, Image, Switch, useWindowDimensions, StyleSheet, Platform,
|
|
8
|
+
* PanResponder, Animated, Linking, Dimensions). Anything more exotic
|
|
9
|
+
* needs Detox-style real-device tests.
|
|
10
|
+
*/
|
|
11
|
+
import {
|
|
12
|
+
forwardRef,
|
|
13
|
+
useEffect,
|
|
14
|
+
useState,
|
|
15
|
+
type CSSProperties,
|
|
16
|
+
type ReactNode,
|
|
17
|
+
} from 'react';
|
|
18
|
+
|
|
19
|
+
type Style = CSSProperties | Style[] | null | undefined | false;
|
|
20
|
+
|
|
21
|
+
function flattenStyle(style: Style): CSSProperties {
|
|
22
|
+
if (!style) return {};
|
|
23
|
+
if (Array.isArray(style)) {
|
|
24
|
+
return style.reduce<CSSProperties>(
|
|
25
|
+
(acc, s) => (s ? { ...acc, ...flattenStyle(s) } : acc),
|
|
26
|
+
{},
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return style as CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function dropRNOnly<T extends Record<string, unknown>>(props: T): T {
|
|
33
|
+
const {
|
|
34
|
+
accessibilityRole: _r,
|
|
35
|
+
accessibilityState: _s,
|
|
36
|
+
accessibilityLabel: _l,
|
|
37
|
+
accessibilityValue: _v,
|
|
38
|
+
accessibilityHint: _h,
|
|
39
|
+
accessibilityLiveRegion: _lr,
|
|
40
|
+
accessible: _accessible,
|
|
41
|
+
accessibilityViewIsModal: _avm,
|
|
42
|
+
showsHorizontalScrollIndicator: _shi,
|
|
43
|
+
showsVerticalScrollIndicator: _svi,
|
|
44
|
+
hitSlop: _hs,
|
|
45
|
+
pointerEvents: _pe,
|
|
46
|
+
testID: _tid,
|
|
47
|
+
nativeID: _nid,
|
|
48
|
+
contentContainerStyle: _ccs,
|
|
49
|
+
keyboardShouldPersistTaps: _ks,
|
|
50
|
+
underlayColor: _uc,
|
|
51
|
+
activeOpacity: _ao,
|
|
52
|
+
importantForAccessibility: _ifa,
|
|
53
|
+
needsOffscreenAlphaCompositing: _noac,
|
|
54
|
+
renderToHardwareTextureAndroid: _rthta,
|
|
55
|
+
onResponderTerminate: _ort,
|
|
56
|
+
onResponderRelease: _orr,
|
|
57
|
+
onResponderMove: _orm,
|
|
58
|
+
onResponderGrant: _org,
|
|
59
|
+
onStartShouldSetResponder: _ossr,
|
|
60
|
+
onMoveShouldSetResponder: _omssr,
|
|
61
|
+
collapsable: _col,
|
|
62
|
+
removeClippedSubviews: _rcs,
|
|
63
|
+
selectable: _sel,
|
|
64
|
+
allowFontScaling: _afs,
|
|
65
|
+
adjustsFontSizeToFit: _afsf,
|
|
66
|
+
numberOfLines: _nol,
|
|
67
|
+
ellipsizeMode: _em,
|
|
68
|
+
...rest
|
|
69
|
+
} = props;
|
|
70
|
+
// Re-apply accessibility props as aria-*
|
|
71
|
+
const out = rest as Record<string, unknown>;
|
|
72
|
+
if (_r) out.role = String(_r);
|
|
73
|
+
if (_l) out['aria-label'] = String(_l);
|
|
74
|
+
if (_h) out['aria-describedby'] = undefined;
|
|
75
|
+
if (_lr) out['aria-live'] = String(_lr);
|
|
76
|
+
if (_tid) out['data-testid'] = String(_tid);
|
|
77
|
+
if (_nid) out.id = String(_nid);
|
|
78
|
+
const state = _s as Record<string, unknown> | undefined;
|
|
79
|
+
if (state) {
|
|
80
|
+
if (state.disabled) out['aria-disabled'] = true;
|
|
81
|
+
if (state.busy) out['aria-busy'] = true;
|
|
82
|
+
if (state.selected !== undefined) out['aria-selected'] = state.selected;
|
|
83
|
+
if (state.checked !== undefined) out['aria-checked'] = state.checked;
|
|
84
|
+
if (state.expanded !== undefined) out['aria-expanded'] = state.expanded;
|
|
85
|
+
}
|
|
86
|
+
return out as T;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const View = forwardRef<HTMLDivElement, any>(function View({ style, children, ...props }, ref) {
|
|
90
|
+
return (
|
|
91
|
+
<div ref={ref} style={flattenStyle(style)} {...dropRNOnly(props)}>
|
|
92
|
+
{children}
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const Text = forwardRef<HTMLSpanElement, any>(function Text({ style, children, ...props }, ref) {
|
|
98
|
+
return (
|
|
99
|
+
<span ref={ref} style={flattenStyle(style)} {...dropRNOnly(props)}>
|
|
100
|
+
{children}
|
|
101
|
+
</span>
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const Pressable = forwardRef<HTMLButtonElement, any>(function Pressable(
|
|
106
|
+
{ style, children, onPress, onPressIn, onPressOut, disabled, ...props },
|
|
107
|
+
ref,
|
|
108
|
+
) {
|
|
109
|
+
const flat = typeof style === 'function' ? style({ pressed: false }) : style;
|
|
110
|
+
return (
|
|
111
|
+
<button
|
|
112
|
+
ref={ref}
|
|
113
|
+
type="button"
|
|
114
|
+
onClick={(e) => onPress?.(e)}
|
|
115
|
+
onMouseDown={(e) => onPressIn?.(e)}
|
|
116
|
+
onMouseUp={(e) => onPressOut?.(e)}
|
|
117
|
+
disabled={disabled}
|
|
118
|
+
style={{ all: 'unset', cursor: disabled ? 'not-allowed' : 'pointer', ...flattenStyle(flat) }}
|
|
119
|
+
{...dropRNOnly(props)}
|
|
120
|
+
>
|
|
121
|
+
{typeof children === 'function' ? children({ pressed: false }) : children}
|
|
122
|
+
</button>
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export const TouchableOpacity = Pressable;
|
|
127
|
+
export const TouchableWithoutFeedback = Pressable;
|
|
128
|
+
export const TouchableHighlight = Pressable;
|
|
129
|
+
|
|
130
|
+
export const ScrollView = forwardRef<HTMLDivElement, any>(function ScrollView(
|
|
131
|
+
{ style, children, contentContainerStyle, horizontal, ...props },
|
|
132
|
+
ref,
|
|
133
|
+
) {
|
|
134
|
+
return (
|
|
135
|
+
<div
|
|
136
|
+
ref={ref}
|
|
137
|
+
style={{
|
|
138
|
+
overflow: 'auto',
|
|
139
|
+
display: horizontal ? 'flex' : 'block',
|
|
140
|
+
flexDirection: horizontal ? 'row' : 'column',
|
|
141
|
+
...flattenStyle(style),
|
|
142
|
+
}}
|
|
143
|
+
{...dropRNOnly(props)}
|
|
144
|
+
>
|
|
145
|
+
<div style={flattenStyle(contentContainerStyle)}>{children}</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
export const FlatList = forwardRef<HTMLDivElement, any>(function FlatList(
|
|
151
|
+
{ data = [], renderItem, keyExtractor, ListEmptyComponent, style, ...props },
|
|
152
|
+
ref,
|
|
153
|
+
) {
|
|
154
|
+
return (
|
|
155
|
+
<div ref={ref} style={flattenStyle(style)} {...dropRNOnly(props)}>
|
|
156
|
+
{data.length === 0 && ListEmptyComponent
|
|
157
|
+
? typeof ListEmptyComponent === 'function'
|
|
158
|
+
? <ListEmptyComponent />
|
|
159
|
+
: ListEmptyComponent
|
|
160
|
+
: data.map((item: unknown, index: number) => {
|
|
161
|
+
const key = keyExtractor ? keyExtractor(item, index) : String(index);
|
|
162
|
+
return (
|
|
163
|
+
<div key={key} data-index={index}>
|
|
164
|
+
{renderItem?.({ item, index, separators: { highlight: () => {}, unhighlight: () => {}, updateProps: () => {} } })}
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
})}
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export const SectionList = FlatList;
|
|
173
|
+
|
|
174
|
+
export const Modal = function Modal({ visible, children, transparent: _t, animationType: _a, onRequestClose, ...props }: any) {
|
|
175
|
+
if (!visible) return null;
|
|
176
|
+
return (
|
|
177
|
+
<div role="dialog" aria-modal="true" {...dropRNOnly(props)}>
|
|
178
|
+
{children}
|
|
179
|
+
<button type="button" aria-label="close" onClick={onRequestClose} style={{ display: 'none' }} />
|
|
180
|
+
</div>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const TextInput = forwardRef<HTMLInputElement, any>(function TextInput(
|
|
185
|
+
{ style, value, defaultValue, onChangeText, onChange, multiline, numberOfLines, secureTextEntry, keyboardType, editable, placeholder, placeholderTextColor: _ptc, returnKeyType: _rk, autoCapitalize: _ac, autoCorrect: _acr, autoComplete: _aco, textAlignVertical: _tav, onSubmitEditing, onFocus, onBlur, ...props },
|
|
186
|
+
ref,
|
|
187
|
+
) {
|
|
188
|
+
const handleChange = (e: any) => {
|
|
189
|
+
onChangeText?.(e.target.value);
|
|
190
|
+
onChange?.(e);
|
|
191
|
+
};
|
|
192
|
+
if (multiline) {
|
|
193
|
+
return (
|
|
194
|
+
<textarea
|
|
195
|
+
ref={ref as any}
|
|
196
|
+
value={value}
|
|
197
|
+
defaultValue={defaultValue}
|
|
198
|
+
rows={numberOfLines}
|
|
199
|
+
disabled={editable === false}
|
|
200
|
+
placeholder={placeholder}
|
|
201
|
+
onChange={handleChange}
|
|
202
|
+
onFocus={onFocus}
|
|
203
|
+
onBlur={onBlur}
|
|
204
|
+
style={flattenStyle(style)}
|
|
205
|
+
{...dropRNOnly(props)}
|
|
206
|
+
/>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
return (
|
|
210
|
+
<input
|
|
211
|
+
ref={ref}
|
|
212
|
+
type={secureTextEntry ? 'password' : keyboardType === 'numeric' || keyboardType === 'number-pad' ? 'number' : keyboardType === 'email-address' ? 'email' : 'text'}
|
|
213
|
+
value={value}
|
|
214
|
+
defaultValue={defaultValue}
|
|
215
|
+
disabled={editable === false}
|
|
216
|
+
placeholder={placeholder}
|
|
217
|
+
onChange={handleChange}
|
|
218
|
+
onFocus={onFocus}
|
|
219
|
+
onBlur={onBlur}
|
|
220
|
+
onKeyDown={(e) => {
|
|
221
|
+
if (e.key === 'Enter') onSubmitEditing?.(e);
|
|
222
|
+
}}
|
|
223
|
+
style={flattenStyle(style)}
|
|
224
|
+
{...dropRNOnly(props)}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
export const Switch = forwardRef<HTMLInputElement, any>(function Switch(
|
|
230
|
+
{ value, onValueChange, disabled, style, trackColor: _tc, thumbColor: _thumbC, ios_backgroundColor: _iosbg, ...props },
|
|
231
|
+
ref,
|
|
232
|
+
) {
|
|
233
|
+
return (
|
|
234
|
+
<input
|
|
235
|
+
ref={ref}
|
|
236
|
+
type="checkbox"
|
|
237
|
+
role="switch"
|
|
238
|
+
checked={Boolean(value)}
|
|
239
|
+
disabled={disabled}
|
|
240
|
+
onChange={(e) => onValueChange?.(e.target.checked)}
|
|
241
|
+
style={flattenStyle(style)}
|
|
242
|
+
{...dropRNOnly(props)}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
export const Image = forwardRef<HTMLImageElement, any>(function Image({ source, style, alt, ...props }, ref) {
|
|
248
|
+
const src = typeof source === 'string' ? source : source?.uri;
|
|
249
|
+
return <img ref={ref} src={src} alt={alt ?? ''} style={flattenStyle(style)} {...dropRNOnly(props)} />;
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
export const ImageBackground = Image;
|
|
253
|
+
export const KeyboardAvoidingView = View;
|
|
254
|
+
export const SafeAreaView = View;
|
|
255
|
+
export const StatusBar = function StatusBar() { return null; };
|
|
256
|
+
export const RefreshControl = function RefreshControl() { return null; };
|
|
257
|
+
export const ActivityIndicator = function ActivityIndicator({ size, color, style, ...props }: any) {
|
|
258
|
+
return <span role="progressbar" aria-busy="true" style={{ color, ...flattenStyle(style) }} {...dropRNOnly(props)}>spinner</span>;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
function createStyles<T extends Record<string, unknown>>(styles: T): T {
|
|
262
|
+
return styles;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export const StyleSheet = {
|
|
266
|
+
create: createStyles,
|
|
267
|
+
flatten: flattenStyle,
|
|
268
|
+
absoluteFill: { position: 'absolute', inset: 0 },
|
|
269
|
+
absoluteFillObject: { position: 'absolute', inset: 0 },
|
|
270
|
+
hairlineWidth: 1,
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
function platformSelect<T>(specifics: {
|
|
274
|
+
ios?: T;
|
|
275
|
+
android?: T;
|
|
276
|
+
default?: T;
|
|
277
|
+
web?: T;
|
|
278
|
+
native?: T;
|
|
279
|
+
}): T | undefined {
|
|
280
|
+
return specifics.web ?? specifics.default;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export const Platform = {
|
|
284
|
+
OS: 'web' as const,
|
|
285
|
+
Version: 0,
|
|
286
|
+
select: platformSelect,
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export const Dimensions = {
|
|
290
|
+
get: () => ({ width: 1024, height: 768, scale: 1, fontScale: 1 }),
|
|
291
|
+
addEventListener: () => ({ remove: () => {} }),
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export function useWindowDimensions() {
|
|
295
|
+
const [dims] = useState({ width: 1024, height: 768, scale: 1, fontScale: 1 });
|
|
296
|
+
useEffect(() => {}, []);
|
|
297
|
+
return dims;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export const PanResponder = {
|
|
301
|
+
create: (config: any) => ({
|
|
302
|
+
panHandlers: {
|
|
303
|
+
onMouseDown: (e: any) => config.onPanResponderGrant?.(e, { dx: 0, dy: 0 }),
|
|
304
|
+
onMouseMove: (e: any) => config.onPanResponderMove?.(e, { dx: 0, dy: 0 }),
|
|
305
|
+
onMouseUp: (e: any) => config.onPanResponderRelease?.(e, { dx: 0, dy: 0 }),
|
|
306
|
+
},
|
|
307
|
+
}),
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export const Animated = {
|
|
311
|
+
View,
|
|
312
|
+
Text,
|
|
313
|
+
Image,
|
|
314
|
+
ScrollView,
|
|
315
|
+
Value: class {
|
|
316
|
+
private v: number;
|
|
317
|
+
constructor(v: number) { this.v = v; }
|
|
318
|
+
setValue(v: number) { this.v = v; }
|
|
319
|
+
interpolate() { return this; }
|
|
320
|
+
},
|
|
321
|
+
timing: () => ({ start: (cb?: () => void) => cb?.() }),
|
|
322
|
+
spring: () => ({ start: (cb?: () => void) => cb?.() }),
|
|
323
|
+
parallel: (anims: any[]) => ({ start: (cb?: () => void) => { anims.forEach(a => a.start?.()); cb?.(); } }),
|
|
324
|
+
sequence: (anims: any[]) => ({ start: (cb?: () => void) => { anims.forEach(a => a.start?.()); cb?.(); } }),
|
|
325
|
+
loop: (anim: any) => ({ start: (cb?: () => void) => anim.start?.(cb) }),
|
|
326
|
+
createAnimatedComponent: createAnimatedComponent,
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
function createAnimatedComponent<T>(C: T): T {
|
|
330
|
+
return C;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export const Linking = {
|
|
334
|
+
openURL: async () => true,
|
|
335
|
+
canOpenURL: async () => true,
|
|
336
|
+
getInitialURL: async () => null,
|
|
337
|
+
addEventListener: () => ({ remove: () => {} }),
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export const I18nManager = {
|
|
341
|
+
isRTL: false,
|
|
342
|
+
forceRTL: () => {},
|
|
343
|
+
allowRTL: () => {},
|
|
344
|
+
swapLeftAndRightInRTL: () => {},
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
export const AccessibilityInfo = {
|
|
348
|
+
isScreenReaderEnabled: async () => false,
|
|
349
|
+
isReduceMotionEnabled: async () => false,
|
|
350
|
+
announceForAccessibility: () => {},
|
|
351
|
+
addEventListener: () => ({ remove: () => {} }),
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
export const NativeModules = {};
|
|
355
|
+
export const findNodeHandle = () => null;
|
|
356
|
+
export const UIManager = { measure: () => {}, measureInWindow: () => {} };
|
|
357
|
+
|
|
358
|
+
export function processColor(c: string) { return c; }
|
|
359
|
+
|
|
360
|
+
const RN = {
|
|
361
|
+
View,
|
|
362
|
+
Text,
|
|
363
|
+
Pressable,
|
|
364
|
+
TouchableOpacity,
|
|
365
|
+
TouchableWithoutFeedback,
|
|
366
|
+
TouchableHighlight,
|
|
367
|
+
ScrollView,
|
|
368
|
+
FlatList,
|
|
369
|
+
SectionList,
|
|
370
|
+
Modal,
|
|
371
|
+
TextInput,
|
|
372
|
+
Switch,
|
|
373
|
+
Image,
|
|
374
|
+
ImageBackground,
|
|
375
|
+
KeyboardAvoidingView,
|
|
376
|
+
SafeAreaView,
|
|
377
|
+
StatusBar,
|
|
378
|
+
RefreshControl,
|
|
379
|
+
ActivityIndicator,
|
|
380
|
+
StyleSheet,
|
|
381
|
+
Platform,
|
|
382
|
+
Dimensions,
|
|
383
|
+
useWindowDimensions,
|
|
384
|
+
PanResponder,
|
|
385
|
+
Animated,
|
|
386
|
+
Linking,
|
|
387
|
+
I18nManager,
|
|
388
|
+
AccessibilityInfo,
|
|
389
|
+
NativeModules,
|
|
390
|
+
findNodeHandle,
|
|
391
|
+
UIManager,
|
|
392
|
+
processColor,
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
export default RN;
|
|
396
|
+
|
|
397
|
+
// Convenience re-exports of types used by Elvora RN adapter
|
|
398
|
+
export type GestureResponderEvent = any;
|
|
399
|
+
export type LayoutChangeEvent = any;
|
|
400
|
+
export type NativeSyntheticEvent<T> = { nativeEvent: T };
|
|
401
|
+
export type TextInputProps = any;
|
|
402
|
+
export type ViewProps = any;
|
|
403
|
+
export type ViewStyle = CSSProperties;
|
|
404
|
+
export type TextStyle = CSSProperties;
|
|
405
|
+
export type ImageStyle = CSSProperties;
|
|
406
|
+
export type StyleProp<T> = T | T[] | null | undefined | false;
|
|
407
|
+
export type PressableProps = any;
|
|
408
|
+
export type ListRenderItem<T> = (info: { item: T; index: number; separators: any }) => ReactNode;
|
|
409
|
+
export type ImageSourcePropType = any;
|
|
410
|
+
export type ColorValue = string;
|
|
411
|
+
|
|
412
|
+
// Some components import `View` as a type—re-export the React component type
|
|
413
|
+
export type ViewType = typeof View;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { forwardRef, type ReactNode, type SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
interface SvgProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const Svg = forwardRef<SVGSVGElement, SvgProps>(function Svg(props, ref) {
|
|
8
|
+
return <svg ref={ref} {...props} />;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default Svg;
|
|
12
|
+
|
|
13
|
+
export const Circle = (props: SVGProps<SVGCircleElement>) => <circle {...props} />;
|
|
14
|
+
export const Rect = (props: SVGProps<SVGRectElement>) => <rect {...props} />;
|
|
15
|
+
export const Path = (props: SVGProps<SVGPathElement>) => <path {...props} />;
|
|
16
|
+
export const Polygon = (props: SVGProps<SVGPolygonElement>) => <polygon {...props} />;
|
|
17
|
+
export const Polyline = (props: SVGProps<SVGPolylineElement>) => <polyline {...props} />;
|
|
18
|
+
export const Line = (props: SVGProps<SVGLineElement>) => <line {...props} />;
|
|
19
|
+
export const Ellipse = (props: SVGProps<SVGEllipseElement>) => <ellipse {...props} />;
|
|
20
|
+
export const G = (props: SVGProps<SVGGElement>) => <g {...props} />;
|
|
21
|
+
export const Text = (props: SVGProps<SVGTextElement>) => <text {...props} />;
|
|
22
|
+
export const TSpan = (props: SVGProps<SVGTSpanElement>) => <tspan {...props} />;
|
|
23
|
+
export const Defs = (props: SVGProps<SVGDefsElement>) => <defs {...props} />;
|
|
24
|
+
export const ClipPath = (props: SVGProps<SVGClipPathElement>) => <clipPath {...props} />;
|
|
25
|
+
export const Use = (props: SVGProps<SVGUseElement>) => <use {...props} />;
|
|
26
|
+
export const Image = (props: SVGProps<SVGImageElement>) => <image {...props} />;
|
|
27
|
+
export const Symbol = (props: SVGProps<SVGSymbolElement>) => <symbol {...props} />;
|
|
28
|
+
export const Pattern = (props: SVGProps<SVGPatternElement>) => <pattern {...props} />;
|
|
29
|
+
export const Mask = (props: SVGProps<SVGMaskElement>) => <mask {...props} />;
|
|
30
|
+
export const LinearGradient = (props: SVGProps<SVGLinearGradientElement>) => <linearGradient {...props} />;
|
|
31
|
+
export const RadialGradient = (props: SVGProps<SVGRadialGradientElement>) => <radialGradient {...props} />;
|
|
32
|
+
export const Stop = (props: SVGProps<SVGStopElement>) => <stop {...props} />;
|
|
33
|
+
export const ForeignObject = (props: SVGProps<SVGForeignObjectElement>) => <foreignObject {...props} />;
|