@tamagui/core 1.0.1-beta.197 → 1.0.1-beta.199
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/constants/platform.js +74 -0
- package/dist/cjs/constants/platform.js.map +7 -0
- package/dist/cjs/constants/platform.native.js +62 -0
- package/dist/cjs/constants/platform.native.js.map +7 -0
- package/dist/cjs/createComponent.js +19 -16
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/validate.js +2 -0
- package/dist/cjs/{hooks/useMedia.test.js.map → helpers/validate.js.map} +0 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/{views/AbsoluteFill.native.js → inject-styles.js} +17 -22
- package/dist/cjs/inject-styles.js.map +7 -0
- package/dist/cjs/react-native.js +22 -0
- package/dist/cjs/react-native.js.map +7 -0
- package/dist/cjs/{views/AbsoluteFill.js → setupReactNative.js} +15 -19
- package/dist/cjs/setupReactNative.js.map +7 -0
- package/dist/cjs/styled.js +23 -5
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Text.js +1 -0
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/esm/constants/platform.js +39 -0
- package/dist/esm/constants/platform.js.map +7 -0
- package/dist/esm/constants/platform.native.js +28 -0
- package/dist/esm/constants/platform.native.js.map +7 -0
- package/dist/esm/createComponent.js +19 -16
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/helpers/validate.js +1 -0
- package/dist/esm/{hooks/useMedia.test.js.map → helpers/validate.js.map} +0 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/inject-styles.js +16 -0
- package/dist/esm/inject-styles.js.map +7 -0
- package/dist/esm/react-native.js +3 -0
- package/dist/esm/react-native.js.map +7 -0
- package/dist/esm/setupReactNative.js +12 -0
- package/dist/esm/setupReactNative.js.map +7 -0
- package/dist/esm/styled.js +23 -5
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Text.js +1 -0
- package/dist/esm/views/Text.js.map +2 -2
- package/package.json +20 -17
- package/src/createComponent.tsx +20 -17
- package/src/index.ts +1 -0
- package/src/{injectStyles.ts → inject-styles.ts} +0 -0
- package/src/setupReactNative.ts +9 -0
- package/src/styled.tsx +28 -7
- package/src/types.tsx +0 -5
- package/src/views/Text.tsx +2 -0
- package/types/index.d.ts +1 -0
- package/types/inject-styles.d.ts +7 -0
- package/types/react-native.d.ts +8 -0
- package/types/setupReactNative.d.ts +3 -0
- package/types/types.d.ts +0 -4
- package/dist/cjs/hooks/useMedia.test.js +0 -2
- package/dist/cjs/hooks/usePressablePressResponder.js +0 -370
- package/dist/cjs/hooks/usePressablePressResponder.js.map +0 -7
- package/dist/cjs/views/AbsoluteFill.js.map +0 -7
- package/dist/cjs/views/AbsoluteFill.native.js.map +0 -7
- package/dist/esm/hooks/useMedia.test.js +0 -1
- package/dist/esm/hooks/usePressablePressResponder.js +0 -346
- package/dist/esm/hooks/usePressablePressResponder.js.map +0 -7
- package/dist/esm/views/AbsoluteFill.js +0 -17
- package/dist/esm/views/AbsoluteFill.js.map +0 -7
- package/dist/esm/views/AbsoluteFill.native.js +0 -21
- package/dist/esm/views/AbsoluteFill.native.js.map +0 -7
package/dist/esm/views/Text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/Text.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport type { Text as TextView } from '@tamagui/types-react-native'\n\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n }),\n },\n\n variants: {\n ...(isWeb && {\n numberOfLines: {\n 1: ellipseStyle,\n\n ':number': (numberOfLines) =>\n numberOfLines >= 1\n ? {\n WebkitLineClamp: numberOfLines,\n WebkitBoxOrient: 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n }\n : null,\n },\n }),\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'default',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,oBAAoB,mBAAmB;AAGhD,SAAS,uBAAuB;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAI,SAAS;AAAA,MACX,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EAEA,UAAU;AAAA,IACR,GAAI,SAAS;AAAA,MACX,eAAe;AAAA,QACb,GAAG;AAAA,QAEH,WAAW,CAAC,kBACV,iBAAiB,IACb;AAAA,UACE,iBAAiB;AAAA,UACjB,iBAAiB;AAAA,UACjB,SAAS;AAAA,UACT,UAAU;AAAA,QACZ,IACA;AAAA,MACR;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EAEA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAE5C,aAAa;AAAA,IACX,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF,CAAC;",
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\nimport { stylePropsTextOnly, validStyles } from '@tamagui/helpers'\nimport type { Text as TextView } from '@tamagui/types-react-native'\n\nimport { createComponent } from '../createComponent'\nimport { TextProps, TextPropsBase } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps, TextView, TextPropsBase>({\n componentName: 'Text',\n isText: true,\n\n defaultProps: {\n display: 'flex',\n fontFamily: 'System',\n ...(isWeb && {\n display: 'inline',\n boxSizing: 'border-box',\n wordWrap: 'break-word',\n }),\n },\n\n inlineWhenUnflattened: new Set(['fontFamily']),\n\n variants: {\n ...(isWeb && {\n numberOfLines: {\n 1: ellipseStyle,\n\n ':number': (numberOfLines) =>\n numberOfLines >= 1\n ? {\n WebkitLineClamp: numberOfLines,\n WebkitBoxOrient: 'vertical',\n display: '-webkit-box',\n overflow: 'hidden',\n }\n : null,\n },\n }),\n\n selectable: {\n true: {\n userSelect: 'text',\n cursor: 'text',\n },\n false: {\n userSelect: 'none',\n cursor: 'default',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,oBAAoB,mBAAmB;AAGhD,SAAS,uBAAuB;AAGhC,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AAEO,MAAM,OAAO,gBAAoD;AAAA,EACtE,eAAe;AAAA,EACf,QAAQ;AAAA,EAER,cAAc;AAAA,IACZ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,GAAI,SAAS;AAAA,MACX,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EAEA,uBAAuB,oBAAI,IAAI,CAAC,YAAY,CAAC;AAAA,EAE7C,UAAU;AAAA,IACR,GAAI,SAAS;AAAA,MACX,eAAe;AAAA,QACb,GAAG;AAAA,QAEH,WAAW,CAAC,kBACV,iBAAiB,IACb;AAAA,UACE,iBAAiB;AAAA,UACjB,iBAAiB;AAAA,UACjB,SAAS;AAAA,UACT,UAAU;AAAA,QACZ,IACA;AAAA,MACR;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IAEA,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA,MACjB;AAAA,IACN;AAAA,EACF;AAAA,EAEA,YAAY,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;AAAA,EAE5C,aAAa;AAAA,IACX,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.199",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -28,24 +28,23 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@expo/match-media": "^0.3.0",
|
|
31
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
32
|
-
"@tamagui/constants": "^1.0.1-beta.
|
|
33
|
-
"@tamagui/helpers": "^1.0.1-beta.
|
|
34
|
-
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.
|
|
35
|
-
"@tamagui/react-native-use-pressable": "^1.0.1-beta.
|
|
36
|
-
"@tamagui/react-native-use-responder-events": "^1.0.1-beta.
|
|
37
|
-
"@tamagui/types-react-native": "^1.0.1-beta.
|
|
38
|
-
"@tamagui/use-did-finish-ssr": "^1.0.1-beta.
|
|
39
|
-
"@tamagui/use-event": "^1.0.1-beta.
|
|
40
|
-
"@tamagui/use-force-update": "^1.0.1-beta.
|
|
41
|
-
"ts-toolbelt": "^9.6.0"
|
|
31
|
+
"@tamagui/compose-refs": "^1.0.1-beta.199",
|
|
32
|
+
"@tamagui/constants": "^1.0.1-beta.199",
|
|
33
|
+
"@tamagui/helpers": "^1.0.1-beta.199",
|
|
34
|
+
"@tamagui/normalize-css-color-lite": "^1.0.1-beta.199",
|
|
35
|
+
"@tamagui/react-native-use-pressable": "^1.0.1-beta.199",
|
|
36
|
+
"@tamagui/react-native-use-responder-events": "^1.0.1-beta.199",
|
|
37
|
+
"@tamagui/types-react-native": "^1.0.1-beta.199",
|
|
38
|
+
"@tamagui/use-did-finish-ssr": "^1.0.1-beta.199",
|
|
39
|
+
"@tamagui/use-event": "^1.0.1-beta.199",
|
|
40
|
+
"@tamagui/use-force-update": "^1.0.1-beta.199"
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
43
|
"react": "*",
|
|
45
44
|
"react-dom": "*"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
47
|
+
"@tamagui/build": "^1.0.1-beta.199",
|
|
49
48
|
"@types/node": "^16.11.9",
|
|
50
49
|
"@types/react": "^18.0.15",
|
|
51
50
|
"@types/react-native": "^0.69.2",
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
"react": "*",
|
|
55
54
|
"react-dom": "*",
|
|
56
55
|
"typescript": "^4.7.4",
|
|
57
|
-
"vitest": "^0.
|
|
56
|
+
"vitest": "^0.24.3"
|
|
58
57
|
},
|
|
59
58
|
"exports": {
|
|
60
59
|
"./package.json": "./package.json",
|
|
@@ -63,9 +62,13 @@
|
|
|
63
62
|
"import": "./dist/esm/index.js",
|
|
64
63
|
"require": "./dist/cjs/index.js"
|
|
65
64
|
},
|
|
66
|
-
"./
|
|
67
|
-
"import": "./dist/esm/
|
|
68
|
-
"require": "./dist/cjs/
|
|
65
|
+
"./inject-styles": {
|
|
66
|
+
"import": "./dist/esm/inject-styles.js",
|
|
67
|
+
"require": "./dist/cjs/inject-styles.js"
|
|
68
|
+
},
|
|
69
|
+
"./react-native": {
|
|
70
|
+
"import": "./dist/esm/react-native.js",
|
|
71
|
+
"require": "./dist/cjs/react-native.js"
|
|
69
72
|
}
|
|
70
73
|
},
|
|
71
74
|
"repository": {
|
package/src/createComponent.tsx
CHANGED
|
@@ -618,15 +618,15 @@ export function createComponent<
|
|
|
618
618
|
}
|
|
619
619
|
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : ''
|
|
620
620
|
|
|
621
|
+
const classList = [
|
|
622
|
+
componentName ? componentClassName : '',
|
|
623
|
+
fontFamilyClassName,
|
|
624
|
+
theme.className,
|
|
625
|
+
classNames ? Object.values(classNames).join(' ') : '',
|
|
626
|
+
]
|
|
627
|
+
const className = classList.join(' ')
|
|
628
|
+
|
|
621
629
|
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
622
|
-
const classList = [
|
|
623
|
-
componentName ? componentClassName : '',
|
|
624
|
-
fontFamilyClassName,
|
|
625
|
-
theme.className,
|
|
626
|
-
classNames ? Object.values(classNames).join(' ') : '',
|
|
627
|
-
]
|
|
628
|
-
|
|
629
|
-
const className = classList.join(' ')
|
|
630
630
|
const style = animationStyles ?? splitStyles.style
|
|
631
631
|
|
|
632
632
|
if (isAnimatedReactNativeWeb) {
|
|
@@ -884,17 +884,20 @@ export function createComponent<
|
|
|
884
884
|
content = createElement(elementType, viewProps, childEls)
|
|
885
885
|
|
|
886
886
|
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
887
|
-
if (events) {
|
|
887
|
+
if (events || isAnimatedReactNativeWeb) {
|
|
888
888
|
content = (
|
|
889
889
|
<span
|
|
890
890
|
style={styleDisplayContents}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
891
|
+
className={isAnimatedReactNativeWeb ? className : undefined}
|
|
892
|
+
{...(events && {
|
|
893
|
+
onMouseEnter: events.onMouseEnter,
|
|
894
|
+
onMouseLeave: events.onMouseLeave,
|
|
895
|
+
onClick: events.onPress,
|
|
896
|
+
onMouseDown: events.onPressIn,
|
|
897
|
+
onMouseUp: events.onPressOut,
|
|
898
|
+
onTouchStart: events.onPressIn,
|
|
899
|
+
onTouchEnd: events.onPressOut,
|
|
900
|
+
})}
|
|
898
901
|
>
|
|
899
902
|
{content}
|
|
900
903
|
</span>
|
|
@@ -928,7 +931,7 @@ export function createComponent<
|
|
|
928
931
|
if (typeof window !== 'undefined') {
|
|
929
932
|
// prettier-ignore
|
|
930
933
|
// eslint-disable-next-line no-console
|
|
931
|
-
console.log({ state, shouldProvideThemeManager, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, defaultNativeStyle, initialSplitStyles, ...(typeof window !== 'undefined' ? { theme, themeClassName: theme.className, staticConfig, tamaguiConfig, events, shouldAvoidClasses, shouldForcePseudo, classNames: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) } : null) })
|
|
934
|
+
console.log({ state, shouldProvideThemeManager, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, defaultNativeStyle, initialSplitStyles, ...(typeof window !== 'undefined' ? { theme, themeClassName: theme.className, staticConfig, tamaguiConfig, events, shouldAvoidClasses, shouldForcePseudo, classNames: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) } : null) })
|
|
932
935
|
}
|
|
933
936
|
// eslint-disable-next-line no-console
|
|
934
937
|
console.groupEnd()
|
package/src/index.ts
CHANGED
|
File without changes
|
package/src/styled.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getConfig } from './config'
|
|
2
2
|
import { createComponent } from './createComponent'
|
|
3
|
+
import { getReactNative } from './setupReactNative'
|
|
3
4
|
import {
|
|
4
5
|
GetProps,
|
|
5
6
|
GetVariantValues,
|
|
@@ -34,6 +35,8 @@ type GetVariantProps<A extends StylableComponent> =
|
|
|
34
35
|
// :
|
|
35
36
|
A extends TamaguiComponent<any, any, any, infer V> ? V : {}
|
|
36
37
|
|
|
38
|
+
let RNComponentConfigs: WeakMap<any, Partial<StaticConfig>> | null = null
|
|
39
|
+
|
|
37
40
|
export function styled<
|
|
38
41
|
ParentComponent extends StylableComponent,
|
|
39
42
|
Variants extends VariantDefinitions<ParentComponent> | void = VariantDefinitions<ParentComponent> | void
|
|
@@ -59,6 +62,21 @@ export function styled<
|
|
|
59
62
|
// }
|
|
60
63
|
// }
|
|
61
64
|
|
|
65
|
+
const RN = getReactNative()
|
|
66
|
+
if (RN && typeof RN === 'object' && !RNComponentConfigs) {
|
|
67
|
+
RNComponentConfigs = new WeakMap()
|
|
68
|
+
for (const key in RN) {
|
|
69
|
+
const val = RN[key]
|
|
70
|
+
if (!val) continue
|
|
71
|
+
if (key[0].toLowerCase() === key[0]) continue
|
|
72
|
+
RNComponentConfigs.set(val, {
|
|
73
|
+
isReactNative: true,
|
|
74
|
+
isText: key === 'Text' || key === 'TextInput',
|
|
75
|
+
inlineProps: key === 'Image' ? new Set(['src', 'width', 'height']) : undefined,
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
const staticConfigProps = (() => {
|
|
63
81
|
const parentStaticConfig =
|
|
64
82
|
'staticConfig' in Component ? (Component.staticConfig as StaticConfig) : null
|
|
@@ -87,13 +105,17 @@ export function styled<
|
|
|
87
105
|
Object.assign(defaultProps, defaultVariants)
|
|
88
106
|
}
|
|
89
107
|
const isReactNative = Boolean(
|
|
90
|
-
|
|
108
|
+
(RNComponentConfigs &&
|
|
109
|
+
(RNComponentConfigs.has(Component) ||
|
|
110
|
+
RNComponentConfigs.has(parentStaticConfig?.Component))) ||
|
|
111
|
+
parentStaticConfig?.isReactNative ||
|
|
112
|
+
staticExtractionOptions?.isReactNative
|
|
91
113
|
)
|
|
92
|
-
const reactNativeWebComponent = isReactNative
|
|
93
|
-
? parentStaticConfig?.reactNativeWebComponent || Component
|
|
94
|
-
: null
|
|
95
114
|
const isTamagui = !isReactNative && !!parentStaticConfig
|
|
96
|
-
|
|
115
|
+
|
|
116
|
+
const Comp = isReactNative ? parentStaticConfig?.Component || Component : (Component as any)
|
|
117
|
+
const nativeConf = (isReactNative && RNComponentConfigs?.get(Comp)) || null
|
|
118
|
+
|
|
97
119
|
const isText = Boolean(staticExtractionOptions?.isText || parentStaticConfig?.isText)
|
|
98
120
|
const acceptsClassName = acceptsClassNameProp ?? (isTamagui || isReactNative)
|
|
99
121
|
|
|
@@ -109,10 +131,9 @@ export function styled<
|
|
|
109
131
|
defaultVariants,
|
|
110
132
|
componentName: name,
|
|
111
133
|
isReactNative,
|
|
112
|
-
// for nesting multiple levels of rnw styled() need keep use the OG component
|
|
113
|
-
reactNativeWebComponent,
|
|
114
134
|
isText,
|
|
115
135
|
acceptsClassName,
|
|
136
|
+
...nativeConf,
|
|
116
137
|
}
|
|
117
138
|
|
|
118
139
|
// TODO compiler doesn't have logic to include children, de-opt (see EnsureFlexed for test usage)
|
package/src/types.tsx
CHANGED
|
@@ -794,11 +794,6 @@ export type StaticConfig = StaticConfigPublic & {
|
|
|
794
794
|
*/
|
|
795
795
|
defaultVariants?: { [key: string]: any }
|
|
796
796
|
|
|
797
|
-
/**
|
|
798
|
-
* Used internally to keep reference to the original rnw component
|
|
799
|
-
*/
|
|
800
|
-
reactNativeWebComponent?: any
|
|
801
|
-
|
|
802
797
|
/**
|
|
803
798
|
* Memoize the component
|
|
804
799
|
*/
|
package/src/views/Text.tsx
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './addTheme';
|
|
|
12
12
|
export * from './updateTheme';
|
|
13
13
|
export * from './styled';
|
|
14
14
|
export * from './types';
|
|
15
|
+
export * from './setupReactNative';
|
|
15
16
|
export type { RNWTextProps, RNWViewProps } from './types-rnw';
|
|
16
17
|
export { getHasConfigured, getConfig, getThemes, getTokens, onConfiguredOnce } from './config';
|
|
17
18
|
export * from './constants/constants';
|
package/types/types.d.ts
CHANGED
|
@@ -468,10 +468,6 @@ export declare type StaticConfig = StaticConfigPublic & {
|
|
|
468
468
|
defaultVariants?: {
|
|
469
469
|
[key: string]: any;
|
|
470
470
|
};
|
|
471
|
-
/**
|
|
472
|
-
* Used internally to keep reference to the original rnw component
|
|
473
|
-
*/
|
|
474
|
-
reactNativeWebComponent?: any;
|
|
475
471
|
/**
|
|
476
472
|
* Memoize the component
|
|
477
473
|
*/
|