# @nghinv/react-native-codepush-manage

> React native codepush manage

Latest version **1.1.1** (published 2021-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nghinv/react-native-codepush-manage
pnpm add @nghinv/react-native-codepush-manage
yarn add @nghinv/react-native-codepush-manage
bun add @nghinv/react-native-codepush-manage
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-09-01 |
| First published | 2021-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 93.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | nghinv@lumi.biz |
| Maintainers | nghinv |
| Keywords | react-native, react native codepush manage, code push, codepush, @nghinv/react-native-codepush-manage, @nghinv, nghinv, lumi, lumi-software |

## Links

- npm: https://www.npmjs.com/package/@nghinv/react-native-codepush-manage
- Repository: https://github.com/nghinv-software/react-native-codepush-manage
- Homepage: https://github.com/nghinv-software/react-native-codepush-manage#readme
- Issues: https://github.com/nghinv-software/react-native-codepush-manage/issues
- npm.io page: https://npm.io/package/@nghinv/react-native-codepush-manage

## Recent versions

- 1.1.1 (latest) — 2021-09-01
- 1.0.2 (undefined) — 2021-06-18
- 1.1.0 — 2021-07-31
- 1.0.7 — 2021-07-06
- 1.0.6 — 2021-06-28
- 1.0.5 — 2021-06-28
- 1.0.4 — 2021-06-28
- 1.0.3 — 2021-06-22
- 1.0.1 — 2021-06-18
- 1.0.0 — 2021-06-18

## README

# @nghinv/react-native-codepush-manage

Loading an overlay when running long tasks in the react-native application.

---


[![Version][version-badge]][package]
[![MIT License][license-badge]][license]
[![All Contributors][all-contributors-badge]][all-contributors]

# Installation

## Installing the package

* Use yarn

```sh
yarn add @nghinv/react-native-codepush-manage
```

* Use npm

```sh
npm install @nghinv/react-native-codepush-manage
```

 - peerDependencies
 
```sh
yarn add react-native-code-push react-native-device-info
```

<img src='./assets/app-version.png'>
<img src='./assets/updating.png'>
<img src='./assets/needRestart.png'>


# How to use

## Connect with Root Component

you can use `withCodePush` or `CodePushProvider` to wrapped Root component

### Use withCodePush

- Connect `withCodePush` with `Root Component`

```javascript
  import { withCodePush } from '@nghinv/react-native-codepush-manage';

  ....

  // Default = {
  //   checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  //   installMode: codePush.InstallMode.ON_NEXT_RESTART,
  // }
  const codePushOptions = {};

  export default withCodePush(codePushOptions)(RootComponent);
```

### Use CodePushProvider

- Wrapped `CodePushProvider` with `Root Component`

```javascript
  import { CodePushProvider } from '@nghinv/react-native-codepush-manage';

  ....

  return (
    <CodePushProvider>
      <RootComponent />
    </CodePushProvider>
  )
```

## Use AppVersion

- Use hook function `useCodePush`

```js
  const { status, progress } = useCodePush();
```

- Use `AppVersion` component

```js
  import { AppVersion } from '@nghinv/react-native-codepush-manage';


  return (
    <View>
      <AppVersion 
        buildDate='02/09/2021'
        statusTitle={{
          Updating: 'Updating',
          Installing: 'Installing',
          NeedToRestart: 'Need to restart',
        }}
      />
    </View>
  )
```

# Property


## AppVersion property

| Property | Type | Default | Description |
|----------|:----:|:-------:|-------------|
| title | `String` | `null` | Title of app version |
| style | `ViewStyle` | `null` | Container style |
| titleColor | `String` | `null` | Title color |
| titleStyle | `TextStyle` | `null` | Title style |
| onPress | `() => void` | `null` |  |
| enableRestartOnPress | `Bool` | `null` | press to restart app |
| enableSyncOnPress | `Bool` | `null` | press to sync code push |
| buildDate | `String` | `null` | App build date |
| statusTitle | `StatusTitleStyle` | `null` |  |
| titleProps | `TextProps` | `null` |  |

<br>

### StatusTitleStyle

| Property | Type | Default | Description |
|----------|:----:|:-------:|-------------|
| Updating | `String` | `Updating` |  |
| Installing | `String` | `Installing` |  |
| NeedToRestart | `String` | `Need to restart` |  |

---
## Credits

- [@Nghi-NV](https://github.com/Nghi-NV)

[version-badge]: https://img.shields.io/npm/v/@nghinv/react-native-codepush-manage.svg?style=flat-square
[package]: https://www.npmjs.com/package/@nghinv/react-native-codepush-manage
[license-badge]: https://img.shields.io/npm/l/@nghinv/react-native-codepush-manage.svg?style=flat-square
[license]: https://opensource.org/licenses/MIT
[all-contributors-badge]: https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square
[all-contributors]: #contributors

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