@tamagui/web 1.89.6 → 1.89.8
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 +4 -4
- package/dist/cjs/createComponent.js.map +1 -1
- package/dist/cjs/createComponent.native.js +5 -4
- package/dist/cjs/createComponent.native.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +48 -48
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.native.js +37 -34
- package/dist/cjs/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/cjs/hooks/useProps.js +2 -2
- package/dist/cjs/hooks/useProps.js.map +1 -1
- package/dist/cjs/hooks/useProps.native.js +2 -2
- package/dist/cjs/hooks/useProps.native.js.map +1 -1
- package/dist/cjs/internalWithTheme.js +2 -2
- package/dist/cjs/internalWithTheme.js.map +1 -1
- package/dist/cjs/internalWithTheme.native.js +2 -2
- package/dist/cjs/internalWithTheme.native.js.map +1 -1
- package/dist/esm/createComponent.js +4 -4
- package/dist/esm/createComponent.js.map +1 -1
- package/dist/esm/createComponent.mjs +4 -4
- package/dist/esm/createComponent.native.js +5 -4
- package/dist/esm/createComponent.native.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +48 -48
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs +53 -54
- package/dist/esm/helpers/getSplitStyles.native.js +37 -34
- package/dist/esm/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/esm/hooks/useProps.js +2 -2
- package/dist/esm/hooks/useProps.js.map +1 -1
- package/dist/esm/hooks/useProps.mjs +2 -2
- package/dist/esm/hooks/useProps.native.js +2 -2
- package/dist/esm/hooks/useProps.native.js.map +1 -1
- package/dist/esm/internalWithTheme.js +2 -2
- package/dist/esm/internalWithTheme.js.map +1 -1
- package/dist/esm/internalWithTheme.mjs +2 -2
- package/dist/esm/internalWithTheme.native.js +2 -2
- package/dist/esm/internalWithTheme.native.js.map +1 -1
- package/package.json +11 -11
- package/src/createComponent.tsx +4 -3
- package/src/helpers/getSplitStyles.tsx +61 -44
- package/src/hooks/useProps.tsx +2 -2
- package/src/internalWithTheme.tsx +7 -5
- package/src/types.tsx +2 -2
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/internalWithTheme.d.ts +1 -1
- package/types/internalWithTheme.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.89.
|
|
3
|
+
"version": "1.89.8",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.89.
|
|
31
|
-
"@tamagui/constants": "1.89.
|
|
32
|
-
"@tamagui/helpers": "1.89.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.89.
|
|
34
|
-
"@tamagui/timer": "1.89.
|
|
35
|
-
"@tamagui/types": "1.89.
|
|
36
|
-
"@tamagui/use-did-finish-ssr": "1.89.
|
|
37
|
-
"@tamagui/use-event": "1.89.
|
|
38
|
-
"@tamagui/use-force-update": "1.89.
|
|
30
|
+
"@tamagui/compose-refs": "1.89.8",
|
|
31
|
+
"@tamagui/constants": "1.89.8",
|
|
32
|
+
"@tamagui/helpers": "1.89.8",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.89.8",
|
|
34
|
+
"@tamagui/timer": "1.89.8",
|
|
35
|
+
"@tamagui/types": "1.89.8",
|
|
36
|
+
"@tamagui/use-did-finish-ssr": "1.89.8",
|
|
37
|
+
"@tamagui/use-event": "1.89.8",
|
|
38
|
+
"@tamagui/use-force-update": "1.89.8",
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-dom": "^18.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@tamagui/build": "1.89.
|
|
43
|
+
"@tamagui/build": "1.89.8",
|
|
44
44
|
"@testing-library/react": "^14.0.0",
|
|
45
45
|
"csstype": "^3.0.10",
|
|
46
46
|
"typescript": "^5.3.3",
|
package/src/createComponent.tsx
CHANGED
|
@@ -629,6 +629,7 @@ export function createComponent<
|
|
|
629
629
|
|
|
630
630
|
// hide strategy will set this opacity = 0 until measured
|
|
631
631
|
if (props.group && props.untilMeasured === 'hide' && !curState.hasMeasured) {
|
|
632
|
+
splitStyles.style ||= {}
|
|
632
633
|
splitStyles.style.opacity = 0
|
|
633
634
|
}
|
|
634
635
|
|
|
@@ -715,7 +716,7 @@ export function createComponent<
|
|
|
715
716
|
const animations = useAnimations({
|
|
716
717
|
props: propsWithAnimation,
|
|
717
718
|
// if hydrating, send empty style
|
|
718
|
-
style: splitStylesStyle,
|
|
719
|
+
style: splitStylesStyle || {},
|
|
719
720
|
presence,
|
|
720
721
|
componentState: state,
|
|
721
722
|
styleProps,
|
|
@@ -1109,8 +1110,8 @@ export function createComponent<
|
|
|
1109
1110
|
// capture just initial width and height if they exist
|
|
1110
1111
|
// will have top, left, width, height (not x, y)
|
|
1111
1112
|
layout: {
|
|
1112
|
-
width: fromPx(splitStyles.style
|
|
1113
|
-
height: fromPx(splitStyles.style
|
|
1113
|
+
width: fromPx(splitStyles.style?.width as any),
|
|
1114
|
+
height: fromPx(splitStyles.style?.height as any),
|
|
1114
1115
|
} as any,
|
|
1115
1116
|
},
|
|
1116
1117
|
},
|
|
@@ -189,7 +189,6 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
189
189
|
let dynamicThemeAccess: boolean | undefined
|
|
190
190
|
let pseudoGroups: Set<string> | undefined
|
|
191
191
|
let mediaGroups: Set<string> | undefined
|
|
192
|
-
let style: ViewStyleWithPseudos = {}
|
|
193
192
|
let className = (props.className as string) || '' // existing classNames
|
|
194
193
|
let mediaStylesSeen = 0
|
|
195
194
|
|
|
@@ -204,7 +203,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
204
203
|
styleProps,
|
|
205
204
|
componentState,
|
|
206
205
|
staticConfig,
|
|
207
|
-
style,
|
|
206
|
+
style: null,
|
|
208
207
|
theme,
|
|
209
208
|
usedKeys,
|
|
210
209
|
viewProps,
|
|
@@ -295,9 +294,12 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
295
294
|
if (isValidClassName || isMediaOrPseudo) {
|
|
296
295
|
if (shouldDoClasses) {
|
|
297
296
|
mergeClassName(transforms, classNames, keyInit, valInit, isMediaOrPseudo)
|
|
298
|
-
|
|
297
|
+
if (styleState.style) {
|
|
298
|
+
delete styleState.style[keyInit]
|
|
299
|
+
}
|
|
299
300
|
} else {
|
|
300
|
-
style
|
|
301
|
+
styleState.style ||= {}
|
|
302
|
+
styleState.style[keyInit] = reverseMapClassNameToValue(keyInit, valInit)
|
|
301
303
|
delete classNames[keyInit]
|
|
302
304
|
}
|
|
303
305
|
continue
|
|
@@ -374,6 +376,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
374
376
|
|
|
375
377
|
if (!isValidStyleKeyInit) {
|
|
376
378
|
if (keyInit.startsWith('_style') && isObj(valInit)) {
|
|
379
|
+
styleState.style ||= {}
|
|
377
380
|
Object.assign(styleState.style, valInit)
|
|
378
381
|
continue
|
|
379
382
|
}
|
|
@@ -613,7 +616,8 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
613
616
|
valInit !== 'unset' &&
|
|
614
617
|
(valInitType === 'number' || (valInitType === 'string' && valInit[0] !== '$'))
|
|
615
618
|
) {
|
|
616
|
-
style
|
|
619
|
+
styleState.style ||= {}
|
|
620
|
+
styleState.style[keyInit] = valInit
|
|
617
621
|
continue
|
|
618
622
|
}
|
|
619
623
|
|
|
@@ -645,7 +649,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
645
649
|
curProps: { ...styleState.curProps },
|
|
646
650
|
})
|
|
647
651
|
log('expanded', expanded, '\nusedKeys', { ...usedKeys }, '\ncurrent', {
|
|
648
|
-
...style,
|
|
652
|
+
...styleState.style,
|
|
649
653
|
})
|
|
650
654
|
}
|
|
651
655
|
} catch {
|
|
@@ -789,7 +793,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
789
793
|
if (
|
|
790
794
|
defaultValues != null &&
|
|
791
795
|
!(pkey in usedKeys) &&
|
|
792
|
-
!(pkey in styleState.style)
|
|
796
|
+
(!styleState.style || !(pkey in styleState.style))
|
|
793
797
|
) {
|
|
794
798
|
mergeStyle(styleState, pkey, defaultValues)
|
|
795
799
|
}
|
|
@@ -996,8 +1000,9 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
996
1000
|
space = valInit.space
|
|
997
1001
|
continue
|
|
998
1002
|
}
|
|
1003
|
+
styleState.style ||= {}
|
|
999
1004
|
mergeMediaByImportance(
|
|
1000
|
-
style,
|
|
1005
|
+
styleState.style,
|
|
1001
1006
|
mediaKeyShort,
|
|
1002
1007
|
subKey,
|
|
1003
1008
|
mediaStyle[subKey],
|
|
@@ -1040,7 +1045,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1040
1045
|
if (process.env.NODE_ENV === 'development' && debug === 'verbose') {
|
|
1041
1046
|
try {
|
|
1042
1047
|
log(` ✔️ expand complete`, keyInit)
|
|
1043
|
-
log('style', { ...style })
|
|
1048
|
+
log('style', { ...styleState.style })
|
|
1044
1049
|
log('transforms', { ...transforms })
|
|
1045
1050
|
log('viewProps', { ...viewProps })
|
|
1046
1051
|
} catch {
|
|
@@ -1066,6 +1071,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1066
1071
|
if (style['$$css']) {
|
|
1067
1072
|
Object.assign(styleState.classNames, style)
|
|
1068
1073
|
} else {
|
|
1074
|
+
styleState.style ||= {}
|
|
1069
1075
|
Object.assign(styleState.style, style)
|
|
1070
1076
|
}
|
|
1071
1077
|
}
|
|
@@ -1076,12 +1082,14 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1076
1082
|
const avoidNormalize = styleProps.noNormalize === false
|
|
1077
1083
|
|
|
1078
1084
|
if (!avoidNormalize) {
|
|
1079
|
-
|
|
1085
|
+
if (styleState.style) {
|
|
1086
|
+
fixStyles(styleState.style)
|
|
1080
1087
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1088
|
+
// shouldn't this be better? but breaks some tests weirdly, need to check
|
|
1089
|
+
// if (isWeb && !staticConfig.isReactNative) {
|
|
1090
|
+
if (isWeb && !staticConfig.isReactNative) {
|
|
1091
|
+
styleToCSS(styleState.style)
|
|
1092
|
+
}
|
|
1085
1093
|
}
|
|
1086
1094
|
|
|
1087
1095
|
// these are only the flat transforms
|
|
@@ -1097,10 +1105,11 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1097
1105
|
// so basically we sort until we get to a duplicate... we could sort even smarter but
|
|
1098
1106
|
// this should work for most (all?) of our cases since the order preservation really only needs to apply
|
|
1099
1107
|
// to the "flat" transform props
|
|
1108
|
+
styleState.style ||= {}
|
|
1100
1109
|
Object.entries(styleState.transforms)
|
|
1101
1110
|
.sort(([a], [b]) => a.localeCompare(b))
|
|
1102
1111
|
.forEach(([key, val]) => {
|
|
1103
|
-
mergeTransform(style
|
|
1112
|
+
mergeTransform(styleState.style!, key, val, true)
|
|
1104
1113
|
})
|
|
1105
1114
|
}
|
|
1106
1115
|
|
|
@@ -1110,9 +1119,9 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1110
1119
|
!staticConfig.isReactNative &&
|
|
1111
1120
|
!staticConfig.isHOC &&
|
|
1112
1121
|
(styleProps.isAnimated && !conf.animations.supportsCSSVars ? false : true) &&
|
|
1113
|
-
Array.isArray(style
|
|
1122
|
+
Array.isArray(styleState.style?.transform)
|
|
1114
1123
|
) {
|
|
1115
|
-
style.transform = transformsToString(style.transform) as any
|
|
1124
|
+
styleState.style.transform = transformsToString(styleState.style.transform) as any
|
|
1116
1125
|
}
|
|
1117
1126
|
}
|
|
1118
1127
|
|
|
@@ -1122,29 +1131,31 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1122
1131
|
if (shouldDoClasses) {
|
|
1123
1132
|
for (const key in parentSplitStyles.classNames) {
|
|
1124
1133
|
const val = parentSplitStyles.classNames[key]
|
|
1125
|
-
if (key in style || key in classNames)
|
|
1134
|
+
if ((styleState.style && key in styleState.style) || key in classNames)
|
|
1135
|
+
continue
|
|
1126
1136
|
classNames[key] = val
|
|
1127
1137
|
}
|
|
1128
1138
|
}
|
|
1129
1139
|
}
|
|
1130
1140
|
if (!shouldDoClasses) {
|
|
1131
1141
|
for (const key in parentSplitStyles.style) {
|
|
1132
|
-
if (key in classNames || key in style) continue
|
|
1133
|
-
style
|
|
1142
|
+
if (key in classNames || (styleState.style && key in styleState.style)) continue
|
|
1143
|
+
styleState.style ||= {}
|
|
1144
|
+
styleState.style[key] = parentSplitStyles.style[key]
|
|
1134
1145
|
}
|
|
1135
1146
|
}
|
|
1136
1147
|
}
|
|
1137
1148
|
}
|
|
1138
1149
|
|
|
1139
1150
|
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
1140
|
-
if (shouldDoClasses) {
|
|
1151
|
+
if (styleState.style && shouldDoClasses) {
|
|
1141
1152
|
let retainedStyles: ViewStyleWithPseudos | undefined
|
|
1142
1153
|
let shouldRetain = false
|
|
1143
1154
|
|
|
1144
|
-
if (style['$$css']) {
|
|
1155
|
+
if (styleState.style['$$css']) {
|
|
1145
1156
|
// avoid re-processing for rnw
|
|
1146
1157
|
} else {
|
|
1147
|
-
const atomic = getStylesAtomic(style)
|
|
1158
|
+
const atomic = getStylesAtomic(styleState.style)
|
|
1148
1159
|
|
|
1149
1160
|
for (const atomicStyle of atomic) {
|
|
1150
1161
|
const key = atomicStyle.property
|
|
@@ -1162,7 +1173,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1162
1173
|
|
|
1163
1174
|
if (isAnimatedAndAnimateOnly) {
|
|
1164
1175
|
retainedStyles ||= {}
|
|
1165
|
-
retainedStyles[key] = style[key]
|
|
1176
|
+
retainedStyles[key] = styleState.style[key]
|
|
1166
1177
|
} else if (nonAnimatedAnimateOnly) {
|
|
1167
1178
|
retainedStyles ||= {}
|
|
1168
1179
|
retainedStyles[key] = atomicStyle.value
|
|
@@ -1182,12 +1193,12 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1182
1193
|
|
|
1183
1194
|
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
1184
1195
|
console.groupCollapsed(`🔹 getSplitStyles final style object`)
|
|
1185
|
-
console.info(style)
|
|
1196
|
+
console.info(styleState.style)
|
|
1186
1197
|
console.groupEnd()
|
|
1187
1198
|
}
|
|
1188
1199
|
|
|
1189
1200
|
if (shouldRetain || !IS_STATIC) {
|
|
1190
|
-
style = retainedStyles || {}
|
|
1201
|
+
styleState.style = retainedStyles || {}
|
|
1191
1202
|
}
|
|
1192
1203
|
}
|
|
1193
1204
|
|
|
@@ -1265,8 +1276,7 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1265
1276
|
hasMedia,
|
|
1266
1277
|
fontFamily: styleState.fontFamily,
|
|
1267
1278
|
viewProps,
|
|
1268
|
-
|
|
1269
|
-
style,
|
|
1279
|
+
style: styleState.style as any,
|
|
1270
1280
|
pseudos,
|
|
1271
1281
|
classNames,
|
|
1272
1282
|
rulesToInsert,
|
|
@@ -1277,7 +1287,8 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1277
1287
|
|
|
1278
1288
|
// native: swap out the right family based on weight/style
|
|
1279
1289
|
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
1280
|
-
|
|
1290
|
+
const style = styleState.style
|
|
1291
|
+
if (style?.fontFamily) {
|
|
1281
1292
|
const faceInfo = getFont(style.fontFamily as string)?.face
|
|
1282
1293
|
if (faceInfo) {
|
|
1283
1294
|
const overrideFace =
|
|
@@ -1296,21 +1307,23 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1296
1307
|
}
|
|
1297
1308
|
}
|
|
1298
1309
|
|
|
1299
|
-
// merge className and style back into viewProps:
|
|
1300
|
-
let fontFamily =
|
|
1301
|
-
isText || isInput
|
|
1302
|
-
? styleState.fontFamily || staticConfig.defaultProps?.fontFamily
|
|
1303
|
-
: null
|
|
1304
|
-
if (fontFamily && fontFamily[0] === '$') {
|
|
1305
|
-
fontFamily = fontFamily.slice(1)
|
|
1306
|
-
}
|
|
1307
|
-
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : ''
|
|
1308
1310
|
const asChild = props.asChild
|
|
1309
1311
|
const asChildExceptStyleLike =
|
|
1310
1312
|
asChild === 'except-style' || asChild === 'except-style-web'
|
|
1311
1313
|
|
|
1312
1314
|
if (!asChildExceptStyleLike) {
|
|
1315
|
+
const style = styleState.style
|
|
1316
|
+
|
|
1313
1317
|
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
1318
|
+
// merge className and style back into viewProps:
|
|
1319
|
+
let fontFamily =
|
|
1320
|
+
isText || isInput
|
|
1321
|
+
? styleState.fontFamily || staticConfig.defaultProps?.fontFamily
|
|
1322
|
+
: null
|
|
1323
|
+
if (fontFamily && fontFamily[0] === '$') {
|
|
1324
|
+
fontFamily = fontFamily.slice(1)
|
|
1325
|
+
}
|
|
1326
|
+
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : ''
|
|
1314
1327
|
const groupClassName = props.group ? `t_group_${props.group}` : ''
|
|
1315
1328
|
const componentNameFinal = props.componentName || staticConfig.componentName
|
|
1316
1329
|
const componentClassName =
|
|
@@ -1334,7 +1347,9 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1334
1347
|
!conf.animations.supportsCSSVars &&
|
|
1335
1348
|
isReactNative
|
|
1336
1349
|
) {
|
|
1337
|
-
|
|
1350
|
+
if (style) {
|
|
1351
|
+
viewProps.style = style as any
|
|
1352
|
+
}
|
|
1338
1353
|
} else if (isReactNative) {
|
|
1339
1354
|
const cnStyles = { $$css: true }
|
|
1340
1355
|
for (const name of finalClassName.split(' ')) {
|
|
@@ -1345,11 +1360,13 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1345
1360
|
if (finalClassName) {
|
|
1346
1361
|
viewProps.className = finalClassName
|
|
1347
1362
|
}
|
|
1348
|
-
|
|
1363
|
+
if (style) {
|
|
1364
|
+
viewProps.style = style as any
|
|
1365
|
+
}
|
|
1349
1366
|
}
|
|
1350
1367
|
} else {
|
|
1351
1368
|
// this is passed in by useProps() and we want to avoid all .style setting then
|
|
1352
|
-
if (!styleProps.noMergeStyle) {
|
|
1369
|
+
if (style && !styleProps.noMergeStyle) {
|
|
1353
1370
|
// native assign styles
|
|
1354
1371
|
viewProps.style = style as any
|
|
1355
1372
|
}
|
|
@@ -1367,7 +1384,6 @@ export const getSplitStyles: StyleSplitter = (
|
|
|
1367
1384
|
componentState,
|
|
1368
1385
|
transforms,
|
|
1369
1386
|
viewProps,
|
|
1370
|
-
viewPropsOrder: Object.keys(viewProps),
|
|
1371
1387
|
rulesToInsert,
|
|
1372
1388
|
parentSplitStyles,
|
|
1373
1389
|
}
|
|
@@ -1423,7 +1439,7 @@ function mergeStyle(
|
|
|
1423
1439
|
val: any,
|
|
1424
1440
|
disableNormalize = false
|
|
1425
1441
|
) {
|
|
1426
|
-
const { classNames, viewProps,
|
|
1442
|
+
const { classNames, viewProps, usedKeys, styleProps } = styleState
|
|
1427
1443
|
if (isWeb && val?.[0] === '_') {
|
|
1428
1444
|
classNames[key] = val
|
|
1429
1445
|
usedKeys[key] ||= 1
|
|
@@ -1436,7 +1452,8 @@ function mergeStyle(
|
|
|
1436
1452
|
if (key in validStylesOnBaseProps) {
|
|
1437
1453
|
viewProps[key] = out
|
|
1438
1454
|
} else {
|
|
1439
|
-
style
|
|
1455
|
+
styleState.style ||= {}
|
|
1456
|
+
styleState.style[key] = out
|
|
1440
1457
|
}
|
|
1441
1458
|
}
|
|
1442
1459
|
}
|
package/src/hooks/useProps.tsx
CHANGED
|
@@ -61,7 +61,7 @@ export function useStyle<A extends StyleLikeObject>(
|
|
|
61
61
|
props: A,
|
|
62
62
|
opts?: UsePropsOptions
|
|
63
63
|
): PropsWithoutMediaStyles<A> {
|
|
64
|
-
return usePropsAndStyle(props, opts)[1]
|
|
64
|
+
return usePropsAndStyle(props, opts)[1] || {}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -98,5 +98,5 @@ export function usePropsAndStyle<A extends StyleLikeObject>(
|
|
|
98
98
|
null,
|
|
99
99
|
componentContext
|
|
100
100
|
)
|
|
101
|
-
return [splitStyles.viewProps, splitStyles.style, theme, media] as any
|
|
101
|
+
return [splitStyles.viewProps, splitStyles.style || {}, theme, media] as any
|
|
102
102
|
}
|
|
@@ -2,8 +2,10 @@ import { useTheme } from './hooks/useTheme'
|
|
|
2
2
|
|
|
3
3
|
/** internal: this is for tamagui babel plugin usage only */
|
|
4
4
|
|
|
5
|
-
export const internalWithTheme =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const internalWithTheme =
|
|
6
|
+
(Component: any, styleProvider: (theme: any, expressions: any[]) => Object) =>
|
|
7
|
+
(props: any) => {
|
|
8
|
+
const { _expressions = [], ...rest } = props
|
|
9
|
+
const theme = useTheme()
|
|
10
|
+
return <Component style={styleProvider(theme, _expressions)} {...rest} />
|
|
11
|
+
}
|
package/src/types.tsx
CHANGED
|
@@ -1519,7 +1519,7 @@ export type PropMappedValue = [string, any][] | undefined
|
|
|
1519
1519
|
type FlatTransforms = Record<string, any>
|
|
1520
1520
|
|
|
1521
1521
|
export type GetStyleState = {
|
|
1522
|
-
style: TextStyleProps
|
|
1522
|
+
style: TextStyleProps | null
|
|
1523
1523
|
usedKeys: Record<string, number>
|
|
1524
1524
|
classNames: ClassNamesObject
|
|
1525
1525
|
staticConfig: StaticConfig
|
|
@@ -2003,7 +2003,7 @@ export type RulesToInsert = StyleObject[]
|
|
|
2003
2003
|
|
|
2004
2004
|
export type GetStyleResult = {
|
|
2005
2005
|
pseudos?: PseudoStyles | null
|
|
2006
|
-
style: ViewStyle
|
|
2006
|
+
style: ViewStyle | null
|
|
2007
2007
|
classNames: ClassNamesObject
|
|
2008
2008
|
rulesToInsert: RulesToInsert
|
|
2009
2009
|
viewProps: StackProps & Record<string, any>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAYN,MAAM,OAAO,CAAA;AAuBd,OAAO,KAAK,EAEV,SAAS,EAMT,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAElB,YAAY,EAEZ,gBAAgB,EAEhB,cAAc,EAMf,MAAM,SAAS,CAAA;AAiBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA6D3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAYN,MAAM,OAAO,CAAA;AAuBd,OAAO,KAAK,EAEV,SAAS,EAMT,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAElB,YAAY,EAEZ,gBAAgB,EAEhB,cAAc,EAMf,MAAM,SAAS,CAAA;AAiBhB,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA6D3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,E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AAc,EAAE,aA+uC5B,CAAA;AA4DD,eAAO,MAAM,WAAW,eACV,aAAa,UACjB,MAAM,WACL,MAAM,wBACO,OAAO,KAC5B,cA2BF,CAAA;AAQD,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
/** internal: this is for tamagui babel plugin usage only */
|
|
3
|
-
export declare const internalWithTheme: (Component: any, styleProvider: any) => (props: any) => JSX.Element;
|
|
3
|
+
export declare const internalWithTheme: (Component: any, styleProvider: (theme: any, expressions: any[]) => Object) => (props: any) => JSX.Element;
|
|
4
4
|
//# sourceMappingURL=internalWithTheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalWithTheme.d.ts","sourceRoot":"","sources":["../src/internalWithTheme.tsx"],"names":[],"mappings":";AAEA,4DAA4D;AAE5D,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"internalWithTheme.d.ts","sourceRoot":"","sources":["../src/internalWithTheme.tsx"],"names":[],"mappings":";AAEA,4DAA4D;AAE5D,eAAO,MAAM,iBAAiB,cAChB,GAAG,yBAAyB,GAAG,eAAe,GAAG,EAAE,KAAK,MAAM,aAClE,GAAG,gBAIV,CAAA"}
|
package/types/types.d.ts
CHANGED
|
@@ -776,7 +776,7 @@ export type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>>
|
|
|
776
776
|
export type PropMappedValue = [string, any][] | undefined;
|
|
777
777
|
type FlatTransforms = Record<string, any>;
|
|
778
778
|
export type GetStyleState = {
|
|
779
|
-
style: TextStyleProps;
|
|
779
|
+
style: TextStyleProps | null;
|
|
780
780
|
usedKeys: Record<string, number>;
|
|
781
781
|
classNames: ClassNamesObject;
|
|
782
782
|
staticConfig: StaticConfig;
|
|
@@ -1064,7 +1064,7 @@ export type GestureReponderEvent = Exclude<View['props']['onResponderMove'], voi
|
|
|
1064
1064
|
export type RulesToInsert = StyleObject[];
|
|
1065
1065
|
export type GetStyleResult = {
|
|
1066
1066
|
pseudos?: PseudoStyles | null;
|
|
1067
|
-
style: ViewStyle;
|
|
1067
|
+
style: ViewStyle | null;
|
|
1068
1068
|
classNames: ClassNamesObject;
|
|
1069
1069
|
rulesToInsert: RulesToInsert;
|
|
1070
1070
|
viewProps: StackProps & Record<string, any>;
|