How to use the react-native-code-push.InstallMode function in react-native-code-push

To help you get started, we’ve selected a few react-native-code-push examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github duheng / Mozi / src / root.js View on Github external
* Author: 墨子
 * GitHub: https://github.com/duheng/Mozi
 * Email: duheng1100@163.com
 */
import React, { Component, } from 'react';
import { Provider, } from 'react-redux';
import SplashScreen from 'react-native-splash-screen';
import codePush from 'react-native-code-push';
import configureStore from './app/store/configureStore';
import App from './AppNavigationState';

const store = configureStore();

@codePush({
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_SUSPEND,
})
export default class Root extends Component {
  componentDidMount() {
    SplashScreen.hide(); // 隐藏启动屏
  }

  render() {
    console.log('store----', store);
    return (
      
        
      
    );
  }
}
github FuYaoDe / 30-days-of-react-native / src / containers / Router.js View on Github external
componentDidMount() {

    CodePush.checkForUpdate()
    .then( (update) =>{
        if( !update ){
            Alert.alert("app是最新版了");
        }else {
            Alert.alert("有更新哦");
        }
    });

    CodePush.sync({ updateDialog: true, installMode: CodePush.InstallMode.IMMEDIATE },
      (status) => {
        switch (status) {
          case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
            // this.setState({showDownloadingModal: true});
            // this.refs.modal.open();
            break;
          case CodePush.SyncStatus.INSTALLING_UPDATE:
            // this.setState({showInstalling: true});
            break;
          case CodePush.SyncStatus.UPDATE_INSTALLED:
            // this.refs.modal.close();
            // this.setState({showDownloadingModal: false});
            break;
        }
      },
      ({ receivedBytes, totalBytes, }) => {
github RN-ONE / RNFrameWorkNew / app / util / CheckCodePushUpdateUtil.js View on Github external
update.download(CheckCodePushUpdateUtil.down).then(instance => {
            //下载完成了,调用这个方法
            console.log("开始安装");
            instance.install(codePush.InstallMode.IMMEDIATE).then(() => {
                console.log("安装完成");
                codePush.notifyAppReady();
                codePush.allowRestart();
                codePush.restartApp(true);
            }).catch(reason => {
                CheckCodePushUpdateUtil.error();
            });
        }).catch((reason) => {
            CheckCodePushUpdateUtil.error();
github sishuguojixuefu / react-native-template-sishu-0.59 / app / utils / CodePushSync.ts View on Github external
const syncOnNextRestart = () => {
  console.info('[CodePush]syncOnNextSuspend: 安装更新,但不立马重启,直到下一次重新进入')
  CodePush.sync({ installMode: CodePush.InstallMode.ON_NEXT_RESTART }, codePushStatusDidChange)
}
github tranhoangduong1994 / react-native-boilerplate / src / components / common / CodePushComponent.js View on Github external
import { useEffect } from 'react';
import codePush from 'react-native-code-push';

const codePushOptions = {
  installMode: codePush.InstallMode.ON_NEXT_RESUME,
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME
};

const CodePushComponent = () => {
  useEffect(() => {
    codePush.sync();
  }, []);

  return null;
};

export default codePush(codePushOptions)(CodePushComponent);
github kenvies / ONE-ReactNative / src / redux / components / MyHomeScreen.js View on Github external
onButtonPress() {
    codePush.sync({
      updateDialog: true,
      installMode: codePush.InstallMode.IMMEDIATE
    });
  }
github lyxia / MyRNStartKit / js / pages / mainTabs / Setting.js View on Github external
_syncUpdata = () => {
        codePush.sync({
            updateDialog: true,
            installMode: codePush.InstallMode.ON_NEXT_RESTART
        });
    }
github lisong / code-push-demo-app / App.js View on Github external
syncImmediate() {
    CodePush.sync(
      { installMode: CodePush.InstallMode.IMMEDIATE, updateDialog: true },
      this.codePushStatusDidChange.bind(this),
      this.codePushDownloadDidProgress.bind(this)
    );
  }
github wkl007 / GitHubPopular / src / page / my / MyPage.js View on Github external
update () {
    codePush.sync({
      updateDialog: {
        title: '更新',
        appendReleaseDescription: true,
        descriptionPrefix: '更新内容:\n',
        mandatoryContinueButtonLabel: '更新',
        mandatoryUpdateMessage: '',
        optionalIgnoreButtonLabel: '忽略',
        optionalInstallButtonLabel: '更新',
        optionalUpdateMessage: '',
      },
      mandatoryInstallMode: codePush.InstallMode.IMMEDIATE,
    })
  }
github kenvies / ONE-ReactNative / index.android.js View on Github external
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
import React from 'react';
import {
  AppRegistry
} from 'react-native';
import Root from './src/redux/root'
import CodePush from 'react-native-code-push'

const app = CodePush({
  installMode: CodePush.InstallMode.IMMEDIATE,
  updateDialog: true
})(Root)

AppRegistry.registerComponent('SimpleApp',  ()=>app);