Skip to content

Commit

Permalink
feat: rewrite mapping logic
Browse files Browse the repository at this point in the history
  • Loading branch information
marklawlor committed Jul 27, 2023
1 parent def9dc3 commit 470c0f0
Show file tree
Hide file tree
Showing 14 changed files with 754 additions and 344 deletions.
2 changes: 1 addition & 1 deletion packages/nativewind/src/__tests__/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe("Layout - Overflow", () => {
testCases(
["overflow-auto", invalidValue("overflow", "auto")],
["overflow-clip", invalidValue("overflow", "clip")],
// ["overflow-scroll", invalidValue("overflow", "scroll")],
["overflow-scroll", invalidValue("overflow", "scroll")],
["overflow-x-auto", invalidProperty("overflow-x")],
["overflow-y-auto", invalidProperty("overflow-y")],
["overflow-x-hidden", invalidProperty("overflow-x")],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test("group", async () => {
const B = createMockComponent();

registerCSS(
`.group\\/item .my-class {
`.group\\/item .my-class {
color: red;
}`,
{
Expand All @@ -33,12 +33,12 @@ test("group", async () => {
expect(B).styleToEqual({ color: "rgba(255, 0, 0, 1)" });
});

test("invalid group", async () => {
test.only("invalid group", async () => {
const A = createMockComponent();
const B = createMockComponent();

registerCSS(
`.invalid .my-class {
`.invalid .my-class {
color: red;
}`,
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ afterEach(() => {

const cases: Partial<TestSuites> = {
color: ["red", { color: "rgba(255, 0, 0, 1)" }],
"background-color": ["purple", { backgroundColor: "rgba(128, 0, 128, 1)" }],
// "background-color": ["purple", { backgroundColor: "rgba(128, 0, 128, 1)" }],
};

test.each(Object.entries(cases))("%s", (key, [css, expected]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Style,
} from "../../types";
import { createAnimatedComponent } from "./animated-component";
import { flattenStyle } from "./flatten-style";
import { flattenStyle, flattenStyleProps } from "./flatten-style";
import { animationMap, styleMetaMap } from "./globals";

type AnimationInteropProps = Record<string, unknown> & {
Expand Down Expand Up @@ -249,9 +249,7 @@ function useAnimations(
});

// TODO: Allow for non-style props to be animated
for (let [prop, value] of Object.entries(
flatStyle.get("style") ?? {},
)) {
for (let [prop, value] of Object.entries(flatStyle)) {
if (prop === "transform") {
if (value.length === 0) {
value = defaultTransformEntries;
Expand Down
Loading

0 comments on commit 470c0f0

Please sign in to comment.