@tamagui/core 1.0.1-beta.36 → 1.0.1-beta.39
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/dist/cjs/createComponent.js +405 -139
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/esm/createComponent.js +333 -113
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/jsx/createComponent.js +333 -113
- package/package.json +5 -5
- package/types/createComponent.d.ts.map +1 -1
|
@@ -16,7 +16,7 @@ import React, {
|
|
|
16
16
|
import { Pressable, StyleSheet, Text, View } from "react-native";
|
|
17
17
|
import { onConfiguredOnce } from "./conf";
|
|
18
18
|
import { stackDefaultStyles } from "./constants/constants";
|
|
19
|
-
import {
|
|
19
|
+
import { isWeb, useIsomorphicLayoutEffect } from "./constants/platform";
|
|
20
20
|
import { rnw } from "./constants/rnw";
|
|
21
21
|
import { createShallowUpdate } from "./helpers/createShallowUpdate";
|
|
22
22
|
import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
@@ -138,46 +138,329 @@ function createComponent(configIn, ParentComponent) {
|
|
|
138
138
|
hitSlop,
|
|
139
139
|
asChild,
|
|
140
140
|
children,
|
|
141
|
-
pointerEvents,
|
|
142
141
|
onPress,
|
|
143
142
|
onPressIn,
|
|
144
143
|
onPressOut,
|
|
145
144
|
onHoverIn,
|
|
146
145
|
onHoverOut,
|
|
147
146
|
space,
|
|
148
|
-
disabled,
|
|
147
|
+
disabled: disabledProp,
|
|
148
|
+
onMouseDown,
|
|
149
149
|
onMouseEnter,
|
|
150
150
|
onMouseLeave,
|
|
151
151
|
hrefAttrs,
|
|
152
|
-
onMoveShouldSetResponder,
|
|
153
|
-
onMoveShouldSetResponderCapture,
|
|
154
|
-
onResponderEnd,
|
|
155
|
-
onResponderGrant,
|
|
156
|
-
onResponderMove,
|
|
157
|
-
onResponderReject,
|
|
158
|
-
onResponderRelease,
|
|
159
|
-
onResponderStart,
|
|
160
|
-
onResponderTerminate,
|
|
161
|
-
onResponderTerminationRequest,
|
|
162
|
-
onScrollShouldSetResponder,
|
|
163
|
-
onScrollShouldSetResponderCapture,
|
|
164
|
-
onSelectionChangeShouldSetResponder,
|
|
165
|
-
onSelectionChangeShouldSetResponderCapture,
|
|
166
|
-
onStartShouldSetResponder,
|
|
167
|
-
onStartShouldSetResponderCapture,
|
|
168
|
-
onMouseDown,
|
|
169
|
-
nativeID,
|
|
170
|
-
accessible,
|
|
171
|
-
accessibilityRole,
|
|
172
|
-
collapsable,
|
|
173
|
-
focusable,
|
|
174
152
|
onClick,
|
|
175
153
|
theme: _themeProp,
|
|
176
154
|
defaultVariants,
|
|
177
|
-
|
|
178
|
-
...viewPropsRest
|
|
155
|
+
...nonTamaguiProps
|
|
179
156
|
} = viewPropsIn;
|
|
180
|
-
|
|
157
|
+
const isTaggable = !Component || typeof Component === "string";
|
|
158
|
+
const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
|
|
159
|
+
const element = isWeb ? isTaggable ? tag || Component : Component : Component;
|
|
160
|
+
const BaseTextComponent = !isWeb ? Text : element || "span";
|
|
161
|
+
const BaseViewComponent = !isWeb ? View : element || (hasTextAncestor ? "span" : "div");
|
|
162
|
+
let elementType = isText ? (isAnimated ? AnimatedText || Text : null) || BaseTextComponent : (isAnimated ? AnimatedView || View : null) || BaseViewComponent;
|
|
163
|
+
elementType = Component || elementType;
|
|
164
|
+
const isStringElement = typeof elementType === "string";
|
|
165
|
+
const disabled = props.accessibilityState != null && props.accessibilityState.disabled === true || props.accessibilityDisabled;
|
|
166
|
+
let viewProps;
|
|
167
|
+
if (isWeb && !staticConfig.isReactNativeWeb) {
|
|
168
|
+
const {
|
|
169
|
+
onMoveShouldSetResponder,
|
|
170
|
+
onMoveShouldSetResponderCapture,
|
|
171
|
+
onResponderEnd,
|
|
172
|
+
onResponderGrant,
|
|
173
|
+
onResponderMove,
|
|
174
|
+
onResponderReject,
|
|
175
|
+
onResponderRelease,
|
|
176
|
+
onResponderStart,
|
|
177
|
+
onResponderTerminate,
|
|
178
|
+
onResponderTerminationRequest,
|
|
179
|
+
onScrollShouldSetResponder,
|
|
180
|
+
onScrollShouldSetResponderCapture,
|
|
181
|
+
onSelectionChangeShouldSetResponder,
|
|
182
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
183
|
+
onStartShouldSetResponder,
|
|
184
|
+
onStartShouldSetResponderCapture,
|
|
185
|
+
nativeID,
|
|
186
|
+
accessibilityActiveDescendant,
|
|
187
|
+
accessibilityAtomic,
|
|
188
|
+
accessibilityAutoComplete,
|
|
189
|
+
accessibilityBusy,
|
|
190
|
+
accessibilityChecked,
|
|
191
|
+
accessibilityColumnCount,
|
|
192
|
+
accessibilityColumnIndex,
|
|
193
|
+
accessibilityColumnSpan,
|
|
194
|
+
accessibilityControls,
|
|
195
|
+
accessibilityCurrent,
|
|
196
|
+
accessibilityDescribedBy,
|
|
197
|
+
accessibilityDetails,
|
|
198
|
+
accessibilityDisabled,
|
|
199
|
+
accessibilityErrorMessage,
|
|
200
|
+
accessibilityExpanded,
|
|
201
|
+
accessibilityFlowTo,
|
|
202
|
+
accessibilityHasPopup,
|
|
203
|
+
accessibilityHidden,
|
|
204
|
+
accessibilityInvalid,
|
|
205
|
+
accessibilityKeyShortcuts,
|
|
206
|
+
accessibilityLabel,
|
|
207
|
+
accessibilityLabelledBy,
|
|
208
|
+
accessibilityLevel,
|
|
209
|
+
accessibilityLiveRegion,
|
|
210
|
+
accessibilityModal,
|
|
211
|
+
accessibilityMultiline,
|
|
212
|
+
accessibilityMultiSelectable,
|
|
213
|
+
accessibilityOrientation,
|
|
214
|
+
accessibilityOwns,
|
|
215
|
+
accessibilityPlaceholder,
|
|
216
|
+
accessibilityPosInSet,
|
|
217
|
+
accessibilityPressed,
|
|
218
|
+
accessibilityReadOnly,
|
|
219
|
+
accessibilityRequired,
|
|
220
|
+
accessibilityRole,
|
|
221
|
+
accessibilityRoleDescription,
|
|
222
|
+
accessibilityRowCount,
|
|
223
|
+
accessibilityRowIndex,
|
|
224
|
+
accessibilityRowSpan,
|
|
225
|
+
accessibilitySelected,
|
|
226
|
+
accessibilitySetSize,
|
|
227
|
+
accessibilitySort,
|
|
228
|
+
accessibilityValueMax,
|
|
229
|
+
accessibilityValueMin,
|
|
230
|
+
accessibilityValueNow,
|
|
231
|
+
accessibilityValueText,
|
|
232
|
+
accessible,
|
|
233
|
+
accessibilityState,
|
|
234
|
+
accessibilityValue,
|
|
235
|
+
collapsable,
|
|
236
|
+
focusable,
|
|
237
|
+
onLayout,
|
|
238
|
+
...webProps
|
|
239
|
+
} = nonTamaguiProps;
|
|
240
|
+
viewProps = webProps;
|
|
241
|
+
if (!viewProps.role && accessibilityRole) {
|
|
242
|
+
if (accessibilityRole === "none") {
|
|
243
|
+
viewProps.role = "presentation";
|
|
244
|
+
} else {
|
|
245
|
+
const webRole = accessibilityRoleToWebRole[accessibilityRole];
|
|
246
|
+
if (webRole != null) {
|
|
247
|
+
viewProps.role = webRole || accessibilityRole;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const role = viewProps.role;
|
|
252
|
+
if (accessibilityActiveDescendant != null) {
|
|
253
|
+
viewProps["aria-activedescendant"] = accessibilityActiveDescendant;
|
|
254
|
+
}
|
|
255
|
+
if (accessibilityAtomic != null) {
|
|
256
|
+
viewProps["aria-atomic"] = accessibilityAtomic;
|
|
257
|
+
}
|
|
258
|
+
if (accessibilityAutoComplete != null) {
|
|
259
|
+
viewProps["aria-autocomplete"] = accessibilityAutoComplete;
|
|
260
|
+
}
|
|
261
|
+
if (accessibilityBusy != null) {
|
|
262
|
+
viewProps["aria-busy"] = accessibilityBusy;
|
|
263
|
+
}
|
|
264
|
+
if (accessibilityChecked != null) {
|
|
265
|
+
viewProps["aria-checked"] = accessibilityChecked;
|
|
266
|
+
}
|
|
267
|
+
if (accessibilityColumnCount != null) {
|
|
268
|
+
viewProps["aria-colcount"] = accessibilityColumnCount;
|
|
269
|
+
}
|
|
270
|
+
if (accessibilityColumnIndex != null) {
|
|
271
|
+
viewProps["aria-colindex"] = accessibilityColumnIndex;
|
|
272
|
+
}
|
|
273
|
+
if (accessibilityColumnSpan != null) {
|
|
274
|
+
viewProps["aria-colspan"] = accessibilityColumnSpan;
|
|
275
|
+
}
|
|
276
|
+
if (accessibilityControls != null) {
|
|
277
|
+
viewProps["aria-controls"] = processIDRefList(accessibilityControls);
|
|
278
|
+
}
|
|
279
|
+
if (accessibilityCurrent != null) {
|
|
280
|
+
viewProps["aria-current"] = accessibilityCurrent;
|
|
281
|
+
}
|
|
282
|
+
if (accessibilityDescribedBy != null) {
|
|
283
|
+
viewProps["aria-describedby"] = processIDRefList(accessibilityDescribedBy);
|
|
284
|
+
}
|
|
285
|
+
if (accessibilityDetails != null) {
|
|
286
|
+
viewProps["aria-details"] = accessibilityDetails;
|
|
287
|
+
}
|
|
288
|
+
if (disabled === true) {
|
|
289
|
+
viewProps["aria-disabled"] = true;
|
|
290
|
+
if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
291
|
+
viewProps.disabled = true;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (accessibilityErrorMessage != null) {
|
|
295
|
+
viewProps["aria-errormessage"] = accessibilityErrorMessage;
|
|
296
|
+
}
|
|
297
|
+
if (accessibilityExpanded != null) {
|
|
298
|
+
viewProps["aria-expanded"] = accessibilityExpanded;
|
|
299
|
+
}
|
|
300
|
+
if (accessibilityFlowTo != null) {
|
|
301
|
+
viewProps["aria-flowto"] = processIDRefList(accessibilityFlowTo);
|
|
302
|
+
}
|
|
303
|
+
if (accessibilityHasPopup != null) {
|
|
304
|
+
viewProps["aria-haspopup"] = accessibilityHasPopup;
|
|
305
|
+
}
|
|
306
|
+
if (accessibilityHidden === true) {
|
|
307
|
+
viewProps["aria-hidden"] = accessibilityHidden;
|
|
308
|
+
}
|
|
309
|
+
if (accessibilityInvalid != null) {
|
|
310
|
+
viewProps["aria-invalid"] = accessibilityInvalid;
|
|
311
|
+
}
|
|
312
|
+
if (accessibilityKeyShortcuts != null && Array.isArray(accessibilityKeyShortcuts)) {
|
|
313
|
+
viewProps["aria-keyshortcuts"] = accessibilityKeyShortcuts.join(" ");
|
|
314
|
+
}
|
|
315
|
+
if (accessibilityLabel != null) {
|
|
316
|
+
viewProps["aria-label"] = accessibilityLabel;
|
|
317
|
+
}
|
|
318
|
+
if (accessibilityLabelledBy != null) {
|
|
319
|
+
viewProps["aria-labelledby"] = processIDRefList(accessibilityLabelledBy);
|
|
320
|
+
}
|
|
321
|
+
if (accessibilityLevel != null) {
|
|
322
|
+
viewProps["aria-level"] = accessibilityLevel;
|
|
323
|
+
}
|
|
324
|
+
if (accessibilityLiveRegion != null) {
|
|
325
|
+
viewProps["aria-live"] = accessibilityLiveRegion === "none" ? "off" : accessibilityLiveRegion;
|
|
326
|
+
}
|
|
327
|
+
if (accessibilityModal != null) {
|
|
328
|
+
viewProps["aria-modal"] = accessibilityModal;
|
|
329
|
+
}
|
|
330
|
+
if (accessibilityMultiline != null) {
|
|
331
|
+
viewProps["aria-multiline"] = accessibilityMultiline;
|
|
332
|
+
}
|
|
333
|
+
if (accessibilityMultiSelectable != null) {
|
|
334
|
+
viewProps["aria-multiselectable"] = accessibilityMultiSelectable;
|
|
335
|
+
}
|
|
336
|
+
if (accessibilityOrientation != null) {
|
|
337
|
+
viewProps["aria-orientation"] = accessibilityOrientation;
|
|
338
|
+
}
|
|
339
|
+
if (accessibilityOwns != null) {
|
|
340
|
+
viewProps["aria-owns"] = processIDRefList(accessibilityOwns);
|
|
341
|
+
}
|
|
342
|
+
if (accessibilityPlaceholder != null) {
|
|
343
|
+
viewProps["aria-placeholder"] = accessibilityPlaceholder;
|
|
344
|
+
}
|
|
345
|
+
if (accessibilityPosInSet != null) {
|
|
346
|
+
viewProps["aria-posinset"] = accessibilityPosInSet;
|
|
347
|
+
}
|
|
348
|
+
if (accessibilityPressed != null) {
|
|
349
|
+
viewProps["aria-pressed"] = accessibilityPressed;
|
|
350
|
+
}
|
|
351
|
+
if (accessibilityReadOnly != null) {
|
|
352
|
+
viewProps["aria-readonly"] = accessibilityReadOnly;
|
|
353
|
+
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
354
|
+
viewProps.readOnly = true;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (accessibilityRequired != null) {
|
|
358
|
+
viewProps["aria-required"] = accessibilityRequired;
|
|
359
|
+
if (elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
360
|
+
viewProps.required = true;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (accessibilityRoleDescription != null) {
|
|
364
|
+
viewProps["aria-roledescription"] = accessibilityRoleDescription;
|
|
365
|
+
}
|
|
366
|
+
if (accessibilityRowCount != null) {
|
|
367
|
+
viewProps["aria-rowcount"] = accessibilityRowCount;
|
|
368
|
+
}
|
|
369
|
+
if (accessibilityRowIndex != null) {
|
|
370
|
+
viewProps["aria-rowindex"] = accessibilityRowIndex;
|
|
371
|
+
}
|
|
372
|
+
if (accessibilityRowSpan != null) {
|
|
373
|
+
viewProps["aria-rowspan"] = accessibilityRowSpan;
|
|
374
|
+
}
|
|
375
|
+
if (accessibilitySelected != null) {
|
|
376
|
+
viewProps["aria-selected"] = accessibilitySelected;
|
|
377
|
+
}
|
|
378
|
+
if (accessibilitySetSize != null) {
|
|
379
|
+
viewProps["aria-setsize"] = accessibilitySetSize;
|
|
380
|
+
}
|
|
381
|
+
if (accessibilitySort != null) {
|
|
382
|
+
viewProps["aria-sort"] = accessibilitySort;
|
|
383
|
+
}
|
|
384
|
+
if (accessibilityValueMax != null) {
|
|
385
|
+
viewProps["aria-valuemax"] = accessibilityValueMax;
|
|
386
|
+
}
|
|
387
|
+
if (accessibilityValueMin != null) {
|
|
388
|
+
viewProps["aria-valuemin"] = accessibilityValueMin;
|
|
389
|
+
}
|
|
390
|
+
if (accessibilityValueNow != null) {
|
|
391
|
+
viewProps["aria-valuenow"] = accessibilityValueNow;
|
|
392
|
+
}
|
|
393
|
+
if (accessibilityValueText != null) {
|
|
394
|
+
viewProps["aria-valuetext"] = accessibilityValueText;
|
|
395
|
+
}
|
|
396
|
+
if (nativeID) {
|
|
397
|
+
viewProps.id = nativeID;
|
|
398
|
+
}
|
|
399
|
+
if (!asChild) {
|
|
400
|
+
rnw.useElementLayout(hostRef, onLayout);
|
|
401
|
+
rnw.useResponderEvents(hostRef, {
|
|
402
|
+
onMoveShouldSetResponder,
|
|
403
|
+
onMoveShouldSetResponderCapture,
|
|
404
|
+
onResponderEnd,
|
|
405
|
+
onResponderGrant,
|
|
406
|
+
onResponderMove,
|
|
407
|
+
onResponderReject,
|
|
408
|
+
onResponderRelease,
|
|
409
|
+
onResponderStart,
|
|
410
|
+
onResponderTerminate,
|
|
411
|
+
onResponderTerminationRequest,
|
|
412
|
+
onScrollShouldSetResponder,
|
|
413
|
+
onScrollShouldSetResponderCapture,
|
|
414
|
+
onSelectionChangeShouldSetResponder,
|
|
415
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
416
|
+
onStartShouldSetResponder,
|
|
417
|
+
onStartShouldSetResponderCapture
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
const platformMethodsRef = rnw.usePlatformMethods(viewProps);
|
|
421
|
+
const setRef = rnw.useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
|
|
422
|
+
if (!isAnimated) {
|
|
423
|
+
viewProps.ref = setRef;
|
|
424
|
+
} else {
|
|
425
|
+
if (forwardedRef) {
|
|
426
|
+
viewProps.ref = forwardedRef;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (props.href != null && hrefAttrs != null) {
|
|
430
|
+
const { download, rel, target } = hrefAttrs;
|
|
431
|
+
if (download != null) {
|
|
432
|
+
viewProps.download = download;
|
|
433
|
+
}
|
|
434
|
+
if (rel != null) {
|
|
435
|
+
viewProps.rel = rel;
|
|
436
|
+
}
|
|
437
|
+
if (typeof target === "string") {
|
|
438
|
+
viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
const _focusable = focusable != null ? focusable : accessible;
|
|
442
|
+
if (_focusable === false) {
|
|
443
|
+
viewProps.tabIndex = "-1";
|
|
444
|
+
}
|
|
445
|
+
if (elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
446
|
+
if (_focusable === false || accessibilityDisabled === true) {
|
|
447
|
+
viewProps.tabIndex = "-1";
|
|
448
|
+
}
|
|
449
|
+
} else if (role === "button" || role === "checkbox" || role === "link" || role === "radio" || role === "textbox" || role === "switch") {
|
|
450
|
+
if (_focusable !== false) {
|
|
451
|
+
viewProps.tabIndex = "0";
|
|
452
|
+
}
|
|
453
|
+
} else {
|
|
454
|
+
if (_focusable === true) {
|
|
455
|
+
viewProps.tabIndex = "0";
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
viewProps = nonTamaguiProps;
|
|
460
|
+
if (forwardedRef) {
|
|
461
|
+
viewProps.ref = forwardedRef;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
181
464
|
if (process.env.NODE_ENV === "development" && !isText && isWeb) {
|
|
182
465
|
Children.toArray(props.children).forEach((item) => {
|
|
183
466
|
if (typeof item === "string") {
|
|
@@ -185,7 +468,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
185
468
|
}
|
|
186
469
|
});
|
|
187
470
|
}
|
|
188
|
-
const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
|
|
189
471
|
const internal = useRef();
|
|
190
472
|
if (!internal.current) {
|
|
191
473
|
internal.current = {
|
|
@@ -204,50 +486,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
204
486
|
internal.current.isMounted = false;
|
|
205
487
|
};
|
|
206
488
|
}, [hasEnterStyle, props.animation]);
|
|
207
|
-
if (nativeID) {
|
|
208
|
-
viewProps.id = nativeID;
|
|
209
|
-
}
|
|
210
|
-
if (isAndroid) {
|
|
211
|
-
if (collapsable)
|
|
212
|
-
viewProps.collapsable = collapsable;
|
|
213
|
-
if (focusable)
|
|
214
|
-
viewProps.focusable = focusable;
|
|
215
|
-
}
|
|
216
|
-
if (!isWeb) {
|
|
217
|
-
if (accessible)
|
|
218
|
-
viewProps.accessible = accessible;
|
|
219
|
-
if (accessibilityRole)
|
|
220
|
-
viewProps.accessibilityRole = accessibilityRole;
|
|
221
|
-
}
|
|
222
|
-
if (isWeb && !asChild) {
|
|
223
|
-
rnw.useElementLayout(hostRef, onLayout);
|
|
224
|
-
rnw.useResponderEvents(hostRef, {
|
|
225
|
-
onMoveShouldSetResponder,
|
|
226
|
-
onMoveShouldSetResponderCapture,
|
|
227
|
-
onResponderEnd,
|
|
228
|
-
onResponderGrant,
|
|
229
|
-
onResponderMove,
|
|
230
|
-
onResponderReject,
|
|
231
|
-
onResponderRelease,
|
|
232
|
-
onResponderStart,
|
|
233
|
-
onResponderTerminate,
|
|
234
|
-
onResponderTerminationRequest,
|
|
235
|
-
onScrollShouldSetResponder,
|
|
236
|
-
onScrollShouldSetResponderCapture,
|
|
237
|
-
onSelectionChangeShouldSetResponder,
|
|
238
|
-
onSelectionChangeShouldSetResponderCapture,
|
|
239
|
-
onStartShouldSetResponder,
|
|
240
|
-
onStartShouldSetResponderCapture
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
const isTaggable = !Component || typeof Component === "string";
|
|
244
|
-
const element = isWeb ? isTaggable ? tag || Component : Component : Component;
|
|
245
|
-
const BaseTextComponent = !isWeb ? Text : element || "span";
|
|
246
|
-
const BaseViewComponent = !isWeb ? View : element || (hasTextAncestor ? "span" : "div");
|
|
247
|
-
let ViewComponent = isText ? (isAnimated ? AnimatedText || Text : null) || BaseTextComponent : (isAnimated ? AnimatedView || View : null) || BaseViewComponent;
|
|
248
|
-
ViewComponent = Component || ViewComponent;
|
|
249
489
|
let styles;
|
|
250
|
-
const isStringElement = typeof ViewComponent === "string";
|
|
251
490
|
const animationStyles = state.animation ? state.animation.style : null;
|
|
252
491
|
if (isStringElement && shouldAvoidClasses) {
|
|
253
492
|
styles = {
|
|
@@ -292,36 +531,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
292
531
|
} else {
|
|
293
532
|
viewProps.style = styles;
|
|
294
533
|
}
|
|
295
|
-
if (pointerEvents) {
|
|
296
|
-
viewProps.pointerEvents = pointerEvents;
|
|
297
|
-
}
|
|
298
|
-
if (isWeb) {
|
|
299
|
-
const platformMethodsRef = rnw.usePlatformMethods(viewProps);
|
|
300
|
-
const setRef = rnw.useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
|
|
301
|
-
if (!isAnimated) {
|
|
302
|
-
viewProps.ref = setRef;
|
|
303
|
-
} else {
|
|
304
|
-
if (forwardedRef) {
|
|
305
|
-
viewProps.ref = forwardedRef;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
if (props.href != null && hrefAttrs != null) {
|
|
309
|
-
const { download, rel, target } = hrefAttrs;
|
|
310
|
-
if (download != null) {
|
|
311
|
-
viewProps.download = download;
|
|
312
|
-
}
|
|
313
|
-
if (rel != null) {
|
|
314
|
-
viewProps.rel = rel;
|
|
315
|
-
}
|
|
316
|
-
if (typeof target === "string") {
|
|
317
|
-
viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
} else {
|
|
321
|
-
if (forwardedRef) {
|
|
322
|
-
viewProps.ref = forwardedRef;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
534
|
const initialPseudos = initialSplitStyles.pseudos;
|
|
326
535
|
const attachPress = !!(pseudos && pseudos.pressStyle || initialPseudos && initialPseudos.pressStyle || onPress || onPressOut || onPressIn || onClick);
|
|
327
536
|
const isTouch = useIsTouchDevice();
|
|
@@ -407,17 +616,10 @@ function createComponent(configIn, ParentComponent) {
|
|
|
407
616
|
...viewProps.dataSet,
|
|
408
617
|
className: viewProps.className
|
|
409
618
|
};
|
|
410
|
-
} else {
|
|
411
|
-
const rnProps = rnw.createDOMProps(viewProps);
|
|
412
|
-
const className = rnProps.className && rnProps.className !== viewProps.className ? `${rnProps.className} ${viewProps.className}` : viewProps.className;
|
|
413
|
-
Object.assign(viewProps, rnProps);
|
|
414
|
-
if (className) {
|
|
415
|
-
viewProps.className = className;
|
|
416
|
-
}
|
|
417
619
|
}
|
|
418
620
|
}
|
|
419
621
|
if (asChild) {
|
|
420
|
-
|
|
622
|
+
elementType = Slot;
|
|
421
623
|
const onlyChild = React.Children.only(children);
|
|
422
624
|
Object.assign(viewProps, onlyChild.props);
|
|
423
625
|
}
|
|
@@ -441,8 +643,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
441
643
|
}
|
|
442
644
|
}
|
|
443
645
|
}
|
|
444
|
-
content = createElement(
|
|
445
|
-
if (
|
|
646
|
+
content = createElement(elementType, viewProps, childEls);
|
|
647
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
446
648
|
if (attachPress && events) {
|
|
447
649
|
content = /* @__PURE__ */ React.createElement(Pressable, {
|
|
448
650
|
onPressIn: events[pressInKey],
|
|
@@ -468,7 +670,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
468
670
|
}
|
|
469
671
|
if (process.env.NODE_ENV === "development") {
|
|
470
672
|
if (props["debug"]) {
|
|
471
|
-
console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, state, splitStyles, animationStyles, isStringElement, classNamesIn: (_b = props.className) == null ? void 0 : _b.split(" "), classNamesOut: (_c = viewProps.className) == null ? void 0 : _c.split(" "), events, shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles, ...typeof window !== "undefined" ? { theme, themeState: theme.__state, themeClassName: theme.className, staticConfig, tamaguiConfig } : null });
|
|
673
|
+
console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, state, splitStyles, animationStyles, isStringElement, classNamesIn: (_b = props.className) == null ? void 0 : _b.split(" "), classNamesOut: (_c = viewProps.className) == null ? void 0 : _c.split(" "), events, shouldAttach, ViewComponent: elementType, viewProps, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles, ...typeof window !== "undefined" ? { theme, themeState: theme.__state, themeClassName: theme.className, staticConfig, tamaguiConfig } : null });
|
|
472
674
|
}
|
|
473
675
|
}
|
|
474
676
|
if (features.length) {
|
|
@@ -655,6 +857,24 @@ function AbsoluteFill(props) {
|
|
|
655
857
|
}, props.child);
|
|
656
858
|
}
|
|
657
859
|
__name(AbsoluteFill, "AbsoluteFill");
|
|
860
|
+
function processIDRefList(idRefList) {
|
|
861
|
+
return Array.isArray(idRefList) ? idRefList.join(" ") : idRefList;
|
|
862
|
+
}
|
|
863
|
+
__name(processIDRefList, "processIDRefList");
|
|
864
|
+
const accessibilityRoleToWebRole = {
|
|
865
|
+
adjustable: "slider",
|
|
866
|
+
button: "button",
|
|
867
|
+
header: "heading",
|
|
868
|
+
image: "img",
|
|
869
|
+
imagebutton: null,
|
|
870
|
+
keyboardkey: null,
|
|
871
|
+
label: null,
|
|
872
|
+
link: "link",
|
|
873
|
+
none: "presentation",
|
|
874
|
+
search: "search",
|
|
875
|
+
summary: "region",
|
|
876
|
+
text: null
|
|
877
|
+
};
|
|
658
878
|
export {
|
|
659
879
|
AbsoluteFill,
|
|
660
880
|
Spacer,
|