Skip to content
Open
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
10 changes: 10 additions & 0 deletions src/__tests__/vendor/tailwind/typography.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ describe("Typography - Text Align", () => {
props: { style: { textAlign: "justify" } },
});
});
test("text-start", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: { style: { textAlign: "left" } },
});
});
test("text-end", async () => {
expect(await renderCurrentTest()).toStrictEqual({
props: { style: { textAlign: "right" } },
});
});
});

describe("Typography - Text Color", () => {
Expand Down
10 changes: 10 additions & 0 deletions src/compiler/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,16 @@ export function parseTextAlign(
{ value }: DeclarationType<"text-align">,
builder: StylesheetBuilder,
) {
// React Native has no logical `start`/`end` for textAlign. On <Text> it
// resolves `left`/`right` against the writing direction, so they already
// behave as the logical values and the mapping can happen at compile time.
// <TextInput> treats them as physical: facebook/react-native#45255
if (value === "start") {
return "left";
} else if (value === "end") {
return "right";
}

const allowed = new Set(["auto", "left", "right", "center", "justify"]);
if (allowed.has(value)) {
return value;
Expand Down