[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110599":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":12,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":14,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":19,"topics":21,"createdAt":9,"pushedAt":22,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":26,"discoverSource":27},110599,"react-native-splash-motion","seyedmostafahasani\u002Freact-native-splash-motion","seyedmostafahasani","React Native splash screen with animated Lottie & dotLottie, rendered natively before your JavaScript loads. Expo + bare React Native, built on Nitro Modules.",null,"TypeScript",59,3,51,2,0,8,44.11,"MIT License",false,"main",[],"2026-11-23 20:10:18","2026-11-21 04:55:35","# react-native-splash-motion\n\n**Animated Lottie splash screens for React Native — rendered natively, _before_ your JavaScript loads.**\n\nMost \"animated splash\" solutions render the animation with React, so it can only start once the JS bundle has loaded. Until then your users stare at a static image. SplashMotion plays your animation in a native view from the very first frames of app launch, keeps it running **while** the bundle loads, and hands off to your app with a polished outro.\n\n- 🎬 **Lottie or dotLottie** — bring the file your designer exported (`.json` or `.lottie`)\n- ⚡ **Native from frame one** — Core Animation on iOS, off-main-thread rendering on Android\n- 🪄 **Zero native code** — no `AppDelegate` \u002F `MainActivity` edits, it wires itself up\n- 🧩 **Expo & bare React Native** — config plugin + CLI share the same generator\n- 🔥 **New Architecture only**, built on [Nitro Modules](https:\u002F\u002Fnitro.margelo.com)\n- 🎯 **Smart exit** — finishes the current loop, plays your outro, then fades\n\n## Demo\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Cth>iOS\u003C\u002Fth>\n    \u003Cth>Android\u003C\u002Fth>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg src=\"docs\u002Fdemo-ios.gif\" alt=\"SplashMotion on iOS\" width=\"260\">\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"docs\u002Fdemo-android.gif\" alt=\"SplashMotion on Android\" width=\"260\">\u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\nWhat you're seeing, from the tap on the app icon:\n\n1. **The OS launch screen** shows your background color straight away, before any of your code runs.\n2. **The animation plays natively** while React Native starts and your JavaScript loads in the background.\n3. **Your app calls `hide()`** once it's ready. The current loop finishes, then the splash fades out to reveal the app.\n\nBoth recordings are release builds of the [example app](example\u002F), with the splash generated by:\n\n```sh\nnpx splash-motion generate assets\u002Fsplash.json --background \"#0F6E56\" --width 160\n```\n\n## Requirements\n\n- React Native with the **New Architecture** enabled (the default since 0.76)\n- [`react-native-nitro-modules`](https:\u002F\u002Fgithub.com\u002Fmrousavy\u002Fnitro)\n- iOS 15+ · Android 7+ (API 24)\n- Expo: a development build (Expo Go can't load custom native code)\n\n## Installation\n\n```sh\nyarn add react-native-splash-motion react-native-nitro-modules\n```\n\n## Your animation file\n\nPut the file anywhere in your project (e.g. `assets\u002Fsplash.json`) and point the CLI or Expo plugin at it. The format is picked from the extension:\n\n| Format    | Extension | Where it comes from                                                 |\n| --------- | --------- | ------------------------------------------------------------------- |\n| Lottie    | `.json`   | After Effects + Bodymovin, or \"Lottie JSON\" download on LottieFiles |\n| dotLottie | `.lottie` | \"dotLottie\" download on LottieFiles, or any dotLottie v1\u002Fv2 export  |\n\n- **`.lottie`** files are unpacked at build time into plain Lottie JSON. Images bundled inside are embedded, so they render as-is. If the file contains several animations, the active one (or the first) is used.\n- The animation is copied into the native project when you run the generator, so after replacing the file, run it again and rebuild.\n\nSee [Designing your animation](#designing-your-animation) for markers (`loop`, `outro`) and other tips.\n\n### Size\n\nThe animation is drawn at a fixed size, centered on the splash background. Sizes are in points on iOS and dp on Android.\n\n| Option     | Default                                                   |\n| ---------- | --------------------------------------------------------- |\n| `--width`  | `160`                                                     |\n| `--height` | Follows the animation's own aspect ratio (its `w` \u002F `h`). |\n\nBoth must be positive numbers; decimals are fine. There is no upper limit, but at runtime the animation is **scaled down to fit 90% of the screen's width and height**, keeping its aspect ratio, so a large value never gets cut off (on phones, in landscape or in split-screen). It is never scaled up, so on tablets it stays at the size you set. The iOS launch-screen `--still` image follows the same rule, so the hand-off doesn't jump.\n\n### First frame on the launch screen (`--still`)\n\nBefore your app's process is running, no code can play an animation: iOS shows its launch storyboard and Android its system splash, both static. Without a still, that moment shows only the background color. Pass a PNG of your animation's **first frame** (transparent background, ideally at 3× or 4× the size you set) and the CLI puts it on both launch screens at exactly the place and size of the animation, so the animation looks like it is there from the first tap and simply starts moving:\n\n```sh\nnpx splash-motion generate assets\u002Fsplash.json --background \"#0F6E56\" --still assets\u002Fsplash-first-frame.png\n```\n\nExport the frame from After Effects or LottieFiles. With `--loop-marker`, use the first frame of that marker instead, since that's where playback starts. Automatic extraction (no PNG needed) is on the [roadmap](#roadmap); for now the PNG has to come from you.\n\nOn Android the system splash only shows a centered circle 192dp wide, so keep the first frame's artwork inside that circle (or use a width of about 135dp or less to show all of it). Anything outside it appears as soon as the animation takes over.\n\n### Bare React Native\n\nGenerate the splash from your animation, then rebuild:\n\n```sh\nnpx splash-motion generate assets\u002Fsplash.json --background \"#0F6E56\"\ncd ios && pod install\n```\n\nThat's it — there is no native code to add.\n\n### Expo\n\nRemove `expo-splash-screen` (SplashMotion replaces it), then add the plugin:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\n      [\n        \"react-native-splash-motion\",\n        {\n          \"source\": \".\u002Fassets\u002Fsplash.json\",\n          \"background\": \"#0F6E56\",\n          \"width\": 200\n        }\n      ]\n    ]\n  }\n}\n```\n\n```sh\nnpx expo prebuild --clean\n```\n\n## Usage\n\nHide the splash once your app is ready:\n\n```tsx\nimport SplashMotion from 'react-native-splash-motion';\n\n\u003CNavigationContainer onReady={() => SplashMotion.hide()}>\n  {\u002F* … *\u002F}\n\u003C\u002FNavigationContainer>\n```\n\nOr with the hook:\n\n```tsx\nimport { useHideSplash } from 'react-native-splash-motion';\n\nfunction App() {\n  const [fontsLoaded] = useFonts(fonts);\n  useHideSplash(fontsLoaded, { outro: 'outro' });\n  \u002F\u002F …\n}\n```\n\n## API\n\n### `hide(options?): Promise\u003Cvoid>`\n\nResolves once the splash is fully gone. All options are optional.\n\n| Option        | Default | Description                                                              |\n| ------------- | ------- | ------------------------------------------------------------------------ |\n| `waitForLoop` | `true`  | Let the current loop finish instead of cutting the animation mid-motion. |\n| `outro`       | —       | A **marker** name to play before leaving.                                |\n| `minDuration` | `0`     | Keep the splash visible at least this long (ms since launch).            |\n| `fade`        | `220`   | Fade-out duration in ms. `0` disables it.                                |\n\nOrder of events: `minDuration` → finish loop → `outro` → `fade`.\n\n### `isVisible(): boolean`\n\n### `useHideSplash(ready?: boolean, options?)`\n\nCalls `hide(options)` as soon as `ready` is `true`.\n\n## CLI\n\n```\nnpx splash-motion generate \u003Canimation> [options]\n\n  \u003Canimation>               A Lottie .json or a dotLottie .lottie file\n\n  --background \u003Chex>        Background color              (default: #FFFFFF)\n  --width \u003Cnumber>          Animation width in dp\u002Fpt      (default: 160)\n  --height \u003Cnumber>         Animation height in dp\u002Fpt     (default: keeps aspect ratio)\n                            Scaled down at runtime to fit 90% of the screen\n  --still \u003Cpng>             Your animation's first frame, shown by the launch screen (iOS + Android)\n  --loop-marker \u003Cname>      Only loop this marker's range\n  --no-loop                 Play once and hold the last frame\n  --keep-background         Keep a full-canvas background solid in the animation (removed by default)\n  --platforms \u003Clist>        ios,android                   (default: both)\n```\n\nThe Expo plugin accepts the same options in camelCase (`loopMarker`, `keepBackground: true`, …) plus `source`.\n\n### Background layers\n\nAnimations exported from After Effects often include a full-size background solid (e.g. a white \"White Solid 1\" layer). It would draw an opaque box over your splash color, so the CLI removes it automatically and logs what it removed. Only plain, fully opaque solids at the bottom of the layer stack that cover the whole canvas are removed. Shapes, images and anything animated, masked or used as a matte are left alone. Pass `--keep-background` to keep it.\n\n## Designing your animation\n\nAdd markers in After Effects (or LottieFiles):\n\n- `loop` → the section that repeats while the app loads (`--loop-marker loop`)\n- `outro` → the exit, played by `hide({ outro: 'outro' })`\n\nDesign frame 0 to sit on the same background color as your splash so the launch is seamless.\n\n## How it works\n\n```\nTap icon ─▶ OS launch screen ─▶ native overlay (animation playing) ─▶ hide() ─▶ outro ─▶ your app\n            (static, generated)   └── JS bundle loads in parallel ──┘\n```\n\n1. **Build time** — the CLI \u002F Expo plugin copies your animation (unpacking a `.lottie` to JSON) into the app's asset catalog (iOS) and `assets\u002F` (Android), generates a matching launch screen and theme, and records the config.\n2. **Launch** — the OS shows the static launch screen. SplashMotion installs itself automatically (`+load` on iOS, an init `ContentProvider` on Android), attaches a native overlay to the first window and starts the animation. On Android the animation is parsed in the background as soon as the process starts, and the system splash is held until its first frame is ready; the animation then starts from that frame, so the hand-off from the `--still` image is invisible.\n3. **JS ready** — `hide()` goes through Nitro straight to Swift\u002FKotlin, which runs the exit sequence and removes the overlay.\n\n## Testing\n\n```js\n\u002F\u002F jest.setup.js\njest.mock('react-native-splash-motion', () => ({\n  __esModule: true,\n  default: {\n    hide: jest.fn().mockResolvedValue(undefined),\n    isVisible: jest.fn(() => false),\n  },\n  useHideSplash: jest.fn(),\n}));\n```\n\n## Troubleshooting\n\n- **Nothing changed** — native assets only update on a rebuild. Re-run `pod install` and rebuild; a JS reload isn't enough.\n- **iOS shows the old launch screen, then the new background** — iOS caches a snapshot of the launch screen and only refreshes it when the app is reinstalled. Delete the app from the device or simulator (or run `xcrun simctl uninstall booted \u003Cbundle id>`), then build again.\n- **Expo shows the old splash** — make sure `expo-splash-screen` is removed, then `npx expo prebuild --clean`.\n\n## Roadmap\n\n- Automatic first-frame extraction for `--still`\n- Dark-mode background (`--dark-background`) that stays seamless on iOS too\n- Per-platform animations and sizes\n- Rive (`.riv`) animation support\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md). After changing `src\u002FSplashMotion.nitro.ts`, run `yarn nitrogen`.\n\n## License\n\nMIT\n","这是一个为 React Native 应用提供原生级动态启动页（splash screen）的库，支持 Lottie 和 dotLottie 格式动画。其核心特点是动画在 JavaScript 加载前即由原生层（iOS Core Animation \u002F Android 独立线程）渲染，实现从 App 启动首帧起连续播放，并支持智能收尾过渡；无需修改原生代码，兼容 Expo 开发构建与裸项目，基于 React Native 新架构（Nitro Modules）。适用于对启动体验要求较高的生产级 App，尤其适合使用设计师交付的 Lottie 动画作为品牌启动动效的场景。","2026-11-24 04:39:24","CREATED_QUERY"]