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
9 changes: 7 additions & 2 deletions src/__tests__/vendor/tailwind/_tailwind.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type NativewindRenderOptions = RenderOptions & {
theme?: boolean;
/** Whether to include the preflight in the generated CSS @default false */
preflight?: boolean;
/** Whether to include the plugin in the generated CSS. @default true */
/** Whether to include the tailwindcss-safe-area plugin in the generated CSS. @default true */
plugin?: boolean;
/** Enable debug logging. @default false - Set process.env.NATIVEWIND_TEST_AUTO_DEBUG and run tests with the node inspector */
debug?: boolean | "verbose";
Expand All @@ -44,6 +44,7 @@ export async function render(
debug = debugDefault,
theme = true,
preflight = false,
plugin = true,
extraCss,
...options
}: NativewindRenderOptions = {},
Expand All @@ -59,7 +60,11 @@ export async function render(
css += `@import "tailwindcss/preflight.css" layer(base);\n`;
}

css += `@import "tailwindcss/utilities.css" layer(utilities) source(none);\n@import "tailwindcss-safe-area";`;
css += `@import "tailwindcss/utilities.css" layer(utilities) source(none);`;

if (plugin) {
css += `\n@import "tailwindcss-safe-area";`;
}
}

css += sourceInline
Expand Down
12 changes: 11 additions & 1 deletion src/__tests__/vendor/tailwind/safe-area.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ViewProps } from "react-native";
import { SafeAreaProvider } from "react-native-css/components/react-native-safe-area-context";
import { type Metrics } from "react-native-safe-area-context";

import { renderCurrentTest } from "./_tailwind";
import { renderCurrentTest, renderSimple } from "./_tailwind";

const initialMetrics: Metrics = {
insets: {
Expand Down Expand Up @@ -355,3 +355,13 @@ test("pb-safe-or-20", async () => {
},
});
});

test("pt-safe without the plugin", async () => {
expect(
await renderSimple({
className: "pt-safe",
plugin: false,
wrapper: Wrapper,
}),
).toStrictEqual({ props: {} });
});