| title | Bloom without NativeWind |
|---|---|
| description | The decision and plan that take NativeWind, react-native-css and Tailwind out of Bloom, with the look unchanged. |
Status: shipped in Bloom 23.0.0.
Bloom styles through one mechanism: React Native styles. Bloom has no
className, no NativeWind, no react-native-css and no Tailwind, in its source,
its dependencies, its peers or its docs. Nothing it draws changes.
Why: the Bloom language draws Bloom's real components, so a language app pays
for whatever those components need. react-native-css wraps every View and
Text an app bundles; on the Pixel that wrapper costs about 890 ms of cold
start. Apps drop NativeWind through the className codemod
(bloom-language-classnames.mdx); Bloom has to drop it first.
- About 585
classNameattributes in 57 families, onStyled*primitives (styled()from react-native-css) and on Bloom components, plus 169className-style props (className,contentClassName,labelClassName, …) that forward a consumer's classes. - The theme's native variable plumbing:
VariableContextProviderfrom the optionalnativewindpeer inBloomThemeProvider,BloomColorScope,BloomSeedScope,ThemeScopeBridgeandConcentricProvider; react-native-css'srootVariables(native-root-vars);vars()(useColorScopeStyle);useNativeVariable(concentric class markers); the css-interop dark-mode flag (init-css-interop). - Tailwind configuration:
design-tokens/theme.css(generated bytheme-css.ts, with the concentric@utilitypublishers), the./tailwind-presetand./design-tokens/theme.cssexports, the--color-*aliases every scope writes, Storybook's Tailwind pipeline. - Package entries:
nativewindandreact-native-csspeers,nativewind,react-native-css,tailwindcss,@tailwindcss/vitedev dependencies, thelightningcsspins, the bloom-languagereact-native-csspeer and itsstyled()hover-group hosts.
A component's styles are StyleSheet.create objects of numbers from Bloom's
tokens. Colour comes from useColorTokens() (theme/color-tokens.ts):
- Native: the nearest scope's token record (the provider's, a colour scope's, a
seed scope's, or the one a portal bridge carries), so a colour is exactly the
value the class read. In
mode="adaptive"the record holds the platform's dynamic colours, asuseTheme().colorsdoes: the provider builds both from one palette (Theme, Which reader). - Web: the token's CSS variable (
var(--primary)), which the theme writes on the document and a colour scope on its element, as the classes read it. A theme switch re-renders nothing on the web; the server's first paint is the same.
createTokenStyles((t) => ({ … })) builds a component's styles once per palette
(once on the web) as a StyleSheet, so a style keeps its identity while the
theme does: a theme switch re-renders the leaves that read the tokens, nothing
else. tokenAlpha(t.primary, 0.5) is a /50 opacity modifier.
The rest, by what the class did:
- Responsive variants (
sm:,max-sm:,md:) readuseWindowBreakpoint(). dark:reads the theme's mode;rtl:readsuseIsRtl().active:is a pressable'spressedstate;hover:,focus-visible:andgroup-hover:are the web's: the existingdataSethook and adopted stylesheet (styles/interactive-web-css.ts), orSubtleHover.web:utilities and web-only properties (cursor,userSelect,transition*,outline*) are a web style entry.- A raw DOM element's own
className(bloom-meter-fill, a.web.tsxfork's<button>) is not NativeWind and stays.
Values are taken from what renders today, not from reading Tailwind: the
class resolver runs a class string through Tailwind v4 over Bloom's tokens and
react-native-css's native runtime, and gives the Android style, the colour
token each colour is, and the web CSS. A Bloom component under a class can
override what the class set (a Text's own size wins), so the parity harness is
the authority.
- Native:
scripts/no-nativewind/run.sh <baseline> <out> [family,…]renders each family's cases (scripts/no-nativewind/cases/<family>.cases.tsx) on Android under Bloom's provider, light, dark and adaptive (over the mocked dynamic palette__mocks__/dynamic-palette.ts), in a baseline checkout styled by react-native-css's real runtime over the Tailwind an app compiles, and in this branch, and requires identical committed host trees. - Web:
scripts/no-nativewind/verify-web.mjscompares every story of a family in Chrome between the baseline Storybook (Tailwind, as an app ships it, preflight aside) and this branch's (no Tailwind): every element's computed style and size, light and dark, at rest, hovered and pressed. - Each family's Jest suite stays green; suites that asserted
classNameplumbing are deleted with it.
- Removed props: every
classNameand*ClassNameprop. A consumer passesstyle(or the language's modifiers); the codemod rewrites app call sites. - Removed exports:
useColorScopeStyle,initCssInteropDarkMode. - Kept, for apps still using
className(removed once the fleet has migrated):./tailwind-presetand./design-tokens/theme.css, generated from the same token scales and roles Bloom's styles read, and the scoped--color-*aliases a colour scope writes on the web. They are token outputs for an app's own Tailwind; Bloom has no NativeWind or Tailwind dependency. The concentricrounded-concentricutilities are gone: Bloom's concentric geometry comes fromradiusandstyle. - Added exports (
@oxy.so/bloom/theme):useColorTokens,createTokenStyles,tokenAlpha,ColorToken,ColorTokens,ColorScopeLayerContext,ColorScopeLayer. - Peers removed:
nativewind,react-native-css. - Apps no longer need NativeWind, react-native-css, Tailwind or
@oxy.so/app-preset/base.cssfor Bloom. An app keeps them only for its ownclassName, until the codemod moves it;theme.cssand the preset keep its classes on Bloom's tokens meanwhile. On native, Bloom no longer publishes its tokens to react-native-css, so an app with classes left wraps its tree in app-preset'sBloomNativeWindThemeonce, insideBloomProvider: it publishes the theme's tokens and, through Bloom's genericColorScopeLayerContext, each colour scope's tokens to NativeWind, so classes inside a scope follow it.
@oxy.so/app-preset (oxy) makes NativeWind optional: an app without
nativewind installed gets a Metro config with no NativeWind wrapper and no
react-native-css redirects. The base-font substitution (Inter for a text that
names no family) no longer rides on NativeWind's Text: it redirects
react-native's own Text and TextInput to a host that puts the base face
first, so only raw React Native text needs it; Bloom's and the language's text
already name their family.