Skip to content

Commit 8cbc52d

Browse files
authored
refactor!: remove deprecated targets, native support, and the react-spring umbrella (#2526)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 06a9599 commit 8cbc52d

67 files changed

Lines changed: 193 additions & 1572 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/pre.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@
99
"@react-spring/mock-raf": "10.1.1",
1010
"@react-spring/parallax": "10.1.1",
1111
"@react-spring/rafz": "10.1.1",
12-
"react-spring": "10.0.4",
1312
"@react-spring/shared": "10.1.1",
1413
"@react-spring/types": "10.1.1",
15-
"@react-spring/konva": "10.1.1",
16-
"@react-spring/native": "10.1.1",
1714
"@react-spring/three": "10.1.1",
18-
"@react-spring/web": "10.1.1",
19-
"@react-spring/zdog": "10.1.1"
15+
"@react-spring/web": "10.1.1"
2016
},
2117
"changesets": []
2218
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@react-spring/web': major
3+
---
4+
5+
refactor!: remove deprecated targets and the `react-spring` umbrella
6+
7+
Removes the deprecated `@react-spring/native`, `@react-spring/konva`, and `@react-spring/zdog` targets (along with the React Native hook variants), plus the `react-spring` umbrella package. Install a target directly — `@react-spring/web` or `@react-spring/three`.
8+
9+
For React Native, use [Reanimated](https://docs.swmansion.com/react-native-reanimated/) — its springs run on the UI thread, unlike react-spring's JS-thread engine.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ body:
2929
options:
3030
- label: '`@react-spring/web`'
3131
- label: '`@react-spring/three`'
32-
- label: '`@react-spring/native`'
33-
- label: '`@react-spring/konva`'
34-
- label: '`@react-spring/zdog`'
3532
- type: input
3633
attributes:
3734
label: What version of react-spring are you using?

.specify/memory/constitution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The library is organised in strict bottom-up layers:
5555
- The umbrella package MUST contain only re-exports — no logic.
5656

5757
**Rationale**: This is the load-bearing contract that lets the same animation engine
58-
power web, native, three, konva, and zdog without bifurcating code. Any cross-layer
58+
power web and three without bifurcating code. Any cross-layer
5959
shortcut taken once propagates indefinitely.
6060

6161
### II. Target-Agnostic Core

CLAUDE.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,12 @@ Strict isolation: `node_modules` is non-hoisted, so a workspace can only `import
3939

4040
## Architecture
4141

42-
The library is a layered monorepo. Read packages bottom-up — each layer is target-agnostic until you reach `targets/*`.
42+
The library is a layered monorepo. Read packages bottom-up — each layer is target-agnostic until you reach `targets/*`. There is no umbrella package: consumers install a target directly (`@react-spring/web` or `@react-spring/three`).
4343

4444
```
45-
react-spring (umbrella, re-exports all targets)
46-
47-
┌───────────────┼───────────────┬─────────┬─────────┐
48-
targets/web targets/native targets/three konva zdog
49-
│ │ │
50-
└──────────────┴───────────────┘
45+
targets/web targets/three
46+
│ │
47+
└────────┬────────┘
5148
5249
packages/core ─── declarative API: hooks, components, SpringValue, Controller, SpringRef
5350
@@ -68,9 +65,8 @@ The library is a layered monorepo. Read packages bottom-up — each layer is tar
6865
- `applyAnimatedValues(node, props)` — push the latest values to the platform's native node.
6966
- `createAnimatedStyle(style)` — wrap the `style` prop.
7067
- `getComponentProps(props)` — filter props before forwarding (e.g. web drops `scrollTop`/`scrollLeft`).
71-
- **`@react-spring/core`** — platform-agnostic spring engine. `SpringValue` (single animated value), `Controller` (group of springs), `SpringRef` (imperative handle), `Interpolation`. Public hooks/components live under `src/hooks` and `src/components`. Hooks with native variants ship a `.native.ts` sibling (`useInView.native.ts`, `useResize.native.ts`, `useScroll.native.ts`) that React Native picks up via Metro's platform extensions.
68+
- **`@react-spring/core`** — platform-agnostic spring engine. `SpringValue` (single animated value), `Controller` (group of springs), `SpringRef` (imperative handle), `Interpolation`. Public hooks/components live under `src/hooks` and `src/components`.
7269
- **Targets** — thin adapters. Each `targets/<name>/src/index.ts` follows the same template: `Globals.assign(...)`, define `primitives`, build a host via `createHost(primitives, { applyAnimatedValues, ... })`, then `export const animated = host.animated` and `export * from '@react-spring/core'`. To add an `animated.X` shorthand for a new element, add it to that target's `primitives.ts`.
73-
- **`react-spring`** (umbrella) — depends on every target and only re-exports. Don't add logic here.
7470
- **`@react-spring/parallax`** — extra component layered on `@react-spring/web`. Its `test/` folder is the Vite app the E2E project serves and drives (`tests/e2e/parallax.spec.ts`).
7571

7672
### Where animation values flow

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<br>
1111

1212
<p align="center">
13-
<a href="https://www.npmjs.com/package/react-spring" target="_blank">
14-
<img src="https://img.shields.io/npm/v/react-spring.svg?style=flat&colorA=000000&colorB=000000" />
13+
<a href="https://www.npmjs.com/package/@react-spring/web" target="_blank">
14+
<img src="https://img.shields.io/npm/v/@react-spring/web.svg?style=flat&colorA=000000&colorB=000000" />
1515
</a>
16-
<a href="https://www.npmjs.com/package/react-spring" target="_blank">
17-
<img src="https://img.shields.io/npm/dm/react-spring.svg?style=flat&colorA=000000&colorB=000000" />
16+
<a href="https://www.npmjs.com/package/@react-spring/web" target="_blank">
17+
<img src="https://img.shields.io/npm/dm/@react-spring/web.svg?style=flat&colorA=000000&colorB=000000" />
1818
</a>
1919
<a href="https://discord.gg/AXfNsGx64f" target="_blank">
2020
<img src="https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff" alt="Chat on Discord">
@@ -42,7 +42,7 @@ const styles = useSpring({
4242

4343
Just a small bit about us:
4444

45-
- **Cross-Platform**: We support `react-dom`, `react-native`, `react-three-fiber`, `react-konva` & `react-zdog`.
45+
- **Cross-Platform**: We support `react-dom` and `react-three-fiber`.
4646
- **Versatile**: Be declarative with your animations or if you prefer, imperative.
4747
- **Spring-Physics First**: By default animation use springs for fluid interactivity, but we support durations with easings as well.
4848

@@ -53,10 +53,10 @@ There's a lot more to be had! Give it a try and find out.
5353
### ⚡️ Jump Start
5454

5555
```shell
56-
# Install the entire library
57-
npm install react-spring
58-
# or just install your specific target (recommended)
56+
# Install the target you need
5957
npm install @react-spring/web
58+
# or, for react-three-fiber
59+
npm install @react-spring/three
6060
```
6161

6262
```jsx

docs/app/components/HomeBlocks/HomeBlockTarget.tsx

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ const webHtml = /* html */ `<div data-line="1" class="highlight-line" data-highl
2424
</div><div data-line="14" class="highlight-line" data-highlighted="false"><span class="token punctuation">}</span>
2525
</div>`
2626

27-
const nativeHtml = /* html */ `<div data-line="1" class="highlight-line" data-highlighted="true"><span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> animated<span class="token punctuation">,</span> useSpring <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">'@react-spring/native'</span>
28-
</div><div data-line="2" class="highlight-line" data-highlighted="false">
29-
</div><div data-line="3" class="highlight-line" data-highlighted="false"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function"><span class="token maybe-class-name">MyComponent</span></span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=&gt;</span> <span class="token punctuation">{</span>
30-
</div><div data-line="4" class="highlight-line" data-highlighted="false"> <span class="token keyword">const</span> <span class="token punctuation">{</span> x <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">useSpring</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
31-
</div><div data-line="5" class="highlight-line" data-highlighted="false"> <span class="token keyword module">from</span><span class="token operator">:</span> <span class="token punctuation">{</span>
32-
</div><div data-line="6" class="highlight-line" data-highlighted="false"> x<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
33-
</div><div data-line="7" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">,</span>
34-
</div><div data-line="8" class="highlight-line" data-highlighted="false"> to<span class="token operator">:</span> <span class="token punctuation">{</span>
35-
</div><div data-line="9" class="highlight-line" data-highlighted="false"> x<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
36-
</div><div data-line="10" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">,</span>
37-
</div><div data-line="11" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">)</span>
38-
</div><div data-line="12" class="highlight-line" data-highlighted="false">
39-
</div><div data-line="13" class="highlight-line" data-highlighted="true"> <span class="token keyword control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>animated.View</span> <span class="token attr-name">style</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> x <span class="token punctuation">}</span><span class="token punctuation">}</span></span> <span class="token punctuation">/&gt;</span></span>
40-
</div><div data-line="14" class="highlight-line" data-highlighted="false"><span class="token punctuation">}</span>
41-
</div>`
42-
4327
const threeHtml = /* html */ `<div data-line="1" class="highlight-line" data-highlighted="true"><span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> animated<span class="token punctuation">,</span> useSpring <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">'@react-spring/three'</span>
4428
</div><div data-line="2" class="highlight-line" data-highlighted="false">
4529
</div><div data-line="3" class="highlight-line" data-highlighted="false"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function"><span class="token maybe-class-name">MyComponent</span></span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=&gt;</span> <span class="token punctuation">{</span>
@@ -56,39 +40,7 @@ const threeHtml = /* html */ `<div data-line="1" class="highlight-line" data-hig
5640
</div><div data-line="14" class="highlight-line" data-highlighted="false"><span class="token punctuation">}</span>
5741
</div>`
5842

59-
const konvaHtml = /* html */ `<div data-line="1" class="highlight-line" data-highlighted="true"><span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> animated<span class="token punctuation">,</span> useSpring <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">'@react-spring/konva'</span>
60-
</div><div data-line="2" class="highlight-line" data-highlighted="false">
61-
</div><div data-line="3" class="highlight-line" data-highlighted="false"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function"><span class="token maybe-class-name">MyComponent</span></span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=&gt;</span> <span class="token punctuation">{</span>
62-
</div><div data-line="4" class="highlight-line" data-highlighted="false"> <span class="token keyword">const</span> <span class="token punctuation">{</span> x <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">useSpring</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
63-
</div><div data-line="5" class="highlight-line" data-highlighted="false"> <span class="token keyword module">from</span><span class="token operator">:</span> <span class="token punctuation">{</span>
64-
</div><div data-line="6" class="highlight-line" data-highlighted="false"> x<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
65-
</div><div data-line="7" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">,</span>
66-
</div><div data-line="8" class="highlight-line" data-highlighted="false"> to<span class="token operator">:</span> <span class="token punctuation">{</span>
67-
</div><div data-line="9" class="highlight-line" data-highlighted="false"> x<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
68-
</div><div data-line="10" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">,</span>
69-
</div><div data-line="11" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">)</span>
70-
</div><div data-line="12" class="highlight-line" data-highlighted="false">
71-
</div><div data-line="13" class="highlight-line" data-highlighted="true"> <span class="token keyword control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>animated.Rect</span> <span class="token attr-name">x</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>x<span class="token punctuation">}</span></span> <span class="token punctuation">/&gt;</span></span>
72-
</div><div data-line="14" class="highlight-line" data-highlighted="false"><span class="token punctuation">}</span>
73-
</div>`
74-
75-
const zdogHtml = /* html */ `<div data-line="1" class="highlight-line" data-highlighted="true"><span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> animated<span class="token punctuation">,</span> useSpring <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">'@react-spring/zdog'</span>
76-
</div><div data-line="2" class="highlight-line" data-highlighted="false">
77-
</div><div data-line="3" class="highlight-line" data-highlighted="false"><span class="token keyword module">export</span> <span class="token keyword">const</span> <span class="token function-variable function"><span class="token maybe-class-name">MyComponent</span></span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=&gt;</span> <span class="token punctuation">{</span>
78-
</div><div data-line="4" class="highlight-line" data-highlighted="false"> <span class="token keyword">const</span> <span class="token punctuation">{</span> x <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">useSpring</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
79-
</div><div data-line="5" class="highlight-line" data-highlighted="false"> <span class="token keyword module">from</span><span class="token operator">:</span> <span class="token punctuation">{</span>
80-
</div><div data-line="6" class="highlight-line" data-highlighted="false"> x<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
81-
</div><div data-line="7" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">,</span>
82-
</div><div data-line="8" class="highlight-line" data-highlighted="false"> to<span class="token operator">:</span> <span class="token punctuation">{</span>
83-
</div><div data-line="9" class="highlight-line" data-highlighted="false"> x<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
84-
</div><div data-line="10" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">,</span>
85-
</div><div data-line="11" class="highlight-line" data-highlighted="false"> <span class="token punctuation">}</span><span class="token punctuation">)</span>
86-
</div><div data-line="12" class="highlight-line" data-highlighted="false">
87-
</div><div data-line="13" class="highlight-line" data-highlighted="true"> <span class="token keyword control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>animated.Ellipse</span> <span class="token attr-name">diameter</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>x<span class="token punctuation">}</span></span> <span class="token punctuation">/&gt;</span></span>
88-
</div><div data-line="14" class="highlight-line" data-highlighted="false"><span class="token punctuation">}</span>
89-
</div>`
90-
91-
const dataFixtures = [webHtml, nativeHtml, threeHtml, konvaHtml, zdogHtml]
43+
const dataFixtures = [webHtml, threeHtml]
9244

9345
export const HomeBlockTarget = () => {
9446
const [index, setIndex] = useState(0)
@@ -129,13 +81,10 @@ export const HomeBlockTarget = () => {
12981
href: '/docs/concepts/targets',
13082
}}
13183
>
132-
<p>Choose from our five targets:</p>
84+
<p>Choose from our active targets:</p>
13385
<ul className={list}>
13486
<li>web</li>
135-
<li>native</li>
13687
<li>three</li>
137-
<li>konva</li>
138-
<li>zdog</li>
13988
</ul>
14089
<p>
14190
Missing a target you want? Request we add it or create it yourself

docs/app/routes/docs._index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ v10 introduced the move to React 19 and brought a breaking change to the SpringC
5454

5555
before:
5656
```tsx
57-
import { SpringContext } from 'react-spring'
57+
import { SpringContext } from '@react-spring/web'
5858

5959
...
6060
<SpringContext ...>
@@ -63,7 +63,7 @@ import { SpringContext } from 'react-spring'
6363

6464
now:
6565
```tsx
66-
import { SpringContextProvider } from 'react-spring'
66+
import { SpringContextProvider } from '@react-spring/web'
6767

6868
...
6969
<SpringContextProvider ...>

0 commit comments

Comments
 (0)