@tamagui/core 1.0.0-beta.0.211 → 1.0.0-beta.11
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/README.md +1 -0
- package/dist/cjs/createComponent.js +47 -16
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +34 -3
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/fixNativeShadow.native.js +4 -7
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/cjs/helpers/getButtonSize.js +45 -0
- package/dist/cjs/helpers/getButtonSize.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +36 -13
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getTextSize.js +56 -0
- package/dist/cjs/helpers/getTextSize.js.map +7 -0
- package/dist/cjs/helpers/insertStyleRule.js +1 -0
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/hooks/useId.js +59 -0
- package/dist/cjs/hooks/useId.js.map +7 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +4 -4
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +0 -1
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/usePrevious.js +1 -0
- package/dist/cjs/hooks/usePrevious.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +9 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/styled.js +4 -1
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Slot.js +115 -0
- package/dist/cjs/views/Slot.js.map +7 -0
- package/dist/esm/createComponent.js +51 -21
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +35 -3
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.native.js +5 -7
- package/dist/esm/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/esm/helpers/getButtonSize.js +24 -0
- package/dist/esm/helpers/getButtonSize.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +40 -15
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getTextSize.js +34 -0
- package/dist/esm/helpers/getTextSize.js.map +7 -0
- package/dist/esm/helpers/insertStyleRule.js +1 -0
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/hooks/useId.js +35 -0
- package/dist/esm/hooks/useId.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +6 -6
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +0 -1
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/usePrevious.js +1 -0
- package/dist/esm/hooks/usePrevious.js.map +7 -0
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +9 -6
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/styled.js +4 -1
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Slot.js +63 -0
- package/dist/esm/views/Slot.js.map +7 -0
- package/dist/jsx/createComponent.js +51 -21
- package/dist/jsx/helpers/createPropMapper.js +35 -3
- package/dist/jsx/helpers/fixNativeShadow.native.js +5 -7
- package/dist/jsx/helpers/getButtonSize.js +23 -0
- package/dist/jsx/helpers/getSplitStyles.js +40 -15
- package/dist/jsx/helpers/getTextSize.js +33 -0
- package/dist/jsx/helpers/insertStyleRule.js +1 -0
- package/dist/jsx/hooks/useId.js +34 -0
- package/dist/jsx/hooks/useIsTouchDevice.js +6 -6
- package/dist/jsx/hooks/useMedia.js +0 -1
- package/dist/jsx/hooks/usePrevious.js +0 -0
- package/dist/jsx/index.js +9 -6
- package/dist/jsx/styled.js +4 -1
- package/dist/jsx/views/Slot.js +56 -0
- package/package.json +7 -5
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +1 -1
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/fixNativeShadow.native.d.ts +2 -1
- package/types/helpers/fixNativeShadow.native.d.ts.map +1 -1
- package/types/helpers/getButtonSize.d.ts +8 -0
- package/types/helpers/getButtonSize.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +10 -5
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getTextSize.d.ts +3 -0
- package/types/helpers/getTextSize.d.ts.map +1 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/hooks/useId.d.ts +9 -0
- package/types/hooks/useId.d.ts.map +1 -0
- package/types/hooks/useMedia.d.ts +3 -7
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/usePrevious.d.ts +1 -0
- package/types/hooks/usePrevious.d.ts.map +1 -0
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +9 -6
- package/types/index.d.ts.map +1 -1
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +23 -8
- package/types/types.d.ts.map +1 -1
- package/types/views/Slot.d.ts +9 -0
- package/types/views/Slot.d.ts.map +1 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/views/Slot.tsx"],
|
|
4
|
+
"sourcesContent": ["// via radix\n\nimport { composeRefs } from '@tamagui/compose-refs'\nimport * as React from 'react'\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SlotProps = {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.Children.toArray(children).some(isSlottable)) {\n return (\n <>\n {React.Children.map(children, (child) => {\n return isSlottable(child) ? (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {child.props.children}\n </SlotClone>\n ) : (\n child\n )\n })}\n </>\n )\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n )\n})\n\nSlot.displayName = 'Slot'\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode\n}\n\nconst SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props\n\n if (React.isValidElement(children)) {\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n ref: composeRefs(forwardedRef, (children as any).ref),\n })\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null\n})\n\nSlotClone.displayName = 'SlotClone'\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Slottable = ({ children }: { children: React.ReactNode }) => {\n return <>{children}</>\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>\n\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n return React.isValidElement(child)\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps }\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName]\n const childPropValue = childProps[propName]\n\n const isHandler = /^on[A-Z]/.test(propName)\n // if it's a handler, modify the override by composing the base handler\n if (isHandler) {\n overrideProps[propName] = (...args: unknown[]) => {\n childPropValue?.(...args)\n slotPropValue?.(...args)\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue }\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ')\n }\n }\n\n return { ...slotProps, ...overrideProps }\n}\n"],
|
|
5
|
+
"mappings": ";;AAEA;AACA;AAUO,MAAM,OAAO,MAAM,WAAmC,CAAC,OAAO,iBAAiB;AACpF,QAAM,EAAE,aAAa,cAAc;AAEnC,MAAI,MAAM,SAAS,QAAQ,QAAQ,EAAE,KAAK,WAAW,GAAG;AACtD,WACE,0DACG,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,aAAO,YAAY,KAAK,IACtB,oCAAC;AAAA,WAAc;AAAA,QAAW,KAAK;AAAA,SAC5B,MAAM,MAAM,QACf,IAEA;AAAA,IAEJ,CAAC,CACH;AAAA,EAEJ;AAEA,SACE,oCAAC;AAAA,OAAc;AAAA,IAAW,KAAK;AAAA,KAC5B,QACH;AAEJ,CAAC;AAED,KAAK,cAAc;AAUnB,MAAM,YAAY,MAAM,WAAgC,CAAC,OAAO,iBAAiB;AAC/E,QAAM,EAAE,aAAa,cAAc;AAEnC,MAAI,MAAM,eAAe,QAAQ,GAAG;AAClC,WAAO,MAAM,aAAa,UAAU;AAAA,SAC/B,WAAW,WAAW,SAAS,KAAK;AAAA,MACvC,KAAK,YAAY,cAAe,SAAiB,GAAG;AAAA,IACtD,CAAC;AAAA,EACH;AAEA,SAAO,MAAM,SAAS,MAAM,QAAQ,IAAI,IAAI,MAAM,SAAS,KAAK,IAAI,IAAI;AAC1E,CAAC;AAED,UAAU,cAAc;AAMjB,MAAM,YAAY,wBAAC,EAAE,eAA8C;AACxE,SAAO,0DAAG,QAAS;AACrB,GAFyB;AAQzB,qBAAqB,OAAqD;AACxE,SAAO,MAAM,eAAe,KAAK;AACnC;AAFS;AAIT,oBAAoB,WAAqB,YAAsB;AAE7D,QAAM,gBAAgB,KAAK,WAAW;AAEtC,aAAW,YAAY,YAAY;AACjC,UAAM,gBAAgB,UAAU;AAChC,UAAM,iBAAiB,WAAW;AAElC,UAAM,YAAY,WAAW,KAAK,QAAQ;AAE1C,QAAI,WAAW;AACb,oBAAc,YAAY,IAAI,SAAoB;AAChD,yDAAiB,GAAG;AACpB,uDAAgB,GAAG;AAAA,MACrB;AAAA,IACF,WAES,aAAa,SAAS;AAC7B,oBAAc,YAAY,KAAK,kBAAkB,eAAe;AAAA,IAClE,WAAW,aAAa,aAAa;AACnC,oBAAc,YAAY,CAAC,eAAe,cAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,IACpF;AAAA,EACF;AAEA,SAAO,KAAK,cAAc,cAAc;AAC1C;AAzBS;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -16,18 +16,19 @@ import React, {
|
|
|
16
16
|
import { StyleSheet, Text, View } from "react-native";
|
|
17
17
|
import { onConfiguredOnce } from "./conf";
|
|
18
18
|
import { stackDefaultStyles } from "./constants/constants";
|
|
19
|
-
import { isAndroid,
|
|
19
|
+
import { isAndroid, isWeb, useIsomorphicLayoutEffect } from "./constants/platform";
|
|
20
20
|
import { rnw } from "./constants/rnw";
|
|
21
|
-
import { isVariable } from "./createVariable";
|
|
22
21
|
import { createShallowUpdate } from "./helpers/createShallowUpdate";
|
|
23
22
|
import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
24
|
-
import {
|
|
23
|
+
import { insertSplitStyles, useSplitStyles } from "./helpers/getSplitStyles";
|
|
25
24
|
import { getAllSelectors } from "./helpers/insertStyleRule";
|
|
26
25
|
import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
|
|
27
26
|
import { wrapThemeManagerContext } from "./helpers/wrapThemeManagerContext";
|
|
28
27
|
import { useFeatures } from "./hooks/useFeatures";
|
|
28
|
+
import { useIsTouchDevice } from "./hooks/useIsTouchDevice";
|
|
29
29
|
import { usePressable } from "./hooks/usePressable";
|
|
30
30
|
import { getThemeManagerIfChanged, useTheme } from "./hooks/useTheme";
|
|
31
|
+
import { Slot } from "./views/Slot";
|
|
31
32
|
import { TextAncestorContext } from "./views/TextAncestorContext";
|
|
32
33
|
React["keep"];
|
|
33
34
|
const defaultComponentState = {
|
|
@@ -44,6 +45,14 @@ if (typeof document !== "undefined") {
|
|
|
44
45
|
mouseUps.forEach((x) => x());
|
|
45
46
|
mouseUps.clear();
|
|
46
47
|
});
|
|
48
|
+
document.addEventListener("touchend", () => {
|
|
49
|
+
mouseUps.forEach((x) => x());
|
|
50
|
+
mouseUps.clear();
|
|
51
|
+
});
|
|
52
|
+
document.addEventListener("touchcancel", () => {
|
|
53
|
+
mouseUps.forEach((x) => x());
|
|
54
|
+
mouseUps.clear();
|
|
55
|
+
});
|
|
47
56
|
}
|
|
48
57
|
function mergeShorthands({ defaultProps }, { shorthands }) {
|
|
49
58
|
for (const key in defaultProps) {
|
|
@@ -68,6 +77,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
68
77
|
let avoidClasses = true;
|
|
69
78
|
let defaultNativeStyle;
|
|
70
79
|
let defaultNativeStyleSheet;
|
|
80
|
+
let tamaguiDefaultProps;
|
|
71
81
|
let initialSplitStyles;
|
|
72
82
|
function addPseudoToStyles(styles, name, pseudos) {
|
|
73
83
|
const pseudoStyle = pseudos[name];
|
|
@@ -83,11 +93,12 @@ function createComponent(configIn, ParentComponent) {
|
|
|
83
93
|
__name(addPseudoToStyles, "addPseudoToStyles");
|
|
84
94
|
const component = forwardRef((props, forwardedRef) => {
|
|
85
95
|
var _a, _b, _c, _d;
|
|
96
|
+
props = tamaguiDefaultProps && !props.asChild ? { ...tamaguiDefaultProps, ...props } : props;
|
|
86
97
|
const { Component, componentName, isText, isZStack } = staticConfig;
|
|
87
98
|
if (process.env.NODE_ENV === "development") {
|
|
88
99
|
if (props["debug"]) {
|
|
89
|
-
console.
|
|
90
|
-
console.log("props in:", props);
|
|
100
|
+
console.log("\u26A0\uFE0F", staticConfig.componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "debug on");
|
|
101
|
+
console.log("props in:", props, Object.keys(props));
|
|
91
102
|
if (props["debug"] === "break")
|
|
92
103
|
debugger;
|
|
93
104
|
}
|
|
@@ -97,7 +108,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
97
108
|
const [state, set_] = useState(defaultComponentState);
|
|
98
109
|
const setStateShallow = createShallowUpdate(set_);
|
|
99
110
|
const shouldAvoidClasses = !!(props.animation && avoidClasses);
|
|
100
|
-
const splitStyles =
|
|
111
|
+
const splitStyles = useSplitStyles(props, staticConfig, theme, shouldAvoidClasses ? { ...state, noClassNames: true, resolveVariablesAs: "value" } : state, shouldAvoidClasses || props.asChild ? null : initialSplitStyles.classNames);
|
|
101
112
|
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
|
|
102
113
|
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
103
114
|
const isAnimated = !!(useAnimations && props.animation);
|
|
@@ -116,6 +127,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
116
127
|
const {
|
|
117
128
|
tag,
|
|
118
129
|
hitSlop,
|
|
130
|
+
asChild,
|
|
119
131
|
children,
|
|
120
132
|
pointerEvents,
|
|
121
133
|
onPress,
|
|
@@ -199,7 +211,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
199
211
|
if (accessibilityRole)
|
|
200
212
|
viewProps.accessibilityRole = accessibilityRole;
|
|
201
213
|
}
|
|
202
|
-
if (isWeb) {
|
|
214
|
+
if (isWeb && !asChild) {
|
|
203
215
|
rnw.useResponderEvents(hostRef, {
|
|
204
216
|
onMoveShouldSetResponder,
|
|
205
217
|
onMoveShouldSetResponderCapture,
|
|
@@ -303,10 +315,11 @@ function createComponent(configIn, ParentComponent) {
|
|
|
303
315
|
}
|
|
304
316
|
const initialPseudos = initialSplitStyles.pseudos;
|
|
305
317
|
const attachPress = !!(pseudos && pseudos.pressStyle || initialPseudos && initialPseudos.pressStyle || onPress || onPressOut || onPressIn || onClick);
|
|
306
|
-
const
|
|
318
|
+
const isTouch = useIsTouchDevice();
|
|
319
|
+
const isHoverable = isWeb && !isTouch;
|
|
307
320
|
const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
308
321
|
const pressEventKey = isStringElement ? "onClick" : "onPress";
|
|
309
|
-
const shouldAttach = attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props);
|
|
322
|
+
const shouldAttach = !asChild && (attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props));
|
|
310
323
|
const unPress = useCallback(() => {
|
|
311
324
|
if (!internal.current.isMounted)
|
|
312
325
|
return;
|
|
@@ -361,15 +374,18 @@ function createComponent(configIn, ParentComponent) {
|
|
|
361
374
|
});
|
|
362
375
|
onPressIn == null ? void 0 : onPressIn(e);
|
|
363
376
|
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
377
|
+
if (isWeb) {
|
|
378
|
+
mouseUps.add(unPress);
|
|
379
|
+
}
|
|
364
380
|
} : null,
|
|
365
381
|
[pressEventKey]: attachPress ? (e) => {
|
|
382
|
+
onClick == null ? void 0 : onClick(e);
|
|
366
383
|
onPress == null ? void 0 : onPress(e);
|
|
367
384
|
unPress();
|
|
368
385
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
369
|
-
onClick == null ? void 0 : onClick(e);
|
|
370
386
|
} : null
|
|
371
387
|
} : null;
|
|
372
|
-
|
|
388
|
+
const childEls = !children || asChild ? children : wrapThemeManagerContext(spacedChildren({
|
|
373
389
|
children,
|
|
374
390
|
space,
|
|
375
391
|
flexDirection: props.flexDirection || ((_b = staticConfig.defaultProps) == null ? void 0 : _b.flexDirection),
|
|
@@ -409,6 +425,11 @@ function createComponent(configIn, ParentComponent) {
|
|
|
409
425
|
Object.assign(viewProps, events);
|
|
410
426
|
}
|
|
411
427
|
}
|
|
428
|
+
if (asChild) {
|
|
429
|
+
ViewComponent = Slot;
|
|
430
|
+
const onlyChild = React.Children.only(children);
|
|
431
|
+
Object.assign(viewProps, onlyChild.props);
|
|
432
|
+
}
|
|
412
433
|
content = createElement(ViewComponent, viewProps, childEls);
|
|
413
434
|
if (isWeb && events && attachHover) {
|
|
414
435
|
content = <span className="tui_Hoverable" style={{
|
|
@@ -441,7 +462,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
441
462
|
AnimatedText = (_b = tamaguiConfig.animations) == null ? void 0 : _b.Text;
|
|
442
463
|
AnimatedView = (_c = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _c.View;
|
|
443
464
|
initialTheme = initialTheme || proxyThemeVariables(conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]);
|
|
444
|
-
initialSplitStyles =
|
|
465
|
+
initialSplitStyles = insertSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, {
|
|
445
466
|
mounted: true,
|
|
446
467
|
hover: false,
|
|
447
468
|
press: false,
|
|
@@ -450,24 +471,33 @@ function createComponent(configIn, ParentComponent) {
|
|
|
450
471
|
resolveVariablesAs: "both",
|
|
451
472
|
keepVariantsAsProps: true
|
|
452
473
|
});
|
|
453
|
-
const
|
|
474
|
+
const defaults = {
|
|
475
|
+
...component.defaultProps,
|
|
476
|
+
...initialSplitStyles.viewProps
|
|
477
|
+
};
|
|
454
478
|
defaultNativeStyle = {};
|
|
455
|
-
for (const key in
|
|
456
|
-
const
|
|
457
|
-
|
|
479
|
+
for (const key in staticConfig.defaultProps) {
|
|
480
|
+
const val = staticConfig.defaultProps[key];
|
|
481
|
+
if (typeof val === "string" && val[0] === "$") {
|
|
482
|
+
defaults[key] = val;
|
|
483
|
+
} else {
|
|
484
|
+
defaultNativeStyle[key] = val;
|
|
485
|
+
}
|
|
458
486
|
}
|
|
459
487
|
defaultNativeStyleSheet = StyleSheet.create({
|
|
460
488
|
base: defaultNativeStyle
|
|
461
489
|
});
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
};
|
|
490
|
+
if (Object.keys(defaults).length) {
|
|
491
|
+
tamaguiDefaultProps = defaults;
|
|
492
|
+
}
|
|
466
493
|
if (process.env.NODE_ENV === "development" && ((_d = staticConfig.defaultProps) == null ? void 0 : _d.debug)) {
|
|
467
494
|
if (process.env.IS_STATIC !== "is_static") {
|
|
468
495
|
console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, {
|
|
469
496
|
staticConfig,
|
|
470
|
-
initialSplitStyles
|
|
497
|
+
initialSplitStyles,
|
|
498
|
+
tamaguiDefaultProps,
|
|
499
|
+
defaultNativeStyle,
|
|
500
|
+
defaults
|
|
471
501
|
});
|
|
472
502
|
}
|
|
473
503
|
}
|
|
@@ -63,7 +63,7 @@ const createPropMapper = /* @__PURE__ */ __name((staticConfig) => {
|
|
|
63
63
|
if (isObj(variantValue)) {
|
|
64
64
|
variantValue = resolveTokens(variantValue, conf, theme, fontFamily, returnVariablesAs);
|
|
65
65
|
}
|
|
66
|
-
return variantValue;
|
|
66
|
+
return expansions(variantValue);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
let shouldReturn = false;
|
|
@@ -80,9 +80,9 @@ const createPropMapper = /* @__PURE__ */ __name((staticConfig) => {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
if (shouldReturn) {
|
|
83
|
-
return {
|
|
83
|
+
return expansions({
|
|
84
84
|
[key]: value
|
|
85
|
-
};
|
|
85
|
+
});
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
}, "createPropMapper");
|
|
@@ -200,6 +200,38 @@ const tokenCategories = {
|
|
|
200
200
|
borderRightColor: true
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
|
+
const sidesX = ["Left", "Right"];
|
|
204
|
+
const sidesY = ["Top", "Bottom"];
|
|
205
|
+
const sidesXY = [...sidesX, ...sidesY];
|
|
206
|
+
const expand = {
|
|
207
|
+
padding: sidesXY.map((x) => `padding${x}`),
|
|
208
|
+
paddingHorizontal: sidesX.map((x) => `padding${x}`),
|
|
209
|
+
paddingVertical: sidesY.map((x) => `padding${x}`),
|
|
210
|
+
margin: sidesXY.map((x) => `margin${x}`),
|
|
211
|
+
marginHorizontal: sidesX.map((x) => `margin${x}`),
|
|
212
|
+
marginVertical: sidesY.map((x) => `margin${x}`),
|
|
213
|
+
borderWidth: sidesXY.map((x) => `border${x}Width`)
|
|
214
|
+
};
|
|
215
|
+
function expansions(styleObj) {
|
|
216
|
+
var _a, _b;
|
|
217
|
+
for (const key in expand) {
|
|
218
|
+
if (key in styleObj) {
|
|
219
|
+
for (const expandKey of expand[key]) {
|
|
220
|
+
styleObj[expandKey] = styleObj[key];
|
|
221
|
+
}
|
|
222
|
+
delete styleObj[key];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if ("flex" in styleObj) {
|
|
226
|
+
if (typeof styleObj.flex === "number") {
|
|
227
|
+
styleObj.flexGrow = (_a = styleObj.flexGrow) != null ? _a : styleObj.flex;
|
|
228
|
+
styleObj.flexShrink = (_b = styleObj.flexShrink) != null ? _b : 1;
|
|
229
|
+
delete styleObj.flex;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return styleObj;
|
|
233
|
+
}
|
|
234
|
+
__name(expansions, "expansions");
|
|
203
235
|
export {
|
|
204
236
|
createPropMapper
|
|
205
237
|
};
|
|
@@ -2,7 +2,8 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
const matchRgbaHsla = /(rgba|hsla)\(\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,}%?)\s*,\s*([\d\.]{1,})\s*\)$/;
|
|
4
4
|
function fixNativeShadow(props) {
|
|
5
|
-
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if (!props.shadowColor || props.shadowColor === "transparent") {
|
|
6
7
|
return;
|
|
7
8
|
}
|
|
8
9
|
if (!props.shadowOffset) {
|
|
@@ -11,10 +12,7 @@ function fixNativeShadow(props) {
|
|
|
11
12
|
height: 0
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const c = `${props.shadowColor}`;
|
|
15
|
+
const c = String(props.shadowColor);
|
|
18
16
|
if ((c[0] === "r" || c[0] === "h") && c[3] === "a") {
|
|
19
17
|
const [_, type, _1, _2, _3, a] = c.match(matchRgbaHsla) || [];
|
|
20
18
|
if (typeof a !== "string") {
|
|
@@ -22,9 +20,9 @@ function fixNativeShadow(props) {
|
|
|
22
20
|
throw new Error(`invalid style`);
|
|
23
21
|
}
|
|
24
22
|
props.shadowColor = `${type.replace("a", "")}(${_1},${_2},${_3})`;
|
|
25
|
-
props.shadowOpacity = +a;
|
|
23
|
+
props.shadowOpacity = (_a = props.shadowOpacity) != null ? _a : +a;
|
|
26
24
|
} else {
|
|
27
|
-
props.shadowOpacity = 1;
|
|
25
|
+
props.shadowOpacity = (_b = props.shadowOpacity) != null ? _b : 1;
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
__name(fixNativeShadow, "fixNativeShadow");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { getVariableValue, isVariable } from "@tamagui/core";
|
|
4
|
+
const getButtonSize = /* @__PURE__ */ __name((sizeX = 0.9, sizeY = 0.333) => (val, { tokens, props, fonts }) => {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6
|
+
const size = (_c = (_b = (_a = tokens.size[val]) != null ? _a : tokens.size["$4"]) != null ? _b : val) != null ? _c : 14;
|
|
7
|
+
const radius = (_e = (_d = tokens.radius[val]) != null ? _d : tokens.radius["$4"]) != null ? _e : size;
|
|
8
|
+
const px = Math.round(+(isVariable(size) ? size.val : size) * sizeX);
|
|
9
|
+
const py = Math.round(+(isVariable(size) ? size.val : size) * sizeY);
|
|
10
|
+
const font = fonts[props.fontFamily] || fonts["$body"];
|
|
11
|
+
const lineHeights = font.lineHeight;
|
|
12
|
+
const lineHeight = (_f = lineHeights[val]) != null ? _f : lineHeights["$4"];
|
|
13
|
+
const minHeight = Math.round(getVariableValue(lineHeight) + py * 2);
|
|
14
|
+
return {
|
|
15
|
+
minHeight,
|
|
16
|
+
paddingHorizontal: props.circular ? 0 : px,
|
|
17
|
+
paddingVertical: props.circular ? 0 : py,
|
|
18
|
+
borderRadius: props.circular ? 1e5 : (_g = props.borderRadius) != null ? _g : radius
|
|
19
|
+
};
|
|
20
|
+
}, "getButtonSize");
|
|
21
|
+
export {
|
|
22
|
+
getButtonSize
|
|
23
|
+
};
|
|
@@ -7,13 +7,19 @@ import {
|
|
|
7
7
|
validPseudoKeys,
|
|
8
8
|
validStyles
|
|
9
9
|
} from "@tamagui/helpers";
|
|
10
|
+
import { useInsertionEffect } from "react";
|
|
10
11
|
import { getConfig } from "../conf";
|
|
11
|
-
import { isClient, isWeb } from "../constants/platform";
|
|
12
|
+
import { isClient, isWeb, useIsomorphicLayoutEffect } from "../constants/platform";
|
|
12
13
|
import { mediaQueryConfig, mediaState } from "../hooks/useMedia";
|
|
13
14
|
import { createMediaStyle } from "./createMediaStyle";
|
|
14
15
|
import { fixNativeShadow } from "./fixNativeShadow";
|
|
15
16
|
import { getStylesAtomic } from "./getStylesAtomic";
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
insertStyleRule,
|
|
19
|
+
insertedTransforms,
|
|
20
|
+
updateInserted,
|
|
21
|
+
updateInsertedCache
|
|
22
|
+
} from "./insertStyleRule";
|
|
17
23
|
const skipProps = {
|
|
18
24
|
animation: true,
|
|
19
25
|
animateOnly: true,
|
|
@@ -34,6 +40,12 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
|
|
|
34
40
|
};
|
|
35
41
|
const pseudos = {};
|
|
36
42
|
const medias = {};
|
|
43
|
+
const rulesToInsert = [];
|
|
44
|
+
function addStyle(prop, rule) {
|
|
45
|
+
rulesToInsert.push([prop, rule]);
|
|
46
|
+
updateInsertedCache(prop, rule);
|
|
47
|
+
}
|
|
48
|
+
__name(addStyle, "addStyle");
|
|
37
49
|
let cur = null;
|
|
38
50
|
let transforms = {};
|
|
39
51
|
function mergeClassName(key, val) {
|
|
@@ -89,7 +101,7 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
|
|
|
89
101
|
const atomic = getStylesAtomic(cur);
|
|
90
102
|
for (const atomicStyle of atomic) {
|
|
91
103
|
if (!state.noClassNames) {
|
|
92
|
-
|
|
104
|
+
addStyle(atomicStyle.identifier, atomicStyle.rules[0]);
|
|
93
105
|
mergeClassName(atomicStyle.property, atomicStyle.identifier);
|
|
94
106
|
} else {
|
|
95
107
|
style[atomicStyle.property] = atomicStyle.value;
|
|
@@ -162,7 +174,7 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
|
|
|
162
174
|
if (isWeb && !state.noClassNames) {
|
|
163
175
|
const pseudoStyles = getStylesAtomic({ [key]: pseudos[key] });
|
|
164
176
|
for (const style2 of pseudoStyles) {
|
|
165
|
-
|
|
177
|
+
addStyle(style2.identifier, style2.rules[0]);
|
|
166
178
|
mergeClassName(`${style2.property}-${key}`, style2.identifier);
|
|
167
179
|
}
|
|
168
180
|
}
|
|
@@ -184,7 +196,7 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
|
|
|
184
196
|
const mediaStyles = getStylesAtomic(mediaStyle);
|
|
185
197
|
for (const style2 of mediaStyles) {
|
|
186
198
|
const out2 = createMediaStyle(style2, mediaKeyShort, mediaQueryConfig);
|
|
187
|
-
|
|
199
|
+
addStyle(out2.identifier, out2.styleRule);
|
|
188
200
|
mergeClassName(`${out2.identifier}-${mediaKey}`, out2.identifier);
|
|
189
201
|
}
|
|
190
202
|
} else {
|
|
@@ -223,7 +235,7 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
|
|
|
223
235
|
if (isClient) {
|
|
224
236
|
if (!insertedTransforms[identifier]) {
|
|
225
237
|
const rule = `.${identifier} { transform: ${val}; }`;
|
|
226
|
-
|
|
238
|
+
addStyle(identifier, rule);
|
|
227
239
|
}
|
|
228
240
|
}
|
|
229
241
|
classNames[namespace] = identifier;
|
|
@@ -237,9 +249,27 @@ const getSplitStyles = /* @__PURE__ */ __name((props, staticConfig, theme, state
|
|
|
237
249
|
style,
|
|
238
250
|
medias,
|
|
239
251
|
pseudos,
|
|
240
|
-
classNames
|
|
252
|
+
classNames,
|
|
253
|
+
rulesToInsert
|
|
241
254
|
};
|
|
242
255
|
}, "getSplitStyles");
|
|
256
|
+
const insertSplitStyles = /* @__PURE__ */ __name((...args) => {
|
|
257
|
+
const res = getSplitStyles(...args);
|
|
258
|
+
for (const [prop, rule] of res.rulesToInsert) {
|
|
259
|
+
insertStyleRule(prop, rule);
|
|
260
|
+
}
|
|
261
|
+
return res;
|
|
262
|
+
}, "insertSplitStyles");
|
|
263
|
+
const effect = useInsertionEffect || useIsomorphicLayoutEffect;
|
|
264
|
+
const useSplitStyles = /* @__PURE__ */ __name((...args) => {
|
|
265
|
+
const res = getSplitStyles(...args);
|
|
266
|
+
effect(() => {
|
|
267
|
+
for (const [prop, rule] of res.rulesToInsert) {
|
|
268
|
+
insertStyleRule(prop, rule);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
return res;
|
|
272
|
+
}, "useSplitStyles");
|
|
243
273
|
const getSubStyle = /* @__PURE__ */ __name((styleIn, staticConfig, theme, props, state, avoidDefaultProps) => {
|
|
244
274
|
const styleOut = {};
|
|
245
275
|
for (const key in styleIn) {
|
|
@@ -258,13 +288,6 @@ const getSubStyle = /* @__PURE__ */ __name((styleIn, staticConfig, theme, props,
|
|
|
258
288
|
return styleOut;
|
|
259
289
|
}, "getSubStyle");
|
|
260
290
|
function normalizeStyleObject(style) {
|
|
261
|
-
var _a, _b;
|
|
262
|
-
if (typeof style.flex === "number") {
|
|
263
|
-
const val = style.flex;
|
|
264
|
-
delete style.flex;
|
|
265
|
-
style.flexGrow = (_a = style.flexGrow) != null ? _a : val;
|
|
266
|
-
style.flexShrink = (_b = style.flexShrink) != null ? _b : 1;
|
|
267
|
-
}
|
|
268
291
|
if (!isWeb) {
|
|
269
292
|
fixNativeShadow(style);
|
|
270
293
|
}
|
|
@@ -273,5 +296,7 @@ __name(normalizeStyleObject, "normalizeStyleObject");
|
|
|
273
296
|
export {
|
|
274
297
|
getSplitStyles,
|
|
275
298
|
getSubStyle,
|
|
276
|
-
|
|
299
|
+
insertSplitStyles,
|
|
300
|
+
normalizeStyleObject,
|
|
301
|
+
useSplitStyles
|
|
277
302
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { getVariableValue } from "../createVariable";
|
|
4
|
+
const getTextSize = /* @__PURE__ */ __name((val = "$4", { fonts, theme, props }) => {
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
const family = getVariableValue(props.fontFamily) || "$body";
|
|
7
|
+
const font = fonts[family] || fonts["$body"];
|
|
8
|
+
if (!font) {
|
|
9
|
+
console.warn("\u26A0\uFE0F no font found", { family, fontTokens: Object.keys(fonts), val });
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const fontFamily = font.family;
|
|
13
|
+
const fontSize = props.fontSize || font.size[val];
|
|
14
|
+
const lineHeight = props.lineHeight || font.lineHeight[val];
|
|
15
|
+
const fontWeight = props.fontWeight || font.weight[val];
|
|
16
|
+
const letterSpacing = props.letterSpacing || font.letterSpacing[val];
|
|
17
|
+
const fontStyle = props.fontStyle || ((_a = font.style) == null ? void 0 : _a[val]);
|
|
18
|
+
const textTransform = props.textTransform || ((_b = font.transform) == null ? void 0 : _b[val]);
|
|
19
|
+
const color = props.color || ((_c = font.color) == null ? void 0 : _c[val]) || theme.color;
|
|
20
|
+
return {
|
|
21
|
+
color,
|
|
22
|
+
fontStyle,
|
|
23
|
+
textTransform,
|
|
24
|
+
fontFamily,
|
|
25
|
+
fontWeight,
|
|
26
|
+
letterSpacing,
|
|
27
|
+
fontSize,
|
|
28
|
+
lineHeight
|
|
29
|
+
};
|
|
30
|
+
}, "getTextSize");
|
|
31
|
+
export {
|
|
32
|
+
getTextSize
|
|
33
|
+
};
|
|
@@ -79,6 +79,7 @@ function insertStyleRule(identifier, rule) {
|
|
|
79
79
|
return;
|
|
80
80
|
hasInsertedSinceUpdate = true;
|
|
81
81
|
updateInsertedCache(identifier, rule);
|
|
82
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
82
83
|
sheet == null ? void 0 : sheet.insertRule(rule, sheet.cssRules.length);
|
|
83
84
|
}
|
|
84
85
|
__name(insertStyleRule, "insertStyleRule");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useIsomorphicLayoutEffect } from "../constants/platform";
|
|
5
|
+
let serverHandoffComplete = false;
|
|
6
|
+
let id = 0;
|
|
7
|
+
function genId() {
|
|
8
|
+
return ++id;
|
|
9
|
+
}
|
|
10
|
+
__name(genId, "genId");
|
|
11
|
+
function useId(providedId) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (typeof React.useId === "function") {
|
|
14
|
+
let id3 = React.useId(providedId);
|
|
15
|
+
return providedId != null ? providedId : id3;
|
|
16
|
+
}
|
|
17
|
+
let initialId = providedId != null ? providedId : serverHandoffComplete ? genId() : null;
|
|
18
|
+
let [id2, setId] = React.useState(initialId);
|
|
19
|
+
useIsomorphicLayoutEffect(() => {
|
|
20
|
+
if (id2 === null) {
|
|
21
|
+
setId(genId());
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (serverHandoffComplete === false) {
|
|
26
|
+
serverHandoffComplete = true;
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
return (_a = providedId != null ? providedId : id2) != null ? _a : void 0;
|
|
30
|
+
}
|
|
31
|
+
__name(useId, "useId");
|
|
32
|
+
export {
|
|
33
|
+
useId
|
|
34
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import {
|
|
4
|
-
import { isTouchDevice } from "../constants/platform";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { isTouchDevice, useIsomorphicLayoutEffect } from "../constants/platform";
|
|
5
5
|
const useIsTouchDevice = /* @__PURE__ */ __name(() => {
|
|
6
6
|
const [touchOnly, setTouchOnly] = useState(false);
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
useIsomorphicLayoutEffect(() => {
|
|
8
|
+
if (isTouchDevice) {
|
|
9
9
|
setTouchOnly(true);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
10
|
+
}
|
|
11
|
+
}, []);
|
|
12
12
|
return touchOnly;
|
|
13
13
|
}, "useIsTouchDevice");
|
|
14
14
|
export {
|
|
File without changes
|
package/dist/jsx/index.js
CHANGED
|
@@ -13,31 +13,34 @@ import { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } f
|
|
|
13
13
|
export * from "./constants/constants";
|
|
14
14
|
export * from "./constants/platform";
|
|
15
15
|
export * from "./constants/rnw";
|
|
16
|
+
export * from "./helpers/getButtonSize";
|
|
16
17
|
export * from "./helpers/getExpandedShorthands";
|
|
17
18
|
export * from "./helpers/getSize";
|
|
18
19
|
export * from "./helpers/getSplitStyles";
|
|
19
20
|
export * from "./helpers/getStylesAtomic";
|
|
21
|
+
export * from "./helpers/getTextSize";
|
|
20
22
|
export * from "./helpers/isObj";
|
|
21
23
|
export * from "./helpers/isTamaguiElement";
|
|
22
24
|
export * from "./helpers/matchMedia";
|
|
23
25
|
export * from "./helpers/themeable";
|
|
24
26
|
export * from "./helpers/withStaticProperties";
|
|
25
27
|
export * from "./contexts/ButtonInsideButtonContext";
|
|
26
|
-
export * from "./hooks/useIsTouchDevice";
|
|
27
28
|
export * from "./hooks/useConstant";
|
|
28
|
-
export * from "./hooks/
|
|
29
|
+
export * from "./hooks/useId";
|
|
30
|
+
export * from "./hooks/useIsMounted";
|
|
31
|
+
export * from "./hooks/useIsTouchDevice";
|
|
29
32
|
export * from "./hooks/useMedia";
|
|
33
|
+
export * from "./hooks/usePressable";
|
|
30
34
|
export * from "./hooks/useTheme";
|
|
31
|
-
export * from "./hooks/useIsMounted";
|
|
32
35
|
export * from "./hooks/useUnmountEffect";
|
|
33
|
-
export * from "@tamagui/use-force-update";
|
|
34
36
|
export * from "./views/Stack";
|
|
35
37
|
export * from "./views/Text";
|
|
38
|
+
export * from "./views/TextAncestorContext";
|
|
36
39
|
export * from "./views/Theme";
|
|
37
|
-
export * from "./views/ThemeReset";
|
|
38
40
|
export * from "./views/ThemeInverse";
|
|
39
41
|
export * from "./views/ThemeProvider";
|
|
40
|
-
export * from "./views/
|
|
42
|
+
export * from "./views/ThemeReset";
|
|
43
|
+
export * from "@tamagui/use-force-update";
|
|
41
44
|
export * from "@tamagui/helpers";
|
|
42
45
|
export {
|
|
43
46
|
RNWTextProps,
|
package/dist/jsx/styled.js
CHANGED
|
@@ -5,14 +5,16 @@ import { createComponent } from "./createComponent";
|
|
|
5
5
|
import { RNComponents } from "./helpers/RNComponents";
|
|
6
6
|
function styled(Component, options, staticExtractionOptions) {
|
|
7
7
|
const staticConfigProps = (() => {
|
|
8
|
+
var _a;
|
|
8
9
|
if (options) {
|
|
9
10
|
const { variants, name, defaultVariants, ...defaultProps } = options;
|
|
10
11
|
if (defaultVariants) {
|
|
11
12
|
Object.assign(defaultProps, defaultVariants);
|
|
12
13
|
}
|
|
13
14
|
const isReactNativeWeb = "staticConfig" in Component ? Component.staticConfig.isReactNativeWeb : RNComponents.has(Component);
|
|
15
|
+
const reactNativeWebComponent = isReactNativeWeb ? ((_a = Component["staticConfig"]) == null ? void 0 : _a.reactNativeWebComponent) || Component : null;
|
|
14
16
|
const isTamagui = !isReactNativeWeb && "staticConfig" in Component;
|
|
15
|
-
const Comp = Component;
|
|
17
|
+
const Comp = reactNativeWebComponent || Component;
|
|
16
18
|
const isImage = !!(defaultProps.isImage || (!isTamagui ? Comp === Image : false));
|
|
17
19
|
const isInput = !!(defaultProps.isInput || (!isTamagui ? Comp === TextInput : false));
|
|
18
20
|
const isText = !!(defaultProps.isText || (!isTamagui ? isInput || Comp === Text : false));
|
|
@@ -27,6 +29,7 @@ function styled(Component, options, staticExtractionOptions) {
|
|
|
27
29
|
defaultVariants,
|
|
28
30
|
componentName: name,
|
|
29
31
|
isReactNativeWeb,
|
|
32
|
+
reactNativeWebComponent,
|
|
30
33
|
isInput,
|
|
31
34
|
isText,
|
|
32
35
|
isImage
|