diff --git a/src/compiler/stylesheet.ts b/src/compiler/stylesheet.ts index bd3f2d2a..5785836d 100644 --- a/src/compiler/stylesheet.ts +++ b/src/compiler/stylesheet.ts @@ -614,7 +614,7 @@ function postProcessStyleFunction(value: StyleDescriptor): [ let [shouldDelay, usesVariables] = postProcessStyleFunction(value[2]); usesVariables ||= value[1] === "var"; - shouldDelay ||= value[3] === 1; + shouldDelay ||= value[3] === 1 || usesVariables; if (shouldDelay) { return [true, usesVariables]; diff --git a/src/runtime/native/__tests__/colors.test.tsx b/src/runtime/native/__tests__/colors.test.tsx index 5c58ad12..384379b0 100644 --- a/src/runtime/native/__tests__/colors.test.tsx +++ b/src/runtime/native/__tests__/colors.test.tsx @@ -135,3 +135,33 @@ describe("hsla", () => { }); }); }); + +describe("currentcolor", () => { + test("currentcolor and global variables", () => { + registerCSS(` + @layer theme { + :root { + --color-red-500: red; + } + } + @layer utilities { + .bg-current { + background-color: currentcolor; + } + .text-red-500 { + color: var(--color-red-500); + } + } + `); + + render(); + const component = screen.getByTestId(testID); + + expect(component.type).toBe("View"); + expect(component.props).toStrictEqual({ + children: undefined, + style: { color: "red", backgroundColor: "red" }, + testID, + }); + }); +});