How to use the react-native-code-push.disallowRestart 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 sishuguojixuefu / react-native-template-sishu-0.59 / app / utils / CodePushSync.ts View on Github external
const syncImmediate = () => {
  console.info('[CodePush]syncImmediate: 安装更新并立刻重启应用')
  CodePush.disallowRestart() // 禁止重启
  CodePush.sync({ installMode: CodePush.InstallMode.IMMEDIATE }, codePushStatusDidChange, progress => {
    console.info('[CodePush]codePushDownloadDidProgress: ', progress)
    if (progress.receivedBytes >= progress.totalBytes) {
      console.info('[CodePush]syncImmediate-强制更新')
      CodePush.allowRestart() // 强制更新
    }
  })
}
github RN-ONE / RNFrameWorkNew / app / util / CheckCodePushUpdateUtil.js View on Github external
static deal(update) {
        NavigationUtil.showLoadingOverLayOrModal("0%");
        codePush.disallowRestart();
        //确定之后,开始下载
        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 XboxYan / DYTT / App.js View on Github external
componentWillUnmount() {
		CodePush.disallowRestart();//禁止重启
        if (Platform.OS === 'android') {
            BackHandler.removeEventListener('hardwareBackPress', this.onBackAndroid);
        }
    }
    onBackAndroid = () => {
github duheng / Mozi / src / components / CodepushUpdate / index.js View on Github external
constructor(props) {
    super(props);
    CodePush.disallowRestart();
    this.listener;
    this.currProgress = 0.0;
    this.syncMessage = "";
    this.state = {
      showUpdate: false,
      isSync: false,
      update: false,
      syncStatus: "",
      isMandatory: false,
      next: false,
      currProgress: 0.0,
      updateInfo: {},
    };
  }
github SystangoTechnologies / Crashalert / RNCrashExamples / js / components / home / index.js View on Github external
toggleAllowRestart() {
    this.state.restartAllowed
      ? CodePush.disallowRestart()
      : CodePush.allowRestart();

    this.setState({ restartAllowed: !this.state.restartAllowed });
  }
github lisong / code-push-demo-app / App.js View on Github external
toggleAllowRestart() {
    this.state.restartAllowed
      ? CodePush.disallowRestart()
      : CodePush.allowRestart();

    this.setState({ restartAllowed: !this.state.restartAllowed });
  }
github listenzz / react-native-engineering / app / App.tsx View on Github external
componentDidDisappear() {
    CodePush.disallowRestart()
  }