@onlynative/inertia-gradients 0.0.1-alpha.5 → 0.0.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/llms.txt +95 -0
- package/package.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@onlynative/inertia-gradients` are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Pre-`1.0`, breaking changes may land in minor versions and are called out under their release.
|
|
4
|
+
|
|
5
|
+
This package ships in lockstep with `@onlynative/inertia` — version numbers track the core release that introduced or last touched the adapter.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.0.1-alpha.6] — 2026-05-22
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `MotionLinearGradient` over `expo-linear-gradient`. Accepts the same `initial` / `animate` / `transition` shape as the core `Motion.*` primitives, with animatable keys for `colors`, `start`, `end`, and `locations`.
|
|
14
|
+
|
|
15
|
+
[unreleased]: https://github.com/onlynative/inertia/compare/v0.0.1-alpha.6...HEAD
|
|
16
|
+
[0.0.1-alpha.6]: https://github.com/onlynative/inertia/releases/tag/v0.0.1-alpha.6
|
package/llms.txt
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
> @onlynative/inertia-gradients — adapter package for @onlynative/inertia.
|
|
2
|
+
> This file is generated from the matching docs page by scripts/build-llms.mjs — do not edit by hand.
|
|
3
|
+
|
|
4
|
+
> Full docs: https://onlynative.github.io/inertia/
|
|
5
|
+
> Core overview: see @onlynative/inertia/llms.txt (or docs/static/llms.txt in the repo)
|
|
6
|
+
> Source: https://github.com/onlynative/inertia
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
# Gradients
|
|
10
|
+
|
|
11
|
+
`@onlynative/inertia-gradients` adds an animatable linear gradient built on `expo-linear-gradient`. It is an **optional** sibling package — install it only when you need to animate gradient stops. The core library has no required `expo-linear-gradient` dependency.
|
|
12
|
+
|
|
13
|
+
`MotionLinearGradient` accepts the same `initial` / `animate` / `transition` shape as the core `Motion.*` primitives, with animatable keys for `colors`, `start`, `end`, and `locations`.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add @onlynative/inertia-gradients expo-linear-gradient
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`expo-linear-gradient` works in bare React Native projects as well as Expo — no `expo-modules-core` runtime is required.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { MotionLinearGradient } from '@onlynative/inertia-gradients'
|
|
27
|
+
|
|
28
|
+
function Hero() {
|
|
29
|
+
return (
|
|
30
|
+
<MotionLinearGradient
|
|
31
|
+
colors={['#0f172a', '#1e293b']}
|
|
32
|
+
animate={{ colors: ['#7c3aed', '#0ea5e9'] }}
|
|
33
|
+
transition={{ type: 'timing', duration: 600 }}
|
|
34
|
+
style={StyleSheet.absoluteFill}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The static `colors` prop is required — it sets the visual on first render and **locks the slot count** for the lifetime of the component. To resize the gradient (e.g. swap a 2-stop for a 3-stop), remount via `key={...}`. The component throws in dev if `colors.length` changes between renders.
|
|
41
|
+
|
|
42
|
+
## Animatable props
|
|
43
|
+
|
|
44
|
+
| Key | Shape | Notes |
|
|
45
|
+
| ----------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
46
|
+
| `colors` | `readonly string[]` | Element-wise color interpolation via Reanimated's color setter. Length must match the static `colors` prop. |
|
|
47
|
+
| `start` | `{ x: number, y: number }` | Normalized `[0, 1]` coordinates. `x` and `y` animate independently — useful for rotating gradient direction. |
|
|
48
|
+
| `end` | `{ x: number, y: number }` | Same shape as `start`. |
|
|
49
|
+
| `locations` | `readonly number[]` | Optional stop positions. If supplied at mount, must remain supplied and same-length as `colors` for the component's lifetime. |
|
|
50
|
+
|
|
51
|
+
Per-property transitions work just like the core primitives:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<MotionLinearGradient
|
|
55
|
+
colors={['#000', '#000']}
|
|
56
|
+
animate={{
|
|
57
|
+
colors: ['#7c3aed', '#0ea5e9'],
|
|
58
|
+
start: { x: 0, y: 0 },
|
|
59
|
+
end: { x: 1, y: 1 },
|
|
60
|
+
}}
|
|
61
|
+
transition={{
|
|
62
|
+
colors: { type: 'timing', duration: 600 },
|
|
63
|
+
start: { type: 'spring', tension: 80, friction: 14 },
|
|
64
|
+
end: { type: 'spring', tension: 80, friction: 14 },
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## `initial`
|
|
70
|
+
|
|
71
|
+
Pass `initial` to override the mount-frame values (so the component starts somewhere other than the static props), or `initial={false}` to start at the `animate` target with no mount animation.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<MotionLinearGradient
|
|
75
|
+
colors={['#111', '#222']}
|
|
76
|
+
initial={{ colors: ['#000', '#000'] }} // fade up from black
|
|
77
|
+
animate={{ colors: ['#7c3aed', '#0ea5e9'] }}
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
<MotionLinearGradient
|
|
81
|
+
colors={['#111', '#222']}
|
|
82
|
+
initial={false} // skip the mount animation
|
|
83
|
+
animate={{ colors: ['#7c3aed', '#0ea5e9'] }}
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Reduced motion
|
|
88
|
+
|
|
89
|
+
`MotionLinearGradient` participates in [`<MotionConfig reducedMotion>`](./motion-config.md) the same way the core primitives do — when the OS reduce-motion setting is on (or you pass `reducedMotion="always"`), transitions resolve as direct assignment instead of `withSpring` / `withTiming`.
|
|
90
|
+
|
|
91
|
+
## What this primitive doesn't do (v0.2)
|
|
92
|
+
|
|
93
|
+
- **Radial / conic gradients** — linear-only for v0.2. Radial lands in v0.3 once the linear API is validated.
|
|
94
|
+
- **Slot-count resize** — the colors array length is locked at mount. To change it, remount via `key={...}`.
|
|
95
|
+
- **Per-stop sequence keyframes** — `animate.colors` accepts a single target array, not a nested array of arrays. For chained gradient transitions, drive the target through state and let React re-render.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlynative/inertia-gradients",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.7",
|
|
4
4
|
"description": "Animated linear gradient primitive for @onlynative/inertia, built on expo-linear-gradient.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "OnlyNative",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|
|
43
43
|
"src",
|
|
44
|
+
"llms.txt",
|
|
44
45
|
"README.md",
|
|
45
46
|
"LICENSE",
|
|
46
47
|
"CHANGELOG.md",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"!**/*.test.*"
|
|
49
50
|
],
|
|
50
51
|
"peerDependencies": {
|
|
51
|
-
"@onlynative/inertia": ">=0.0.1-alpha.
|
|
52
|
+
"@onlynative/inertia": ">=0.0.1-alpha.7",
|
|
52
53
|
"expo-linear-gradient": ">=14.0.0",
|
|
53
54
|
"react": ">=19.0.0",
|
|
54
55
|
"react-native": ">=0.81.0",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"size-limit": "^11.1.0",
|
|
70
71
|
"tsup": "^8.3.5",
|
|
71
72
|
"typescript": "^5.7.3",
|
|
72
|
-
"@onlynative/inertia": "0.0.1-alpha.
|
|
73
|
+
"@onlynative/inertia": "0.0.1-alpha.7"
|
|
73
74
|
},
|
|
74
75
|
"publishConfig": {
|
|
75
76
|
"access": "public"
|