react-native-skelo 0.0.1 → 0.0.2

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.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -20
  3. package/lib/commonjs/Skelo.js +104 -0
  4. package/lib/commonjs/Skelo.js.map +1 -0
  5. package/lib/commonjs/animations/AnimationWrapper.js +76 -0
  6. package/lib/commonjs/animations/AnimationWrapper.js.map +1 -0
  7. package/lib/commonjs/animations/PulseAnimation.js +76 -0
  8. package/lib/commonjs/animations/PulseAnimation.js.map +1 -0
  9. package/lib/commonjs/animations/ShimmerAnimation.js +103 -0
  10. package/lib/commonjs/animations/ShimmerAnimation.js.map +1 -0
  11. package/lib/commonjs/animations/index.js +27 -0
  12. package/lib/commonjs/animations/index.js.map +1 -0
  13. package/lib/commonjs/components/MeasuredBlock.js +64 -0
  14. package/lib/commonjs/components/MeasuredBlock.js.map +1 -0
  15. package/lib/commonjs/components/Skeleton.js +144 -0
  16. package/lib/commonjs/components/Skeleton.js.map +1 -0
  17. package/lib/commonjs/components/SkeletonIgnore.js +30 -0
  18. package/lib/commonjs/components/SkeletonIgnore.js.map +1 -0
  19. package/lib/commonjs/components/SkeletonRenderer.js +270 -0
  20. package/lib/commonjs/components/SkeletonRenderer.js.map +1 -0
  21. package/lib/commonjs/components/primitives/SkeletonBox.js +47 -0
  22. package/lib/commonjs/components/primitives/SkeletonBox.js.map +1 -0
  23. package/lib/commonjs/components/primitives/SkeletonCircle.js +44 -0
  24. package/lib/commonjs/components/primitives/SkeletonCircle.js.map +1 -0
  25. package/lib/commonjs/components/primitives/SkeletonImage.js +46 -0
  26. package/lib/commonjs/components/primitives/SkeletonImage.js.map +1 -0
  27. package/lib/commonjs/components/primitives/SkeletonText.js +60 -0
  28. package/lib/commonjs/components/primitives/SkeletonText.js.map +1 -0
  29. package/lib/commonjs/components/primitives/index.js +34 -0
  30. package/lib/commonjs/components/primitives/index.js.map +1 -0
  31. package/lib/commonjs/components/withSkeleton.js +45 -0
  32. package/lib/commonjs/components/withSkeleton.js.map +1 -0
  33. package/lib/commonjs/constants/defaults.js +43 -0
  34. package/lib/commonjs/constants/defaults.js.map +1 -0
  35. package/lib/commonjs/core/deepRegistry.js +18 -0
  36. package/lib/commonjs/core/deepRegistry.js.map +1 -0
  37. package/lib/commonjs/core/generator/StyleSkeleton.js +101 -0
  38. package/lib/commonjs/core/generator/StyleSkeleton.js.map +1 -0
  39. package/lib/commonjs/core/parser/Parser.js +84 -0
  40. package/lib/commonjs/core/parser/Parser.js.map +1 -0
  41. package/lib/commonjs/core/parser/expandOffline.js +83 -0
  42. package/lib/commonjs/core/parser/expandOffline.js.map +1 -0
  43. package/lib/commonjs/core/parser/hostTreeReconciler.js +228 -0
  44. package/lib/commonjs/core/parser/hostTreeReconciler.js.map +1 -0
  45. package/lib/commonjs/core/parser/index.js +13 -0
  46. package/lib/commonjs/core/parser/index.js.map +1 -0
  47. package/lib/commonjs/core/registry/SkeletonRegistry.js +113 -0
  48. package/lib/commonjs/core/registry/SkeletonRegistry.js.map +1 -0
  49. package/lib/commonjs/core/registry/index.js +19 -0
  50. package/lib/commonjs/core/registry/index.js.map +1 -0
  51. package/lib/commonjs/core/resolver/StyleResolver.js +83 -0
  52. package/lib/commonjs/core/resolver/StyleResolver.js.map +1 -0
  53. package/lib/commonjs/core/resolver/index.js +13 -0
  54. package/lib/commonjs/core/resolver/index.js.map +1 -0
  55. package/lib/commonjs/deep.js +18 -0
  56. package/lib/commonjs/deep.js.map +1 -0
  57. package/lib/commonjs/index.js +66 -0
  58. package/lib/commonjs/index.js.map +1 -0
  59. package/lib/commonjs/plugins/ImagePlugin.js +60 -0
  60. package/lib/commonjs/plugins/ImagePlugin.js.map +1 -0
  61. package/lib/commonjs/plugins/TextPlugin.js +70 -0
  62. package/lib/commonjs/plugins/TextPlugin.js.map +1 -0
  63. package/lib/commonjs/plugins/ViewPlugin.js +71 -0
  64. package/lib/commonjs/plugins/ViewPlugin.js.map +1 -0
  65. package/lib/commonjs/plugins/index.js +27 -0
  66. package/lib/commonjs/plugins/index.js.map +1 -0
  67. package/lib/commonjs/types/index.js +2 -0
  68. package/lib/commonjs/types/index.js.map +1 -0
  69. package/lib/commonjs/types/plugin.js +6 -0
  70. package/lib/commonjs/types/plugin.js.map +1 -0
  71. package/lib/commonjs/types/skeleton.js +6 -0
  72. package/lib/commonjs/types/skeleton.js.map +1 -0
  73. package/lib/commonjs/utils/componentUtils.js +138 -0
  74. package/lib/commonjs/utils/componentUtils.js.map +1 -0
  75. package/lib/commonjs/utils/index.js +62 -0
  76. package/lib/commonjs/utils/index.js.map +1 -0
  77. package/lib/commonjs/utils/styleUtils.js +76 -0
  78. package/lib/commonjs/utils/styleUtils.js.map +1 -0
  79. package/lib/module/Skelo.js +98 -0
  80. package/lib/module/Skelo.js.map +1 -0
  81. package/lib/module/animations/AnimationWrapper.js +69 -0
  82. package/lib/module/animations/AnimationWrapper.js.map +1 -0
  83. package/lib/module/animations/PulseAnimation.js +69 -0
  84. package/lib/module/animations/PulseAnimation.js.map +1 -0
  85. package/lib/module/animations/ShimmerAnimation.js +96 -0
  86. package/lib/module/animations/ShimmerAnimation.js.map +1 -0
  87. package/lib/module/animations/index.js +4 -0
  88. package/lib/module/animations/index.js.map +1 -0
  89. package/lib/module/components/MeasuredBlock.js +57 -0
  90. package/lib/module/components/MeasuredBlock.js.map +1 -0
  91. package/lib/module/components/Skeleton.js +138 -0
  92. package/lib/module/components/Skeleton.js.map +1 -0
  93. package/lib/module/components/SkeletonIgnore.js +23 -0
  94. package/lib/module/components/SkeletonIgnore.js.map +1 -0
  95. package/lib/module/components/SkeletonRenderer.js +264 -0
  96. package/lib/module/components/SkeletonRenderer.js.map +1 -0
  97. package/lib/module/components/primitives/SkeletonBox.js +40 -0
  98. package/lib/module/components/primitives/SkeletonBox.js.map +1 -0
  99. package/lib/module/components/primitives/SkeletonCircle.js +37 -0
  100. package/lib/module/components/primitives/SkeletonCircle.js.map +1 -0
  101. package/lib/module/components/primitives/SkeletonImage.js +39 -0
  102. package/lib/module/components/primitives/SkeletonImage.js.map +1 -0
  103. package/lib/module/components/primitives/SkeletonText.js +53 -0
  104. package/lib/module/components/primitives/SkeletonText.js.map +1 -0
  105. package/lib/module/components/primitives/index.js +5 -0
  106. package/lib/module/components/primitives/index.js.map +1 -0
  107. package/lib/module/components/withSkeleton.js +38 -0
  108. package/lib/module/components/withSkeleton.js.map +1 -0
  109. package/lib/module/constants/defaults.js +37 -0
  110. package/lib/module/constants/defaults.js.map +1 -0
  111. package/lib/module/core/deepRegistry.js +11 -0
  112. package/lib/module/core/deepRegistry.js.map +1 -0
  113. package/lib/module/core/generator/StyleSkeleton.js +95 -0
  114. package/lib/module/core/generator/StyleSkeleton.js.map +1 -0
  115. package/lib/module/core/parser/Parser.js +77 -0
  116. package/lib/module/core/parser/Parser.js.map +1 -0
  117. package/lib/module/core/parser/expandOffline.js +77 -0
  118. package/lib/module/core/parser/expandOffline.js.map +1 -0
  119. package/lib/module/core/parser/hostTreeReconciler.js +222 -0
  120. package/lib/module/core/parser/hostTreeReconciler.js.map +1 -0
  121. package/lib/module/core/parser/index.js +2 -0
  122. package/lib/module/core/parser/index.js.map +1 -0
  123. package/lib/module/core/registry/SkeletonRegistry.js +106 -0
  124. package/lib/module/core/registry/SkeletonRegistry.js.map +1 -0
  125. package/lib/module/core/registry/index.js +2 -0
  126. package/lib/module/core/registry/index.js.map +1 -0
  127. package/lib/module/core/resolver/StyleResolver.js +77 -0
  128. package/lib/module/core/resolver/StyleResolver.js.map +1 -0
  129. package/lib/module/core/resolver/index.js +2 -0
  130. package/lib/module/core/resolver/index.js.map +1 -0
  131. package/lib/module/deep.js +11 -0
  132. package/lib/module/deep.js.map +1 -0
  133. package/lib/module/index.js +21 -0
  134. package/lib/module/index.js.map +1 -0
  135. package/lib/module/plugins/ImagePlugin.js +53 -0
  136. package/lib/module/plugins/ImagePlugin.js.map +1 -0
  137. package/lib/module/plugins/TextPlugin.js +63 -0
  138. package/lib/module/plugins/TextPlugin.js.map +1 -0
  139. package/lib/module/plugins/ViewPlugin.js +64 -0
  140. package/lib/module/plugins/ViewPlugin.js.map +1 -0
  141. package/lib/module/plugins/index.js +4 -0
  142. package/lib/module/plugins/index.js.map +1 -0
  143. package/lib/module/types/index.js +2 -0
  144. package/lib/module/types/index.js.map +1 -0
  145. package/lib/module/types/plugin.js +2 -0
  146. package/lib/module/types/plugin.js.map +1 -0
  147. package/lib/module/types/skeleton.js +2 -0
  148. package/lib/module/types/skeleton.js.map +1 -0
  149. package/lib/module/utils/componentUtils.js +123 -0
  150. package/lib/module/utils/componentUtils.js.map +1 -0
  151. package/lib/module/utils/index.js +3 -0
  152. package/lib/module/utils/index.js.map +1 -0
  153. package/lib/module/utils/styleUtils.js +66 -0
  154. package/lib/module/utils/styleUtils.js.map +1 -0
  155. package/lib/typescript/Skelo.d.ts +76 -0
  156. package/lib/typescript/Skelo.d.ts.map +1 -0
  157. package/lib/typescript/animations/AnimationWrapper.d.ts +66 -0
  158. package/lib/typescript/animations/AnimationWrapper.d.ts.map +1 -0
  159. package/lib/typescript/animations/PulseAnimation.d.ts +59 -0
  160. package/lib/typescript/animations/PulseAnimation.d.ts.map +1 -0
  161. package/lib/typescript/animations/ShimmerAnimation.d.ts +59 -0
  162. package/lib/typescript/animations/ShimmerAnimation.d.ts.map +1 -0
  163. package/lib/typescript/animations/index.d.ts +5 -0
  164. package/lib/typescript/animations/index.d.ts.map +1 -0
  165. package/lib/typescript/components/MeasuredBlock.d.ts +32 -0
  166. package/lib/typescript/components/MeasuredBlock.d.ts.map +1 -0
  167. package/lib/typescript/components/Skeleton.d.ts +37 -0
  168. package/lib/typescript/components/Skeleton.d.ts.map +1 -0
  169. package/lib/typescript/components/SkeletonIgnore.d.ts +26 -0
  170. package/lib/typescript/components/SkeletonIgnore.d.ts.map +1 -0
  171. package/lib/typescript/components/SkeletonRenderer.d.ts +39 -0
  172. package/lib/typescript/components/SkeletonRenderer.d.ts.map +1 -0
  173. package/lib/typescript/components/primitives/SkeletonBox.d.ts +21 -0
  174. package/lib/typescript/components/primitives/SkeletonBox.d.ts.map +1 -0
  175. package/lib/typescript/components/primitives/SkeletonCircle.d.ts +21 -0
  176. package/lib/typescript/components/primitives/SkeletonCircle.d.ts.map +1 -0
  177. package/lib/typescript/components/primitives/SkeletonImage.d.ts +21 -0
  178. package/lib/typescript/components/primitives/SkeletonImage.d.ts.map +1 -0
  179. package/lib/typescript/components/primitives/SkeletonText.d.ts +21 -0
  180. package/lib/typescript/components/primitives/SkeletonText.d.ts.map +1 -0
  181. package/lib/typescript/components/primitives/index.d.ts +5 -0
  182. package/lib/typescript/components/primitives/index.d.ts.map +1 -0
  183. package/lib/typescript/components/withSkeleton.d.ts +37 -0
  184. package/lib/typescript/components/withSkeleton.d.ts.map +1 -0
  185. package/lib/typescript/constants/defaults.d.ts +29 -0
  186. package/lib/typescript/constants/defaults.d.ts.map +1 -0
  187. package/lib/typescript/core/deepRegistry.d.ts +7 -0
  188. package/lib/typescript/core/deepRegistry.d.ts.map +1 -0
  189. package/lib/typescript/core/generator/StyleSkeleton.d.ts +36 -0
  190. package/lib/typescript/core/generator/StyleSkeleton.d.ts.map +1 -0
  191. package/lib/typescript/core/parser/Parser.d.ts +30 -0
  192. package/lib/typescript/core/parser/Parser.d.ts.map +1 -0
  193. package/lib/typescript/core/parser/expandOffline.d.ts +10 -0
  194. package/lib/typescript/core/parser/expandOffline.d.ts.map +1 -0
  195. package/lib/typescript/core/parser/hostTreeReconciler.d.ts +28 -0
  196. package/lib/typescript/core/parser/hostTreeReconciler.d.ts.map +1 -0
  197. package/lib/typescript/core/parser/index.d.ts +2 -0
  198. package/lib/typescript/core/parser/index.d.ts.map +1 -0
  199. package/lib/typescript/core/registry/SkeletonRegistry.d.ts +57 -0
  200. package/lib/typescript/core/registry/SkeletonRegistry.d.ts.map +1 -0
  201. package/lib/typescript/core/registry/index.d.ts +2 -0
  202. package/lib/typescript/core/registry/index.d.ts.map +1 -0
  203. package/lib/typescript/core/resolver/StyleResolver.d.ts +54 -0
  204. package/lib/typescript/core/resolver/StyleResolver.d.ts.map +1 -0
  205. package/lib/typescript/core/resolver/index.d.ts +2 -0
  206. package/lib/typescript/core/resolver/index.d.ts.map +1 -0
  207. package/lib/typescript/deep.d.ts +2 -0
  208. package/lib/typescript/deep.d.ts.map +1 -0
  209. package/lib/typescript/index.d.ts +17 -0
  210. package/lib/typescript/index.d.ts.map +1 -0
  211. package/lib/typescript/plugins/ImagePlugin.d.ts +11 -0
  212. package/lib/typescript/plugins/ImagePlugin.d.ts.map +1 -0
  213. package/lib/typescript/plugins/TextPlugin.d.ts +12 -0
  214. package/lib/typescript/plugins/TextPlugin.d.ts.map +1 -0
  215. package/lib/typescript/plugins/ViewPlugin.d.ts +11 -0
  216. package/lib/typescript/plugins/ViewPlugin.d.ts.map +1 -0
  217. package/lib/typescript/plugins/index.d.ts +4 -0
  218. package/lib/typescript/plugins/index.d.ts.map +1 -0
  219. package/lib/typescript/types/index.d.ts +3 -0
  220. package/lib/typescript/types/index.d.ts.map +1 -0
  221. package/lib/typescript/types/plugin.d.ts +144 -0
  222. package/lib/typescript/types/plugin.d.ts.map +1 -0
  223. package/lib/typescript/types/skeleton.d.ts +176 -0
  224. package/lib/typescript/types/skeleton.d.ts.map +1 -0
  225. package/lib/typescript/utils/componentUtils.d.ts +40 -0
  226. package/lib/typescript/utils/componentUtils.d.ts.map +1 -0
  227. package/lib/typescript/utils/index.d.ts +3 -0
  228. package/lib/typescript/utils/index.d.ts.map +1 -0
  229. package/lib/typescript/utils/styleUtils.d.ts +41 -0
  230. package/lib/typescript/utils/styleUtils.d.ts.map +1 -0
  231. package/package.json +171 -11
  232. package/src/Skelo.ts +103 -0
  233. package/src/animations/AnimationWrapper.tsx +139 -0
  234. package/src/animations/PulseAnimation.tsx +138 -0
  235. package/src/animations/ShimmerAnimation.tsx +169 -0
  236. package/src/animations/index.ts +4 -0
  237. package/src/components/MeasuredBlock.tsx +85 -0
  238. package/src/components/Skeleton.tsx +149 -0
  239. package/src/components/SkeletonIgnore.tsx +27 -0
  240. package/src/components/SkeletonRenderer.tsx +341 -0
  241. package/src/components/primitives/SkeletonBox.tsx +53 -0
  242. package/src/components/primitives/SkeletonCircle.tsx +48 -0
  243. package/src/components/primitives/SkeletonImage.tsx +50 -0
  244. package/src/components/primitives/SkeletonText.tsx +69 -0
  245. package/src/components/primitives/index.ts +4 -0
  246. package/src/components/withSkeleton.tsx +62 -0
  247. package/src/constants/defaults.ts +38 -0
  248. package/src/core/deepRegistry.ts +16 -0
  249. package/src/core/generator/StyleSkeleton.tsx +138 -0
  250. package/src/core/parser/Parser.ts +86 -0
  251. package/src/core/parser/expandOffline.tsx +83 -0
  252. package/src/core/parser/hostTreeReconciler.tsx +271 -0
  253. package/src/core/parser/index.ts +1 -0
  254. package/src/core/registry/SkeletonRegistry.ts +111 -0
  255. package/src/core/registry/index.ts +1 -0
  256. package/src/core/resolver/StyleResolver.ts +80 -0
  257. package/src/core/resolver/index.ts +1 -0
  258. package/src/deep.ts +12 -0
  259. package/src/index.ts +30 -0
  260. package/src/plugins/ImagePlugin.tsx +65 -0
  261. package/src/plugins/TextPlugin.tsx +71 -0
  262. package/src/plugins/ViewPlugin.tsx +67 -0
  263. package/src/plugins/index.ts +3 -0
  264. package/src/types/index.ts +14 -0
  265. package/src/types/plugin.ts +164 -0
  266. package/src/types/skeleton.ts +197 -0
  267. package/src/utils/componentUtils.ts +166 -0
  268. package/src/utils/index.ts +9 -0
  269. package/src/utils/styleUtils.ts +72 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shubhanshu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,41 +2,168 @@
