Skip to content

Commit 61d0f85

Browse files
committed
docs(v7): drop the duplicated Removed-in-v7 list and sweep em-dashes
Each Removed bullet in whats-new.mdx restated the matching section in the migration guide, so the section was pure duplication. Removed it; readers land on Highlights and then the migration guide directly below. Em-dash sweep: kept one in migration.mdx where it punctuates naturally, swapped the rest to colons (in name: description bullets) or semicolons / periods elsewhere.
1 parent c99db0e commit 61d0f85

3 files changed

Lines changed: 14 additions & 24 deletions

File tree

sections/v7/migration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The [CSS Compatibility matrix](/docs/compatibility) is the per-feature source of
7070

7171
- The peer floor moves to RN ≥ 0.85.
7272
- `border: none` now emits `border-style: none` (previously `solid`, which produced surprising hairlines).
73-
- The optional reanimated adapter is opt-in at app entry: `import 'styled-components/native/reanimated'`. `react-native-reanimated@^4` becomes a peer dependency only in that case. The adapter is experimental and not heavily tested yet the default `Animated`-based adapter runs without any setup.
73+
- The optional reanimated adapter is opt-in at app entry: `import 'styled-components/native/reanimated'`. `react-native-reanimated@^4` becomes a peer dependency only in that case. The adapter is experimental and not heavily tested yet; the default `Animated`-based adapter runs without any setup.
7474

