Package Exports
- @nghinv/react-native-codepush-manage
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nghinv/react-native-codepush-manage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@nghinv/react-native-codepush-manage
Loading an overlay when running long tasks in the react-native application.
Installation
Installing the package
- Use yarn
yarn add @nghinv/react-native-codepush-manage- Use npm
npm install @nghinv/react-native-codepush-manage
How to use
Connect with Root Component
you can use withCodePush or CodePushProvider to wrapped Root component
Use withCodePush
- Connect
withCodePushwithRoot Component
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
CodePushProviderwithRoot Component
import { CodePushProvider } from '@nghinv/react-native-codepush-manage';
....
return (
<CodePushProvider>
<RootComponent />
</CodePushProvider>
)Use AppVersion
- Use hook function
useCodePush
const { status, progress } = useCodePush();- Use
AppVersioncomponent
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 |
StatusTitleStyle
| Property | Type | Default | Description |
|---|---|---|---|
| Updating | String |
Updating |
|
| Installing | String |
Installing |
|
| NeedToRestart | String |
Need to restart |