Skip to content

Commit 17c142f

Browse files
committed
chore: handle typing for newer style properties
1 parent ab5faa5 commit 17c142f

4 files changed

Lines changed: 65 additions & 7 deletions

File tree

packages/css-processor/src/CSSNativeParseRun.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const extraLongViewStyles: Record<ExtraNativeLongViewStyleKeys, 'block'> = {
4040
shadowOffset: 'block',
4141
shadowOpacity: 'block',
4242
shadowRadius: 'block',
43-
testID: 'block',
4443
tintColor: 'block',
4544
transformMatrix: 'block',
4645
translateX: 'block',

packages/css-processor/src/__tests__/CSSProcessor.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,13 @@ describe('CSSProcessor', () => {
216216
it('should pack known extra longhand properties', () => {
217217
expect(
218218
processor.compileStyleDeclaration({
219-
testID: 'test'
219+
tintColor: 'blue'
220220
})
221221
).toMatchObject({
222222
native: {
223223
block: {
224224
retain: {
225-
testID: 'test'
225+
tintColor: 'blue'
226226
}
227227
}
228228
}

packages/css-processor/src/native-types.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
CSSLongNativeTextPropKey,
55
NativeTextStyleKey,
66
CSSShortPropsKey,
7-
CSSLongNativeUntranslatableBlockPropKey
7+
CSSLongNativeUntranslatableBlockPropKey,
8+
CSSUnimplementedNativePropKey
89
} from './property-types';
910

1011
export type ExtendedNativeViewStyleKeys = keyof ViewStyle | keyof ImageStyle;
@@ -35,6 +36,11 @@ export type ExtraNativeShortViewStyleKeys = Extract<
3536
| 'paddingVertical'
3637
>;
3738

39+
export type NativeUnimplementedStyleKeys = Extract<
40+
ExtendedNativeViewStyleKeys,
41+
'borderCurve' | 'experimental_backgroundImage' | 'objectFit'
42+
>;
43+
3844
export type ExtraNativeShortStyle = Pick<
3945
TextStyle & ViewStyle,
4046
ExtraNativeShortViewStyleKeys | NativeShortKeys
@@ -51,8 +57,10 @@ export type ExtraNativeUntranslatedLongStyles = Pick<
5157
export type ExtraNativeLongViewStyleKeys = Exclude<
5258
Exclude<ExtendedNativeViewStyleKeys, CSSShortPropsKey>,
5359
| CSSLongNativeBlockPropKey
60+
| CSSUnimplementedNativePropKey
5461
| NativeDirectionalStyleKeys
5562
| ExtraNativeShortViewStyleKeys
63+
| NativeUnimplementedStyleKeys
5664
>;
5765

5866
/**
@@ -68,7 +76,9 @@ export type NativeShortKeys = Extract<
6876
*/
6977
export type ExtraNativeTextStyleKeys = Exclude<
7078
Exclude<NativeTextStyleKey, CSSShortPropsKey>,
71-
CSSLongNativeTextPropKey
79+
| CSSLongNativeTextPropKey
80+
| CSSUnimplementedNativePropKey
81+
| NativeUnimplementedStyleKeys
7282
>;
7383

7484
export type ExtraNativeTextStyle = Partial<

packages/css-processor/src/property-types.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,61 @@ export type CSSFlowedPropKey = Extract<
7272
| 'wordSpacing'
7373
>;
7474

75+
/**
76+
* CSS properties supported by React Native, but not yet by the processor
77+
*/
78+
export type CSSUnimplementedNativePropKey = Extract<
79+
keyof TextStyle | keyof ViewStyle,
80+
| 'boxSizing'
81+
| 'boxShadow'
82+
| 'marginBlock'
83+
| 'marginBlockEnd'
84+
| 'marginBlockStart'
85+
| 'marginInline'
86+
| 'marginInlineEnd'
87+
| 'marginInlineStart'
88+
| 'paddingBlock'
89+
| 'paddingBlockEnd'
90+
| 'paddingBlockStart'
91+
| 'paddingInline'
92+
| 'paddingInlineEnd'
93+
| 'paddingInlineStart'
94+
| 'gap'
95+
| 'columnGap'
96+
| 'rowGap'
97+
| 'borderBlockColor'
98+
| 'borderBlockEndColor'
99+
| 'borderBlockStartColor'
100+
| 'borderEndEndRadius'
101+
| 'borderEndStartRadius'
102+
| 'borderStartEndRadius'
103+
| 'borderStartStartRadius'
104+
| 'filter'
105+
| 'inset'
106+
| 'insetBlock'
107+
| 'insetBlockEnd'
108+
| 'insetBlockStart'
109+
| 'insetInline'
110+
| 'insetInlineEnd'
111+
| 'insetInlineStart'
112+
| 'isolation'
113+
| 'mixBlendMode'
114+
| 'outlineColor'
115+
| 'outlineOffset'
116+
| 'outlineStyle'
117+
| 'outlineWidth'
118+
| 'pointerEvents'
119+
| 'transformOrigin'
120+
| 'cursor'
121+
| 'verticalAlign'
122+
>;
123+
75124
/**
76125
* Long, Native Text properties
77126
*/
78127
export type CSSLongNativeTextPropKey = Extract<
79128
keyof StandardLonghandProperties,
80-
NativeTextStyleKey
129+
Exclude<NativeTextStyleKey, CSSUnimplementedNativePropKey>
81130
>;
82131

83132
/**
@@ -169,7 +218,7 @@ export type CSSShortNativeTranslatableBlockPropKey = Exclude<
169218
*/
170219
export type CSSLongNativeBlockPropKey = Extract<
171220
keyof StandardLonghandProperties | 'borderStyle',
172-
keyof ViewStyle
221+
Exclude<keyof ViewStyle, CSSUnimplementedNativePropKey>
173222
>;
174223

175224
/**

0 commit comments

Comments
 (0)