@onekeyfe/react-native-skeleton 6.7.0-alpha.475 → 6.8.0-3
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/README.md +61 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# @onekeyfe/react-native-skeleton
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
**Native shimmer placeholders for OneKey's iOS and Android surfaces.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@onekeyfe/react-native-skeleton)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
A Nitro view that renders a shimmering placeholder while content loads. The
|
|
16
|
+
native renderer owns the animation; the application owns the loading state and
|
|
17
|
+
decides when the placeholder is mounted and removed.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Native animation** — the shimmer runs on the native rendering surface, not
|
|
22
|
+
in JavaScript frames.
|
|
23
|
+
- **Per-instance styling** — speed and a two-color gradient are props, so one
|
|
24
|
+
package serves every loading surface.
|
|
25
|
+
- **Pure placeholder** — no load/error events, no data fetching and no global
|
|
26
|
+
state to clean up.
|
|
27
|
+
- **New architecture** — a Nitro view registered through Fabric.
|
|
6
28
|
|
|
7
29
|
## Installation
|
|
8
30
|
|
|
9
31
|
```sh
|
|
10
|
-
yarn add @onekeyfe/react-native-skeleton
|
|
32
|
+
yarn add @onekeyfe/react-native-skeleton
|
|
11
33
|
```
|
|
12
34
|
|
|
13
|
-
|
|
14
|
-
|
|
35
|
+
The package registers a native view, so install the app's iOS pods and rebuild
|
|
36
|
+
the native binary; a JavaScript-only install does not register it. Android links
|
|
37
|
+
through autolinking.
|
|
15
38
|
|
|
16
39
|
## Usage
|
|
17
40
|
|
|
@@ -25,38 +48,45 @@ import { SkeletonView } from '@onekeyfe/react-native-skeleton';
|
|
|
25
48
|
/>;
|
|
26
49
|
```
|
|
27
50
|
|
|
28
|
-
Give the view
|
|
29
|
-
|
|
30
|
-
|
|
51
|
+
Give the view explicit layout dimensions, and reuse the loaded content's
|
|
52
|
+
dimensions if a layout shift would be visible.
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
| Prop | Type | Default | Description |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| `shimmerSpeed` | `number` | `3` | Animation duration in seconds; clamped to at least `0.1`. |
|
|
59
|
+
| `shimmerGradientColors` | `string[]` | native defaults | Two gradient colors; only the first two entries are used. |
|
|
60
|
+
|
|
61
|
+
The component accepts a standard React Native `style` for size, radius and
|
|
62
|
+
placement. Use six-digit hex strings for the gradient so iOS and Android agree.
|
|
63
|
+
See [`src/Skeleton.nitro.ts`](src/Skeleton.nitro.ts) for the native interface and
|
|
64
|
+
[`src/index.tsx`](src/index.tsx) for the exported component.
|
|
31
65
|
|
|
32
|
-
##
|
|
66
|
+
## Platform support
|
|
33
67
|
|
|
34
|
-
|
|
|
35
|
-
| --- |
|
|
36
|
-
| `
|
|
37
|
-
|
|
|
68
|
+
| Capability | iOS | Android | Web |
|
|
69
|
+
| --- | :-: | :-: | :-: |
|
|
70
|
+
| `SkeletonView` | ✅ | ✅ | — |
|
|
71
|
+
| Native shimmer | ✅ | ✅ | — |
|
|
72
|
+
| `shimmerSpeed`, `shimmerGradientColors` | ✅ | ✅ | — |
|
|
38
73
|
|
|
39
|
-
|
|
40
|
-
renderer handles attachment and animation lifecycle; it does not track network
|
|
41
|
-
requests or emit a loading-completion event. Consumers control whether the
|
|
42
|
-
placeholder remains mounted and should verify the resulting layout with their
|
|
43
|
-
actual content.
|
|
74
|
+
## Caveats
|
|
44
75
|
|
|
45
|
-
|
|
46
|
-
|
|
76
|
+
> [!NOTE]
|
|
77
|
+
> The view tracks no loading state and emits no completion event. The
|
|
78
|
+
> application removes the placeholder when its own loading state finishes.
|
|
47
79
|
|
|
48
|
-
|
|
80
|
+
> [!IMPORTANT]
|
|
81
|
+
> `shimmerGradientColors` is a string array, not React Native color objects, and
|
|
82
|
+
> `shimmerSpeed` is a duration in seconds, not frames per second.
|
|
49
83
|
|
|
50
|
-
|
|
51
|
-
`onLoad`, `onError` or network-request prop: the application removes or hides
|
|
52
|
-
the placeholder when its own loading state changes.
|
|
84
|
+
## References
|
|
53
85
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
the consumer needs to avoid a layout shift. Native animation results remain
|
|
58
|
-
separate from the application's data-loading completion.
|
|
86
|
+
- [Public interface](src/Skeleton.nitro.ts)
|
|
87
|
+
- [npm package](https://www.npmjs.com/package/@onekeyfe/react-native-skeleton)
|
|
88
|
+
- [Changelog](../../CHANGELOG.md)
|
|
59
89
|
|
|
60
90
|
## License
|
|
61
91
|
|
|
62
|
-
MIT.
|
|
92
|
+
MIT. See [LICENSE](LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-skeleton",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0-3",
|
|
4
4
|
"description": "Native shimmer loading placeholder for OneKey on iOS and Android",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|