Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/compiler/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ export function parseUnparsed(
case "comma":
return CommaSeparator as unknown as StyleDescriptor;
case "delim": {
if (property === "aspect-ratio" && tokenOrValue.value.value === "/") {
if (tokenOrValue.value.value === "/") {
return tokenOrValue.value.value;
}
return;
Expand Down
14 changes: 14 additions & 0 deletions src/runtime/native/__tests__/variables.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,17 @@ test("useUnsafeVariable", () => {

expect(component.props.style).toStrictEqual({ color: "red" });
});

test("ratio values", () => {
registerCSS(`
:root { --my-var: 16 / 9; }
.test { aspect-ratio: var(--my-var); }
`);

// Since we can't directly test the hook in isolation with the render approach,
// we'll test that a component using the variable gets the correct value
render(<View testID={testID} className="test" />);
const component = screen.getByTestId(testID);

expect(component.props.style).toStrictEqual({ aspectRatio: "16 / 9" });
});
1 change: 1 addition & 0 deletions src/runtime/native/styles/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export function resolveValue(
}
return arg;
})
.filter((value) => value !== "/")
.join(", ");

if (name === "radial-gradient") {
Expand Down
Loading