How to use the react-native-restart.Restart function in react-native-restart

To help you get started, we’ve selected a few react-native-restart 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 OriginProtocol / origin / mobile / src / components / authentication-guard.js View on Github external
_handleAppStateChange = nextAppState => {
    // app going to background
    if (nextAppState === 'background') {
      this.setState({
        suspendTime: new Date()
      })
    }

    // app coming from background
    if (this.state.appState === 'background' && nextAppState === 'active') {
      const secondsFromSuspend = (new Date() - this.state.suspendTime) / 1000

      if (secondsFromSuspend > RESTART_SUSPEND_TIME) {
        console.debug('Restart called')
        RNRestart.Restart()
      }
    }

    this.setState({ appState: nextAppState })
  }
github syun0216 / goforeat / app / debugView.js View on Github external
_confirmServer() {
    if(this.state.curselect.id == 3 && this.state.curselect.value == "") {
      ToastUtil.showWithMessage("請輸入服務器地址");
      return;
    }
    // debugStorage.removeAll();
    debugStorage.setData(this.state.curselect);
    ToastUtil.showWithMessage("设置成功");
    RNRestart.Restart();
  }
github blefebvre / react-native-sqlite-demo / src / database / DatabaseSynchronizer.ts View on Github external
.then(() => {
        console.log(
          "[DatabaseSynchronizer] DB download success! Reloading app."
        );
        RNRestart.Restart();
      })
      .catch(reason => {
github mongrov / roverz / src / network / index.js View on Github external
setTimeout(() => {
      RNRestart.Restart();
    }, 300);
  }
github NordicMuseum / Nordic-Museum-Audio-Guide / v2 / src / actions / device.js View on Github external
return async () => {
    audioActor().unloadAudio();

    if (locale) {
      const { setLocale, setRTL } = locale;

      await setLocaleAndRTLForReset({
        locale: setLocale,
        isRTL: setRTL,
        showWelcomeScreen: true,
      });
    } else {
      await setDefaultLocaleAndRTL();
    }

    RNRestart.Restart();
  };
}

react-native-restart

Sometimes you want to reload your app bundle during app runtime. This package will allow you to do it.

MIT
Latest version published 2 years ago

Package Health Score

64 / 100
Full package analysis

Popular react-native-restart functions