# react-native-startuppage

> empty

Latest version **0.1.13** (published 2022-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-startuppage
pnpm add react-native-startuppage
yarn add react-native-startuppage
bun add react-native-startuppage
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.13 |
| Published | 2022-07-21 |
| First published | 2022-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 155.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jiawei.tang |
| Maintainers | billl89 |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-startuppage
- Repository: https://github.com/SBDavid/react-native-startuppage
- Homepage: https://github.com/SBDavid/react-native-startuppage#readme
- Issues: https://github.com/SBDavid/react-native-startuppage/issues
- npm.io page: https://npm.io/package/react-native-startuppage

## Dependencies (1)

- [@xmly/rn-sdk](https://npm.io/package/@xmly/rn-sdk.md) ^0.0.29

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.13 (latest) — 2022-07-21
- 0.1.13-alpha — 2022-07-21
- 0.1.12 — 2022-07-14
- 0.1.11 — 2022-07-14
- 0.1.10 — 2022-07-14
- 0.1.9 — 2022-07-14
- 0.1.8 — 2022-04-02
- 0.1.7 — 2022-04-02
- 0.1.6 — 2022-04-01
- 0.1.5 — 2022-04-01
- 0.1.3 — 2022-04-01
- 0.1.2 — 2022-04-01
- 0.1.1 — 2022-04-01
- 0.1.0 — 2022-04-01

## README

# react-native-startuppage

RN应用统一启动动画。有一下有点：

- 接入方便：提供了默认配置、动画效果
- 使用Native动画，在js文件加载期间不卡顿
- loading效果可配置：可以更具设计需求自定义动画组件
- 高性能机型上不展示 loading 效果：通过fadein动画，使得loading动画在高性能机型上隐藏

## 安装

  + npm install react-native-startuppage

## 使用
为了实现最短的白屏时长， `react-native-startuppage`需要在项目的入口文件中使用。并且减少在这个阶段引入的文件数量

所有的业务项目依赖应该在 `App.js`中引入。

### 基本使用，使用默认配置

使用`require('./src/App').default`实现业务代码的延迟加载

index.jsx
```js
import { AppRegistry } from 'react-native';
import { StartupPage } from '../src/index';
import React from 'react';

class AppWithLoading extends StartupPage {
  getLazyComponent(props: any) {
    const initData = props.initData;
    const App = require('./src/App').default;
    return <App {...initData} />;
  }
}

AppRegistry.registerComponent('PageAnalyticsExample', () => AppWithLoading);

```

### 使用自定义配置
您可以使用默认的loading效果，也可以自己实现。
并且默认loading效果具备基本的样式配置

- indicatorColor：动画颜色，默认黑色
- indicatorSize：动画宽高，默认40px
- indicatorDuration：fadein动画时长，默认800ms
- showIndicator：是否展示加载动画
- bgColor?：背景色，默认白色
- bgImageStyle：背景图
- bgImageSource：背景图

index.jsx
```js
import { AppRegistry } from 'react-native';
import { StartupPage, DefaultLoadingComp, DefaultBgComp } from 'react-native-startuppage';
import React from 'react';

class AppWithLoading extends StartupPage {

  // 主界面
  getLazyComponent(props: any) {
    const initData = props.initData;
    const App = require('./src/App').default;
    return <App {...initData} />;
  }

  // 背景图
  getBgComp(_props: any): Element {
    const home_pic = require('./home_pic.png');
    return (
      <DefaultBgComp
        bgColor="grey"
        bgImageSource={home_pic}
        bgImageStyle={styles.homeImage}
      />
    );
  }

  // loading动画
  getLoadingComp(props: any): Element {
    const isDarkMode = props.initData.isDarkMode;

    if (isDarkMode) {
      <DefaultLoadingComp
        indicatorColor="white"
        indicatorSize={40}
      />
    }

    return (
      <DefaultLoadingComp
        indicatorColor="black"
        indicatorSize={40}
      />
    );
  }
}

AppRegistry.registerComponent('PageAnalyticsExample', () => AppWithLoading);

```

---
_Source: https://npm.io/package/react-native-startuppage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