2
2
 
3
3
  # react-native-skelo
4
4
 
5
- ### 🚧 Coming soon
5
+ **Write your UI once. Skelo builds the loading state automatically.**
6
6
 
7
- **Automatic skeleton loading for React Native.**
8
- Write your UI once — Skelo builds the loading state automatically.
7
+ [![npm](https://img.shields.io/npm/v/react-native-skelo)](https://www.npmjs.com/package/react-native-skelo)
8
+ [![license](https://img.shields.io/npm/l/react-native-skelo)](./LICENSE)
9
9
 
10
10
  </div>
11
11
 
12
- ---
12
+ > ⚠️ **Pre-release (`0.0.x`).** Early and evolving — the API may change. The first **stable** release will be **`0.1.0`**. The `deep` engine is experimental — see [caveats](#deep-mode-caveats-experimental).
13
+
14
+ Skeleton loading screens usually mean building — and maintaining — a second copy of your UI. Skelo derives the skeleton from the UI you already wrote.
13
15
 
14
16
  ```tsx
15
- // Instead of hand-building skeleton screens:
16
- <Skeleton loading={loading}>
17
+ import { Skeleton } from 'react-native-skelo';
18
+
19
+ <Skeleton loading={isLoading}>
20
+ <View style={styles.card}>
21
+ <Image style={styles.avatar} />
22
+ <Text style={styles.name}>{user.name}</Text>
23
+ </View>
24
+ </Skeleton>
25
+ ```
26
+
27
+ While `loading`, Skelo reads the tree and its styles and renders a matching skeleton (circle avatar, text bar). When `loading` is `false`, it renders your real content.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ npm install react-native-skelo
33
+ npm install react-native-reanimated react-native-linear-gradient
34
+ ```
35
+
36
+ That's all you need for the basic (inline) and `styles` usage.
37
+
38
+ ### To enable `deep` mode (optional)
39
+
40
+ `deep` mode is opt-in so the core library never bundles a reconciler you don't
41
+ use. Install `react-reconciler` (matching your React version) and import the
42
+ deep entry **once** in your app's entry file:
43
+
44
+ ```bash
45
+ # React 19:
46
+ npm install react-reconciler@0.31.0
47
+ # React 18:
48
+ npm install react-reconciler@0.29.2
49
+ ```
50
+
51
+ ```js
52
+ // index.js (app entry)
53
+ import 'react-native-skelo/deep';
54
+ ```
55
+
56
+ Without this, `<Skeleton deep>` simply falls back to static parsing (no crash).
57
+
58
+ ## Usage
59
+
60
+ ### Basic — inline host elements
61
+
62
+ Skelo traverses the `View` / `Text` / `Image` tree you pass and mirrors it:
63
+
64
+ ```tsx
65
+ <Skeleton loading={loading} animation="shimmer">
66
+ <View style={styles.row}>
67
+ <Image style={styles.avatar} /> {/* → circle / box */}
68
+ <Text style={styles.title}>Title</Text> {/* → text bar */}
69
+ </View>
70
+ </Skeleton>
71
+ ```
72
+
73
+ Structure comes from the JSX; dimensions come from each element's `style`.
74
+
75
+ ### `deep` — wrap any component (experimental)
76
+
77
+ Don't want to inline? Wrap an opaque component and let Skelo introspect it:
78
+
79
+ ```tsx
80
+ import { Skeleton, withSkeleton } from 'react-native-skelo';
81
+
82
+ <Skeleton loading={loading} deep>
17
83
  <ProfileScreen />
18
84
  </Skeleton>
19
85
 
20
- // Skelo generates the skeleton loading state for you.
86
+ // or as an HOC:
87
+ const Home = withSkeleton(HomeScreen);
88
+ <Home loading={loading} {...props} />
89
+ ```
90
+
91
+ Requires `react-reconciler` + `import 'react-native-skelo/deep'` (see [Installation](#to-enable-deep-mode-optional)). See also [caveats](#deep-mode-caveats-experimental).
92
+
93
+ ### `styles` — generate from a StyleSheet
94
+
95
+ Pass styles directly to get a stack of skeleton shapes (no children needed):
96
+
97
+ ```tsx
98
+ <Skeleton loading={loading} styles={styles} excludeStyles={['container']} />
99
+ ```
100
+
101
+ A StyleSheet has no hierarchy, so this produces one shape per style that has visual dimensions.
102
+
103
+ ### `Skeleton.Ignore` — keep something visible
104
+
105
+ ```tsx
106
+ <Skeleton loading={loading}>
107
+ <Skeleton.Ignore>
108
+ <Text style={styles.heading}>Profile</Text> {/* stays real */}
109
+ </Skeleton.Ignore>
110
+ <ProfileBody />
111
+ </Skeleton>
112
+ ```
113
+
114
+ ### Custom components — register a plugin
115
+
116
+ ```tsx
117
+ import { Skelo } from 'react-native-skelo';
118
+ import { Avatar } from 'my-design-system';
119
+
120
+ Skelo.register({
121
+ name: 'Avatar',
122
+ component: Avatar,
123
+ strategy: (props, { primitives }) => (
124
+ <primitives.Circle size={props.size ?? 40} />
125
+ ),
126
+ });
21
127
  ```
22
128
 
23
- ## Status
129
+ ## API
130
+
131
+ ### `<Skeleton>` props
132
+
133
+ | Prop | Type | Default | Description |
134
+ |---|---|---|---|
135
+ | `loading` | `boolean` | — | Show skeleton (`true`) or real content (`false`) |
136
+ | `animation` | `'shimmer' \| 'pulse' \| 'none'` | `'shimmer'` | Animation style |
137
+ | `duration` | `number` | `1200` | Animation duration (ms) |
138
+ | `baseColor` / `highlightColor` | `string` | theme | Skeleton colors |
139
+ | `borderRadius` | `number` | `4` | Default corner radius |
140
+ | `deep` | `boolean` | `false` | Expand opaque components (experimental) |
141
+ | `styles` | `StyleSheet \| style[]` | — | Generate from styles instead of children |
142
+ | `excludeStyles` | `string[]` | — | Style keys to skip in `styles` mode |
143
+ | `accessibilityLabel` | `string` | `'Loading content'` | Screen-reader label |
144
+
145
+ Also exported: `withSkeleton`, `SkeletonIgnore`, `StyleSkeleton`, the primitives (`SkeletonBox`, `SkeletonText`, `SkeletonImage`, `SkeletonCircle`), and `Skelo` (plugin registry + `Skelo.fromStyles`).
146
+
147
+ ## How it works
148
+
149
+ - **Inline mode** — static traversal of the host-element tree (`React.Children` + `StyleSheet.flatten`).
150
+ - **`deep` mode** — a JS-only `react-reconciler` renderer renders the component off-screen to recover its real host tree + styles, then feeds the same skeleton renderer.
151
+ - Anything Skelo can't introspect (a custom component without `deep`, or native content) is measured and shown as a single size-matched block.
24
152
 
25
- This package name is reserved. The first public release is on its way.
153
+ ## `deep` mode caveats (experimental)
26
154
 
27
- - **Star / watch the repo** to get notified: https://github.com/shubhanshubb/react-native-skelo
28
- - 🐛 Issues & ideas: https://github.com/shubhanshubb/react-native-skelo/issues
155
+ `deep` renders your component offline to read its structure, which means:
29
156
 
30
- > **Not installable yet.** Installing this version gives you a placeholder only.
31
- > The real library ships as `v0.1.0`.
157
+ - **Mount effects run** during introspection a screen that fetches on mount may fetch twice. Prefer `deep` for presentational trees; register a plugin or provide a manual skeleton for effectful screens.
158
+ - **Renders outside your providers** components that require navigation/theme/redux context may fail to expand; Skelo catches this and falls back to a measured block.
159
+ - Only the **React host tree** is visible. `WebView`, `MapView`, `Video`, etc. render their content natively (outside React), so they can only become a single sized block.
32
160
 
33
- ## Planned for v0.1.0
161
+ ## Requirements
34
162
 
35
- - Automatic skeleton generation for standard components (View, Text, Image)
36
- - Shimmer & pulse animations powered by Reanimated 3
37
- - Zero-config out of the box, extensible via a plugin system
38
- - Full TypeScript support
163
+ - React Native (Fabric / New Architecture recommended)
164
+ - `react-native-reanimated` 3
165
+ - `react-reconciler` (optional, for `deep`) must match your React version
39
166
 
40
- ---
167
+ ## License
41
168
 
42
- Made by [Shubhanshu Barnwal](https://shubhanshubb.dev) · MIT License
169
+ MIT © [Shubhanshu Barnwal](https://shubhanshubb.dev)
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Skelo = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _registry = require("./core/registry");
9
+ var _StyleSkeleton = require("./core/generator/StyleSkeleton");
10
+ var _defaults = require("./constants/defaults");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * Global Skelo API for plugin management
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * import { Skelo } from 'react-native-skelo';
18
+ * import { Avatar } from 'my-ui-library';
19
+ *
20
+ * Skelo.register({
21
+ * name: 'Avatar',
22
+ * component: Avatar,
23
+ * strategy: (props, { primitives }) => {
24
+ * return <primitives.Circle size={props.size || 40} />;
25
+ * },
26
+ * });
27
+ * ```
28
+ */
29
+ const Skelo = exports.Skelo = {
30
+ /**
31
+ * Register a plugin
32
+ *
33
+ * @param plugin - Plugin configuration
34
+ */
35
+ register(plugin) {
36
+ _registry.registry.register(plugin);
37
+ },
38
+ /**
39
+ * Unregister a plugin
40
+ *
41
+ * @param component - Component type to unregister
42
+ */
43
+ unregister(component) {
44
+ _registry.registry.unregister(component);
45
+ },
46
+ /**
47
+ * Get plugin for component
48
+ *
49
+ * @param component - Component type
50
+ * @returns Plugin or undefined
51
+ */
52
+ getPlugin(component) {
53
+ return _registry.registry.getPlugin(component);
54
+ },
55
+ /**
56
+ * Check if plugin exists
57
+ *
58
+ * @param component - Component type
59
+ * @returns True if plugin is registered
60
+ */
61
+ hasPlugin(component) {
62
+ return _registry.registry.hasPlugin(component);
63
+ },
64
+ /**
65
+ * Get all plugins
66
+ *
67
+ * @returns Array of all registered plugins
68
+ */
69
+ getAllPlugins() {
70
+ return _registry.registry.getAllPlugins();
71
+ },
72
+ /**
73
+ * Clear all plugins (useful for testing)
74
+ */
75
+ clearPlugins() {
76
+ _registry.registry.clear();
77
+ },
78
+ /**
79
+ * Generate a skeleton element directly from a set of styles.
80
+ *
81
+ * @param styles - A `StyleSheet.create` object or an array of styles
82
+ * @param config - Optional animation/color overrides
83
+ * @returns A skeleton React element
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * {loading ? Skelo.fromStyles(styles) : <Screen />}
88
+ * ```
89
+ */
90
+ fromStyles(styles, config = {}) {
91
+ return /*#__PURE__*/_react.default.createElement(_StyleSkeleton.StyleSkeleton, {
92
+ styles,
93
+ config: {
94
+ ..._defaults.DEFAULT_CONFIG,
95
+ ...config
96
+ }
97
+ });
98
+ },
99
+ /**
100
+ * Library version
101
+ */
102
+ version: '0.1.0'
103
+ };
104
+ //# sourceMappingURL=Skelo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_registry","_StyleSkeleton","_defaults","e","__esModule","default","Skelo","exports","register","plugin","registry","unregister","component","getPlugin","hasPlugin","getAllPlugins","clearPlugins","clear","fromStyles","styles","config","React","createElement","StyleSkeleton","DEFAULT_CONFIG","version"],"sourceRoot":"../../src","sources":["Skelo.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAAsD,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG;EACnB;AACF;AACA;AACA;AACA;EACEE,QAAQA,CAAUC,MAAyB,EAAQ;IACjDC,kBAAQ,CAACF,QAAQ,CAACC,MAAM,CAAC;EAC3B,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,UAAUA,CAACC,SAAwB,EAAQ;IACzCF,kBAAQ,CAACC,UAAU,CAACC,SAAS,CAAC;EAChC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,SAASA,CAACD,SAAwB,EAA8B;IAC9D,OAAOF,kBAAQ,CAACG,SAAS,CAACD,SAAS,CAAC;EACtC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEE,SAASA,CAACF,SAAwB,EAAW;IAC3C,OAAOF,kBAAQ,CAACI,SAAS,CAACF,SAAS,CAAC;EACtC,CAAC;EAED;AACF;AACA;AACA;AACA;EACEG,aAAaA,CAAA,EAAqB;IAChC,OAAOL,kBAAQ,CAACK,aAAa,CAAC,CAAC;EACjC,CAAC;EAED;AACF;AACA;EACEC,YAAYA,CAAA,EAAS;IACnBN,kBAAQ,CAACO,KAAK,CAAC,CAAC;EAClB,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,UAAUA,CAACC,MAAkB,EAAEC,MAA+B,GAAG,CAAC,CAAC,EAAgB;IACjF,oBAAOC,cAAK,CAACC,aAAa,CAACC,4BAAa,EAAE;MACxCJ,MAAM;MACNC,MAAM,EAAE;QAAE,GAAGI,wBAAc;QAAE,GAAGJ;MAAO;IACzC,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;EACEK,OAAO,EAAE;AACX,CAAC","ignoreList":[]}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AnimationWrapper = AnimationWrapper;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _ShimmerAnimation = require("./ShimmerAnimation");
10
+ var _PulseAnimation = require("./PulseAnimation");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * Animation wrapper that selects the appropriate animation type
14
+ *
15
+ * Provides a unified interface for all skeleton animations:
16
+ * - shimmer: Left-to-right shimmer effect
17
+ * - pulse: Breathing/pulsing opacity
18
+ * - none: Static skeleton (no animation)
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <AnimationWrapper
23
+ * animation="shimmer"
24
+ * width={200}
25
+ * height={20}
26
+ * />
27
+ * ```
28
+ */
29
+ function AnimationWrapper({
30
+ animation = 'shimmer',
31
+ width,
32
+ height,
33
+ baseColor = '#E1E9EE',
34
+ highlightColor = '#F2F8FC',
35
+ duration,
36
+ borderRadius = 4,
37
+ style,
38
+ children
39
+ }) {
40
+ // No animation - static skeleton
41
+ if (animation === 'none') {
42
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
43
+ style: [{
44
+ width,
45
+ height,
46
+ borderRadius,
47
+ backgroundColor: baseColor
48
+ }, style]
49
+ }, children);
50
+ }
51
+
52
+ // Shimmer animation
53
+ if (animation === 'shimmer') {
54
+ return /*#__PURE__*/_react.default.createElement(_ShimmerAnimation.ShimmerAnimation, {
55
+ width: width,
56
+ height: height,
57
+ baseColor: baseColor,
58
+ highlightColor: highlightColor,
59
+ duration: duration ?? 1500,
60
+ borderRadius: borderRadius,
61
+ style: style
62
+ }, children);
63
+ }
64
+
65
+ // Pulse animation
66
+ return /*#__PURE__*/_react.default.createElement(_PulseAnimation.PulseAnimation, {
67
+ width: width,
68
+ height: height,
69
+ baseColor: baseColor,
70
+ highlightColor: highlightColor,
71
+ duration: duration ?? 1000,
72
+ borderRadius: borderRadius,
73
+ style: style
74
+ }, children);
75
+ }
76
+ //# sourceMappingURL=AnimationWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_ShimmerAnimation","_PulseAnimation","e","__esModule","default","AnimationWrapper","animation","width","height","baseColor","highlightColor","duration","borderRadius","style","children","createElement","View","backgroundColor","ShimmerAnimation","PulseAnimation"],"sourceRoot":"../../../src","sources":["animations/AnimationWrapper.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAAkD,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,K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0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PulseAnimation = PulseAnimation;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ /**
12
+ * Pulse animation component using Reanimated 3
13
+ *
14
+ * Creates a subtle breathing/pulsing effect using:
15
+ * - Shared values for performance
16
+ * - Worklets for 60 FPS on UI thread
17
+ * - Opacity animation for pulse effect
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <PulseAnimation
22
+ * width={200}
23
+ * height={20}
24
+ * borderRadius={4}
25
+ * />
26
+ * ```
27
+ */
28
+ function PulseAnimation({
29
+ width,
30
+ height,
31
+ baseColor = '#E1E9EE',
32
+ duration = 1000,
33
+ borderRadius = 4,
34
+ style,
35
+ children
36
+ }) {
37
+ // Shared value for opacity (0 to 1)
38
+ const opacity = (0, _reactNativeReanimated.useSharedValue)(1);
39
+ (0, _react.useEffect)(() => {
40
+ // Start infinite pulse animation
41
+ // Sequence: fade out -> fade in
42
+ opacity.value = (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withSequence)((0, _reactNativeReanimated.withTiming)(0.5, {
43
+ duration: duration / 2,
44
+ easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease)
45
+ }), (0, _reactNativeReanimated.withTiming)(1, {
46
+ duration: duration / 2,
47
+ easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease)
48
+ })), -1,
49
+ // Infinite repeat
50
+ false // Don't reverse
51
+ );
52
+ }, [duration, opacity]);
53
+
54
+ // Animated style for pulse effect
55
+ const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
56
+ 'worklet';
57
+
58
+ return {
59
+ opacity: opacity.value
60
+ };
61
+ }, []);
62
+ return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
63
+ style: [styles.container, {
64
+ width,
65
+ height,
66
+ borderRadius,
67
+ backgroundColor: baseColor
68
+ }, animatedStyle, style]
69
+ }, children);
70
+ }
71
+ const styles = _reactNative.StyleSheet.create({
72
+ container: {
73
+ overflow: 'hidden'
74
+ }
75
+ });
76
+ //# sourceMappingURL=PulseAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PulseAnimation","width","height","baseColor","duration","borderRadius","style","children","opacity","useSharedValue","useEffect","value","withRepeat","withSequence","withTiming","easing","Easing","inOut","ease","animatedStyle","useAnimatedStyle","createElement","View","styles","container","backgroundColor","StyleSheet","create","overflow"],"sourceRoot":"../../../src","sources":["animations/PulseAnimation.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAOiC,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA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EA,QAAQ,GAAG,CAAC;MACtBW,MAAM,EAAEC,6BAAM,CAACC,KAAK,CAACD,6BAAM,CAACE,IAAI;IAClC,CAAC,CAAC,EACF,IAAAJ,iCAAU,EAAC,CAAC,EAAE;MACZV,QAAQ,EAAEA,QAAQ,GAAG,CAAC;MACtBW,MAAM,EAAEC,6BAAM,CAACC,KAAK,CAACD,6BAAM,CAACE,IAAI;IAClC,CAAC,CACH,CAAC,EACD,CAAC,CAAC;IAAE;IACJ,KAAK,CAAC;IACR,CAAC;EACH,CAAC,EAAE,CAACd,QAAQ,EAAEI,OAAO,CAAC,CAAC;;EAEvB;EACA,MAAMW,aAAa,GAAG,IAAAC,uCAAgB,EAAC,MAAM;IAC3C,SAAS;;IAET,OAAO;MACLZ,OAAO,EAAEA,OAAO,CAACG;IACnB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEnC,MAAA,CAAAe,OAAA,CAAA8B,aAAA,CAACzC,sBAAA,CAAAW,OAAQ,CAAC+B,IAAI;IACZhB,KAAK,EAAE,CACLiB,MAAM,CAACC,SAAS,EAChB;MACEvB,KAAK;MACLC,MAAM;MACNG,YAAY;MACZoB,eAAe,EAAEtB;IACnB,CAAC,EACDgB,aAAa,EACbb,KAAK;EACL,GAEDC,QACY,CAAC;AAEpB;AAEA,MAAMgB,MAAM,GAAGG,uBAAU,CAACC,MAAM,CAAC;EAC/BH,SAAS,EAAE;IACTI,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ShimmerAnimation = ShimmerAnimation;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ var _reactNativeLinearGradient = require("react-native-linear-gradient");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /**
13
+ * Shimmer animation component using Reanimated 3
14
+ *
15
+ * Creates a smooth left-to-right shimmer effect using:
16
+ * - Shared values for performance
17
+ * - Worklets for 60 FPS on UI thread
18
+ * - Linear gradient for shimmer effect
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <ShimmerAnimation
23
+ * width={200}
24
+ * height={20}
25
+ * borderRadius={4}
26
+ * />
27
+ * ```
28
+ */
29
+ function ShimmerAnimation({
30
+ width,
31
+ height,
32
+ baseColor = '#E1E9EE',
33
+ highlightColor = '#F2F8FC',
34
+ duration = 1500,
35
+ borderRadius = 4,
36
+ style,
37
+ children
38
+ }) {
39
+ // Shared value for animation progress (0 to 1)
40
+ const progress = (0, _reactNativeReanimated.useSharedValue)(0);
41
+ (0, _react.useEffect)(() => {
42
+ // Start infinite shimmer animation
43
+ progress.value = (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withTiming)(1, {
44
+ duration,
45
+ easing: _reactNativeReanimated.Easing.linear
46
+ }), -1,
47
+ // Infinite repeat
48
+ false // Don't reverse
49
+ );
50
+ }, [duration, progress]);
51
+
52
+ // Animated style for shimmer overlay
53
+ const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
54
+ 'worklet';
55
+
56
+ // Calculate shimmer position
57
+ // Interpolate from -100% to 100% to create left-to-right sweep
58
+ const translateX = (0, _reactNativeReanimated.interpolate)(progress.value, [0, 1], [-1, 1]);
59
+ return {
60
+ transform: [{
61
+ translateX: translateX * (typeof width === 'number' ? width : 200)
62
+ }]
63
+ };
64
+ }, [width]);
65
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
66
+ style: [styles.container, {
67
+ width,
68
+ height,
69
+ borderRadius,
70
+ backgroundColor: baseColor
71
+ }, style]
72
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
73
+ style: [_reactNative.StyleSheet.absoluteFill, {
74
+ overflow: 'hidden',
75
+ borderRadius
76
+ }]
77
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
78
+ style: [styles.shimmer, {
79
+ width: typeof width === 'number' ? width : '100%',
80
+ height: '100%'
81
+ }, animatedStyle]
82
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeLinearGradient.LinearGradient, {
83
+ colors: [baseColor, highlightColor, highlightColor, baseColor],
84
+ start: {
85
+ x: 0,
86
+ y: 0
87
+ },
88
+ end: {
89
+ x: 1,
90
+ y: 0
91
+ },
92
+ style: _reactNative.StyleSheet.absoluteFill
93
+ }))), children);
94
+ }
95
+ const styles = _reactNative.StyleSheet.create({
96
+ container: {
97
+ overflow: 'hidden'
98
+ },
99
+ shimmer: {
100
+ position: 'absolute'
101
+ }
102
+ });
103
+ //# sourceMappingURL=ShimmerAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeLinearGradient","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ShimmerAnimation","width","height","baseColor","highlightColor","duration","borderRadius","style","children","progress","useSharedValue","useEffect","value","withRepeat","withTiming","easing","Easing","linear","animatedStyle","useAnimatedStyle","translateX","interpolate","transform","createElement","View","styles","container","backgroundColor","StyleSheet","absoluteFill","overflow","shimmer","LinearGradient","colors","start","x","y","end","create","position"],"sourceRoot":"../../../src","sources":["animations/ShimmerAnimation.tsx"],"mappings":";;;;;;AAAA,IAAAA,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AK,EAAE,CACLqB,uBAAU,CAACC,YAAY,EACvB;MACEC,QAAQ,EAAE,QAAQ;MAClBxB;IACF,CAAC;EACD,gBAEF/B,MAAA,CAAAgB,OAAA,CAAAgC,aAAA,CAAC5C,sBAAA,CAAAY,OAAQ,CAACiC,IAAI;IACZjB,KAAK,EAAE,CACLkB,MAAM,CAACM,OAAO,EACd;MACE9B,KAAK,EAAE,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,MAAM;MACjDC,MAAM,EAAE;IACV,CAAC,EACDgB,aAAa;EACb,gBAEF3C,MAAA,CAAAgB,OAAA,CAAAgC,aAAA,CAAC3C,0BAAA,CAAAoD,cAAc;IACbC,MAAM,EAAE,CAAC9B,SAAS,EAAEC,cAAc,EAAEA,cAAc,EAAED,SAAS,CAAE;IAC/D+B,KAAK,EAAE;MAAEC,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAE;IACtBC,GAAG,EAAE;MAAEF,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAE;IACpB7B,KAAK,EAAEqB,uBAAU,CAACC;EAAa,CAChC,CACY,CACF,CAAC,EAGfrB,QACG,CAAC;AAEX;AAEA,MAAMiB,MAAM,GAAGG,uBAAU,CAACU,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTI,QAAQ,EAAE;EACZ,CAAC;EACDC,OAAO,EAAE;IACPQ,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AnimationWrapper", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _AnimationWrapper.AnimationWrapper;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "PulseAnimation", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _PulseAnimation.PulseAnimation;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "ShimmerAnimation", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _ShimmerAnimation.ShimmerAnimation;
22
+ }
23
+ });
24
+ var _ShimmerAnimation = require("./ShimmerAnimation");
25
+ var _PulseAnimation = require("./PulseAnimation");
26
+ var _AnimationWrapper = require("./AnimationWrapper");
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ShimmerAnimation","require","_PulseAnimation","_AnimationWrapper"],"sourceRoot":"../../../src","sources":["animations/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA","ignoreList":[]}