How to use react-native-idle-timer - 4 common examples

To help you get started, we’ve selected a few react-native-idle-timer 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 CMP-Studio / DawnChorus / app / actors / timeWatcher.js View on Github external
killActor(silent) {
    if (!silent) {
      // console.log('timer is on');
      // console.log('screen will dim');
      // console.log('setting idle timer disabled to false, notifications.ios.js line 43');
      IdleTimerManager.setIdleTimerDisabled(false);
    }

    if (this.timerType) {
      switch (this.timerType) {
        case TIMER_TYPE_TIMEOUT: {
          clearTimeout(this.timerID);
          break;
        }

        case TIMER_TYPE_INTERVAL: {
          clearInterval(this.timerID);
          break;
        }

        default: {
          break;
github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
SilentSwitch.addEventListener((silent) => {
      this.silent = silent;
      if (AppState.currentState === 'active') {
        if (silent || this.permissions !== NOTIFICATION_PERMISSIONS_STATUS_AUTHORIZED) {
          // console.log('timer is off')
          // console.log('screen will not dim')
          // console.log('setting idle timer disabled to true, notifications.ios.js line 49');
          IdleTimerManager.setIdleTimerDisabled(true);
        } else {
          // console.log('timer is on');
          // console.log('screen will dim');
          // console.log('setting idle timer disabled to false, notifications.ios.js line 43');
          IdleTimerManager.setIdleTimerDisabled(false);
        }
        this.dispatch(updateSilentSwitchState(silent));
      }
    });
github CMP-Studio / DawnChorus / app / actors / notifications.ios.js View on Github external
SilentSwitch.addEventListener((silent) => {
      this.silent = silent;
      if (AppState.currentState === 'active') {
        if (silent || this.permissions !== NOTIFICATION_PERMISSIONS_STATUS_AUTHORIZED) {
          // console.log('timer is off')
          // console.log('screen will not dim')
          // console.log('setting idle timer disabled to true, notifications.ios.js line 49');
          IdleTimerManager.setIdleTimerDisabled(true);
        } else {
          // console.log('timer is on');
          // console.log('screen will dim');
          // console.log('setting idle timer disabled to false, notifications.ios.js line 43');
          IdleTimerManager.setIdleTimerDisabled(false);
        }
        this.dispatch(updateSilentSwitchState(silent));
      }
    });
github CMP-Studio / DawnChorus / app / actors / timeWatcher.js View on Github external
constructor(store) {
    this.dispatch = store.dispatch;
    this.timerID = null;
    this.timerType = null;

    // console.log('timer is off')
    // console.log('screen will not dim')
    // console.log('setting idle timer disabled to true, notifications.ios.js line 49');
    IdleTimerManager.setIdleTimerDisabled(true);
    this.watchTime();
  }

react-native-idle-timer

A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app

MIT
Latest version published 2 months ago

Package Health Score

78 / 100
Full package analysis

Popular react-native-idle-timer functions