diff --git a/README.md b/README.md index a1e5c33..64536d0 100644 --- a/README.md +++ b/README.md @@ -203,11 +203,11 @@ function MyAppsProviders ({ children }) { You don't need to provide these props if you are using Babel or spreading the CLI output. -| Prop | Values | Default | Description | -| -------- | ------------------------------------------------------------------- | ----------- | ----------------------------------------- | -| platform | `web`, `native`, `ios`, `android`, `windows`, `macos`, `web-inline` | Platform.OS | Specifies how the styles are transformed. | -| style | Compiled style object | | | -| media | Compiled media object | | | +| Prop | Values | Default | Description | +| -------- | ----------------------------------------------------- | ----------- | ----------------------------------------- | +| platform | `web`, `native`, `ios`, `android`, `windows`, `macos` | Platform.OS | Specifies how the styles are transformed. | +| style | Compiled style object | | | +| media | Compiled media object | | | ## Component API diff --git a/__tests__/custom-tailwindcss/platform-prefixes.ts b/__tests__/custom-tailwindcss/platform-prefixes.ts index 78713af..b506db8 100644 --- a/__tests__/custom-tailwindcss/platform-prefixes.ts +++ b/__tests__/custom-tailwindcss/platform-prefixes.ts @@ -52,7 +52,7 @@ tailwindRunner("Platform Prefixes", [ "web_w-px.0": { width: 1 }, }, media: { - "web_w-px": ["web-inline"], + "web_w-px": ["web"], }, }, ], diff --git a/src/context.ts b/src/context.ts index 608f336..2f341a8 100644 --- a/src/context.ts +++ b/src/context.ts @@ -31,3 +31,5 @@ export const TailwindSetColorSchemeContext = createContext< export const TailwindPlatformContext = createContext( undefined ); + +export const TailwindPreviewContext = createContext(false); diff --git a/src/plugin/index.ts b/src/plugin/index.ts index 3b328a3..97663e6 100644 --- a/src/plugin/index.ts +++ b/src/plugin/index.ts @@ -10,6 +10,4 @@ export default plugin(function ({ addVariant }) { "native", nativePlatforms.map((platform) => `@media ${platform}`) ); - - addVariant("web", "@media web-inline"); }); diff --git a/src/provider.tsx b/src/provider.tsx index bc9bcc8..295fee8 100644 --- a/src/provider.tsx +++ b/src/provider.tsx @@ -7,6 +7,7 @@ import { TailwindColorSchemeContext, TailwindMediaContext, TailwindPlatformContext, + TailwindPreviewContext, TailwindSetColorSchemeContext, TailwindStyleContext, } from "./context"; @@ -16,6 +17,7 @@ export interface TailwindProviderProps { media?: MediaRecord; colorScheme?: ColorSchemeName; platform?: typeof Platform.OS | "native"; + preview?: boolean; } export function TailwindProvider({ @@ -23,6 +25,7 @@ export function TailwindProvider({ media = globalThis.tailwindcss_react_native_media, colorScheme: overrideColorScheme, platform = Platform.OS, + preview = false, children, }: PropsWithChildren) { const [colorScheme, setColorScheme] = useState( @@ -33,13 +36,15 @@ export function TailwindProvider({ - - - {children} - - + + + + {children} + + + diff --git a/src/shared/platforms.ts b/src/shared/platforms.ts index deaa8e7..34cf119 100644 --- a/src/shared/platforms.ts +++ b/src/shared/platforms.ts @@ -1,6 +1,6 @@ import { Platform } from "react-native"; -export type Platform = typeof Platform.OS | "native" | "web-inline"; +export type Platform = typeof Platform.OS | "native"; export const platforms: Platform[] = [ "android", @@ -9,7 +9,6 @@ export const platforms: Platform[] = [ "native", "windows", "macos", - "web-inline", ]; export const nativePlatforms: Platform[] = [