Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 73 additions & 71 deletions .pnp.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/css-processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"param-case": "^3.0.4",
"prettier": "^2.8.8",
"react": "18.3.1",
"react-native": "^0.76.1",
"release-config": "workspace:*",
"release-it": "^14.14.3",
"typescript": "~5.6.3"
Expand Down
23 changes: 18 additions & 5 deletions packages/css-processor/src/CSSNativeParseRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,20 @@ const extraLongViewStyles: Record<ExtraNativeLongViewStyleKeys, 'block'> = {
shadowOffset: 'block',
shadowOpacity: 'block',
shadowRadius: 'block',
testID: 'block',
tintColor: 'block',
transformMatrix: 'block',
translateX: 'block',
translateY: 'block'
translateY: 'block',
borderCurve: 'block',
gap: 'block',
inset: 'block',
insetBlock: 'block',
insetInline: 'block',
marginBlock: 'block',
marginInline: 'block',
paddingBlock: 'block',
paddingInline: 'block',
objectFit: 'block'
Copy link
Contributor Author

@jsamr jsamr Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DorianMazur That won't work; this is due to the new react-native version supporting more of these props. But we need to implement the rules for each of these.

I suggest you instead:

  • suppress the error by adding as never after the object literal;
  • open a ticket to report the issue, I'll work on it;
  • add a comment referring to the ticket number, showing this is a momentarily hack.

};

const extraTextStyles: Record<keyof ExtraNativeTextStyle, 'text'> = {
Expand Down Expand Up @@ -76,8 +85,10 @@ export class CSSNativeParseRun extends CSSParseRun {
key: K,
value: any
): void {
const validator = this.validationMap.getValidatorForProperty(key);
if (validator) {
const validator = this.validationMap.getValidatorForProperty(
String(key)
) as any;
if (validator && 'normalizeNativeValue' in validator) {
const normalizedValue = validator.normalizeNativeValue(value);
if (normalizedValue instanceof ShortMergeRequest) {
normalizedValue.forEach(([innerKey, innerValue]) => {
Expand All @@ -103,7 +114,9 @@ export class CSSNativeParseRun extends CSSParseRun {
);
} else {
console.warn(
`Native style property "${key}" is not supported and has been ignored.`
`Native style property "${String(
key
)}" is not supported and has been ignored.`
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/css-processor/src/CSSProcessedProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class CSSProcessedProps
retain: emptyProps,
flow: emptyProps
}
};
} as CSSProcessedProps[T];
}

public withProperty<K extends keyof MixedStyleDeclaration>(
Expand Down
3 changes: 1 addition & 2 deletions packages/css-processor/src/CSSProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ export type MixedStyleDeclaration = Omit<
ExtraNativeTextStyle &
ExtraNativeViewStyle &
ExtraNativeShortStyle &
ExtraNativeUntranslatedLongStyles &
{
ExtraNativeUntranslatedLongStyles & {
[k in MixedSizeCSSPropertiesKeys]?: number | string;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/css-processor/src/__tests__/CSSProcessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function testSpecs(examples: Record<string, Specs>) {
for (const key in examples) {
const spec = examples[key];
const validator = processor.registry.getValidatorForProperty(
key as keyof MixedStyleDeclaration
String(key as keyof MixedStyleDeclaration)
);
spec.inlineIncomingValues.forEach((v, i) => {
const outProp = spec.outProps?.[i];
Expand Down
2 changes: 1 addition & 1 deletion tsconfig-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@tsconfig/react-native",
"compilerOptions": {
"lib": ["ES2017"],
"lib": ["ES2017", "DOM"],
"declaration": true,
"skipLibCheck": true,
"isolatedModules": true,
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4293,6 +4293,7 @@ __metadata:
param-case: "npm:^3.0.4"
prettier: "npm:^2.8.8"
react: "npm:18.3.1"
react-native: "npm:^0.76.1"
release-config: "workspace:*"
release-it: "npm:^14.14.3"
typescript: "npm:~5.6.3"
Expand Down