How to use the react-native-background-timer.clearTimeout function in react-native-background-timer

To help you get started, we’ve selected a few react-native-background-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 pillarwallet / pillarwallet / src / navigation / appNavigation.js View on Github external
handleAppStateChange = (nextAppState: string) => {
    const {
      stopListeningNotifications,
      stopListeningIntercomNotifications,
      startListeningChatWebSocket,
      stopListeningChatWebSocket,
      updateSignalInitiatedState,
      navigation,
      isPickingImage,
      isBrowsingWebView,
      stopListeningForBalanceChange,
      endWalkthrough,
    } = this.props;
    const { lastAppState } = this.state;
    BackgroundTimer.clearTimeout(lockTimer);
    if (isPickingImage || isBrowsingWebView) return;
    // only checking if background state for logout or websocket channel close
    if (APP_LOGOUT_STATES.includes(nextAppState)) {
      // close websocket channel instantly to receive PN while in background
      stopListeningChatWebSocket();
      // close walkthrough shade or tooltips
      endWalkthrough();
      lockTimer = BackgroundTimer.setTimeout(() => {
        const pathAndParams = navigation.router.getPathAndParamsForState(navigation.state);
        const lastActiveScreen = pathAndParams.path.split('/').slice(-1)[0];
        const lastActiveScreenParams = pathAndParams.params;
        updateNavigationLastScreenState({ lastActiveScreen, lastActiveScreenParams });
        navigation.navigate(AUTH_FLOW);
        stopListeningNotifications();
        stopListeningIntercomNotifications();
        updateSignalInitiatedState(false);
github squatsandsciencelabs / OpenBarbellApp / app / redux / shared_actions / TimerActionCreators.js View on Github external
export const startEndSetTimer = () => (dispatch, getState) => {
    BackgroundTimer.clearTimeout(timer);
    timer = null;
    timeRemaining = null;
    startTime = null;
    isPaused = false;
    
    let state = getState();
    let durationInSeconds = state.settings.endSetTimerDuration;
    let isEditing = WorkoutSelectors.getIsEditing(state);

    if (durationInSeconds == null || durationInSeconds == 0) {
        timer = null;
    } else if (isEditing) {
        timeRemaining = durationInSeconds * 1000;
        isPaused = true;
        startTime = Date.now();
        // start it paused
github MetaMask / metamask-mobile / app / core / LockManager.js View on Github external
lockApp() {
		if (!SecureKeychain.getInstance().isAuthenticating) {
			this.navigation.navigate('LockScreen', { backgroundMode: true });
			this.locked = true;
		} else if (this.lockTimer) {
			BackgroundTimer.clearTimeout(this.lockTimer);
			this.lockTimer = null;
		}
	}
github squatsandsciencelabs / OpenBarbellApp / app / redux / shared_actions / DeviceActionCreators.js View on Github external
const clearTimers = () => {
    BackgroundTimer.clearTimeout(connectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimer);
    connectTimeoutTimer = null;
    reconnectTimeoutTimer = null;
    reconnectTimer = null;
};
github squatsandsciencelabs / OpenBarbellApp / app / redux / shared_actions / DeviceActionCreators.js View on Github external
const clearTimers = () => {
    BackgroundTimer.clearTimeout(connectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimer);
    connectTimeoutTimer = null;
    reconnectTimeoutTimer = null;
    reconnectTimer = null;
};
github Vinylize / Yetta-App / src / components / runnerView / runnerView.js View on Github external
handleCancelLookingForNewOrderBtn() {
    this.setState({receivedNewOrder: false});
    BackgroundTimer.clearTimeout(this.intervalId);
    this.props.setWaitingNewOrder(false);
  }
github Emurgo / yoroi-mobile / src / helpers / backgroundLockHelper.js View on Github external
export const backgroundLockListener = (action: () => void) => {
  if (AppState.currentState === 'background') {
    timeout = BackgroundTimer.setTimeout(action, CONFIG.APP_LOCK_TIMEOUT)
  } else if (AppState.currentState === 'active') {
    BackgroundTimer.clearTimeout(timeout)
  }
}
github squatsandsciencelabs / OpenBarbellApp / app / redux / shared_actions / DeviceActionCreators.js View on Github external
const clearTimers = () => {
    BackgroundTimer.clearTimeout(connectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimer);
    connectTimeoutTimer = null;
    reconnectTimeoutTimer = null;
    reconnectTimer = null;
};
github squatsandsciencelabs / OpenBarbellApp / app / redux / shared_actions / DeviceActionCreators.js View on Github external
const clearTimers = () => {
    BackgroundTimer.clearTimeout(connectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimeoutTimer);
    BackgroundTimer.clearTimeout(reconnectTimer);
    connectTimeoutTimer = null;
    reconnectTimeoutTimer = null;
    reconnectTimer = null;
};