7575
[React Native gets modern CSS](#react-native-gets-modern-css) walks through the new surface (modern color spaces, gradients, filters, selectors, animations, `createTheme()`) and calls out the platform-level caveats — iOS SwiftUI filter opt-in, hover feature flag, conic-gradient gap, and the rest. The compatibility matrix has the per-feature breakdown.
7676

sections/v7/native.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Card = styled.View`
1919
`;
2020
```
2121

22-
- **Math functions**: `calc()`, `clamp()`, `min()`, `max()`, plus the full CSS Values 4 Math L4 family `round()`, `mod()`, `rem()`, `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`, `pow`, `sqrt`, `hypot`, `log`, `exp`, `abs`, `sign`. Constants `pi` and `e` resolve in any context.
22+
- **Math functions**: `calc()`, `clamp()`, `min()`, `max()`, plus the full CSS Values 4 Math L4 family (`round()`, `mod()`, `rem()`, `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`, `pow`, `sqrt`, `hypot`, `log`, `exp`, `abs`, `sign`). Constants `pi` and `e` resolve in any context.
2323
- **Modern color spaces**: `oklch(...)`, `oklab(...)`, `lch(...)`, `lab(...)`, `color-mix(in <space>, ...)`. Wide-gamut inputs that fall outside sRGB are gamut-mapped to the closest in-gamut color while preserving hue. Percent channels follow CSS Color L4 ranges (`lab(50% 0 0)` is mid-gray).
2424
- **Relative-color syntax** (CSS Color 5) for the four modern spaces: `oklch(from #ff0000 calc(l - 0.15) c h)`. Theme-token bases work too: `oklch(from ${theme.colors.brand} calc(l - 0.15) c h)`.
2525
- **`color-mix(in <space>, …)`** through `srgb`, `oklab`, `oklch`, `lab`, or `lch`.
@@ -38,7 +38,7 @@ const Card = styled.View`
3838
- **`field-sizing: content`** auto-grows a `<TextInput>` to its content.
3939
- **`interactivity: inert`** suppresses interaction and hides the subtree from screen readers.
4040

41-
**`env(safe-area-inset-*)` caveat.** The function parses correctly but currently resolves to 0 the integration with `react-native-safe-area-context` is not wired yet. Use `useSafeAreaInsets()` directly until that lands.
41+
**`env(safe-area-inset-*)` caveat.** The function parses correctly but currently resolves to 0; the integration with `react-native-safe-area-context` is not wired yet. Use `useSafeAreaInsets()` directly until that lands.
4242

4343
### Selectors on React Native
4444

@@ -62,7 +62,7 @@ const Toggle = styled.Pressable<{ 'aria-pressed'?: boolean }>`
6262

6363
The same CSS works on web and native. Anchor pseudo-states with `&` (bare `:hover` parses as a descendant selector, not a state).
6464

65-
**Pseudo-states.** `&:hover`, `&:focus`, `&:focus-visible`, `&:pressed`, `&:disabled`. Hover on native uses Pressable's pointer events on RN ≥ 0.85, but stock RN gates them behind a feature flag that defaults to FALSE in 0.85 — flip it at app startup to get `&:hover` to fire:
65+
**Pseudo-states.** `&:hover`, `&:focus`, `&:focus-visible`, `&:pressed`, `&:disabled`. Hover on native uses Pressable's pointer events on RN ≥ 0.85, but stock RN gates them behind a feature flag that defaults to FALSE in 0.85. Flip it at app startup to get `&:hover` to fire:
6666

6767
```js
6868
import { ReactNativeFeatureFlags } from 'react-native';
@@ -98,7 +98,7 @@ const Row = styled.View`
9898

9999
**`:is()` and `:where()`.** Apply the rule to each listed state: `&:is(:hover, :focus)`.
100100

101-
**Tree-structural pseudos.** `:first-child`, `:last-child`, `:only-child`, `:first-of-type`, `:last-of-type`, `:only-of-type`, and the functional `:nth-*(<an+b>)` family with `odd` / `even` keywords. Siblings need to be inside a styled-component parent for indexing to work a non-styled wrapper in between resets the count.
101+
**Tree-structural pseudos.** `:first-child`, `:last-child`, `:only-child`, `:first-of-type`, `:last-of-type`, `:only-of-type`, and the functional `:nth-*(<an+b>)` family with `odd` / `even` keywords. Siblings need to be inside a styled-component parent for indexing to work; a non-styled wrapper in between resets the count.
102102

103103
**Combinators between styled-component references.**
104104

@@ -112,7 +112,7 @@ const Title = styled.Text`
112112
`;
113113
```
114114

115-
Descendant matching (`${Foo} &`) is transparent to non-styled wrappers. The child combinator (`>`) requires the matched element to be a direct child of a published parent a non-styled wrapper in between will break the match.
115+
Descendant matching (`${Foo} &`) is transparent to non-styled wrappers. The child combinator (`>`) requires the matched element to be a direct child of a published parent; a non-styled wrapper in between will break the match.
116116

117117
### Animations
118118

@@ -129,7 +129,7 @@ const Card = styled.View`
129129

130130
Eligible properties (opacity, every color, all border radius corners, transforms, shadows, filter) run on the native thread. `@keyframes` and `@starting-style` (first-mount enter animations) work the same way. `animation-direction`, `animation-fill-mode`, `animation-play-state`, `animation-iteration-count`, `animation-composition` (`replace | add | accumulate`), and per-frame easing all work without extra imports.
131131

132-
CSS easing matches the W3C spec curves: `ease`, `ease-in`, `ease-out`, `ease-in-out`, `cubic-bezier()`, `steps()`, `linear()`. Note: the CSS `ease` keyword is the W3C `ease` curve, not React Native's `Easing.ease` (which is `ease-in`). `prefers-reduced-motion` is honored durations collapse to 0 when the OS setting is on.
132+
CSS easing matches the W3C spec curves: `ease`, `ease-in`, `ease-out`, `ease-in-out`, `cubic-bezier()`, `steps()`, `linear()`. Note: the CSS `ease` keyword is the W3C `ease` curve, not React Native's `Easing.ease` (which is `ease-in`). `prefers-reduced-motion` is honored; durations collapse to 0 when the OS setting is on.
133133

134134
If you'd rather drive animations through reanimated, the optional adapter is one import:
135135

@@ -141,7 +141,7 @@ import 'styled-components/native/reanimated';
141141

142142
### Remapping CSS into native props
143143

144-
Many React Native libraries take styling through component props rather than the `style` prop `react-native-svg`'s `<Path fill="..." stroke="..." />`, charting libraries with `tintColor`, icon libraries with `color`. The function form of `.attrs((props, ast) => ...)` accepts a second `ast` argument that lets you read CSS declarations or theme tokens and rewrite them onto the rendered component as props:
144+
Many React Native libraries take styling through component props rather than the `style` prop: `react-native-svg`'s `<Path fill="..." stroke="..." />`, charting libraries with `tintColor`, icon libraries with `color`. The function form of `.attrs((props, ast) => ...)` accepts a second `ast` argument that lets you read CSS declarations or theme tokens and rewrite them onto the rendered component as props:
145145

146146
```tsx
147147
import styled from 'styled-components/native';
@@ -166,7 +166,7 @@ const Logo = styled(Image).attrs((_props, ast) => ({
166166
`;
167167
```
168168

169-
`ast.pop(key)` reads the value and prevents the declaration from reaching the rendered style. `ast.peek(key)` reads without removing use it when both the prop and the CSS declaration should flow through. Both accept an optional fallback.
169+
`ast.pop(key)` reads the value and prevents the declaration from reaching the rendered style. `ast.peek(key)` reads without removing; use it when both the prop and the CSS declaration should flow through. Both accept an optional fallback.
170170

171171
The first argument dispatches on shape: a CSS property name (`'color'`, `'borderColor'`) reads a resolved declaration; a dot-separated path (`'palette.brand.primary'`) reads from the active theme with autocomplete and type inference from your augmented `DefaultTheme`.
172172

@@ -204,11 +204,11 @@ These spec features pass through to react-native-web but do not render on React
204204
- `transform-style: preserve-3d` (basic `rotateX` / `rotateY` / `translateZ` / `perspective` do work)
205205
- CSS Grid (`display: grid`, `grid-template-*`)
206206
- Form-state pseudos (`:invalid`, `:required`, `:read-only`, `:checked`)
207-
- `@supports` is parsed but its condition is never evaluated against the runtime declarations inside always apply on native. Branch with `Platform.OS` instead.
207+
- `@supports` is parsed but its condition is never evaluated against the runtime, so declarations inside always apply on native. Branch with `Platform.OS` instead.
208208
- Scroll-snap, view transitions, scroll-driven animations
209209

210210
Platform-conditional features (the matrix has the full story):
211211

212-
- `filter` only `brightness` and `opacity` apply on iOS without the SwiftUI opt-in (set `ReactNativeReleaseLevel: experimental` in `Info.plist` / `ios.infoPlist`); Android `blur` and `drop-shadow` require API 31+.
213-
- `mix-blend-mode` all 16 non-Normal modes on iOS; Android needs API 29+.
214-
- `transform: skewX/skewY` iOS renders correctly; Android silently drops the shear pending an upstream fix.
212+
- `filter`: only `brightness` and `opacity` apply on iOS without the SwiftUI opt-in (set `ReactNativeReleaseLevel: experimental` in `Info.plist` / `ios.infoPlist`); Android `blur` and `drop-shadow` require API 31+.
213+
- `mix-blend-mode`: all 16 non-Normal modes on iOS; Android needs API 29+.
214+
- `transform: skewX/skewY`: iOS renders correctly; Android silently drops the shear pending an upstream fix.

sections/v7/whats-new.mdx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,14 @@ The bottleneck now is funding. styled-components can help provide a universal Re
2121
- **In-house CSS parser** replaces stylis as the runtime engine. No more `:is()` / `:where()` / `:has()` recursion bugs, no more silent breakage on modern at-rules.
2222
- **Modern CSS on React Native.** `@media` and `@container` queries, viewport and container-query units, font-relative units, modern color spaces, relative-color syntax, the full Math L4 family, logical shorthands, gradients, and filters all work in `styled.View\`...\``. See [React Native gets modern CSS](#react-native-gets-modern-css) for the full surface and the [compatibility matrix](/docs/compatibility) for per-feature status.
2323
- **Selectors and combinators on React Native.** Attribute selectors with every operator, `:not(<simple>)`, `:has(<simple>)`, tree-structural pseudos, the four combinators between styled-component references, and the `:hover` / `:focus` / `:pressed` / `:disabled` pseudo-states.
24-
- **Native animations** by default. `transition`, `@keyframes`, and `@starting-style` run on React Native through the built-in `Animated`-based adapter no setup, no peer dependency. An optional reanimated adapter is available behind one import (experimental; not heavily tested yet).
24+
- **Native animations** by default. `transition`, `@keyframes`, and `@starting-style` run on React Native through the built-in `Animated`-based adapter, with no setup or peer dependency. An optional reanimated adapter is available behind one import (experimental; not heavily tested yet).
2525
- **`createTheme()` on native**, with the same contract as web. `<ThemeProvider>` deep-merges nested themes so an inner override that touches one leaf keeps the siblings it inherited.
2626
- **Plugins subpath.** `import { rtlPlugin, rscPlugin } from 'styled-components/plugins'`. First-party RTL replaces `stylis-plugin-rtl`; custom plugins move to a narrower `SCPlugin` interface. See [Plugins moved to a dedicated subpath](#plugins-moved-to-a-dedicated-subpath).
2727
- **`extractCSS()`** reads the current stylesheet as plain text. Replaces the legacy `disableCSSOMInjection` toggle.
2828
- **Global styles emit once.** Mounting the same `createGlobalStyle` component multiple times now emits its CSS only once.
2929
- **Remapping CSS into native props** via the function form of `.attrs((props, ast) => ...)`. Most useful for React Native libraries that style via props (e.g. `react-native-svg`'s `<Path fill="..." />`, `Image`'s `tintColor`, icon libraries). [Details →](/docs/basics#bridging-styles-into-props)
3030
- **Faster SSR at scale.**
3131
32-
### Removed in v7
33-
34-
The [migration guide](#migrating-from-v6) has the full porting steps. At a glance:
35-
36-
- `defaultProps` on function components — React 19 dropped it. Use `.attrs()` or `<ThemeProvider>`.
37-
- `disableCSSOMInjection` prop and the `SC_DISABLE_SPEEDY` env var — reach for `extractCSS()` instead.
38-
- `enableVendorPrefixes` and the runtime vendor prefixer — declare both forms in CSS or run a build-time PostCSS transform for the few properties that still need them.
39-
- `css-to-react-native` as a peer dependency — folded into core.
40-
- Top-level `stylisPluginRSC` export — now `rscPlugin` from `styled-components/plugins`.
41-
4232
### Peer dependency floors
4333
4434
- `react` and `react-dom` ≥ 19.0.0

0 commit comments

Comments
 (0)