Skip to content

Commit a2deb93

Browse files
committed
Consistently use Timers utility module to access clearTimeout, etc.
1 parent e4906a6 commit a2deb93

26 files changed

+57
-51
lines changed

src/common/utils/AutoFocusHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class FocusArbitratorProvider {
153153
type?: FocusCandidateType): void {
154154

155155
if (_autoFocusTimer) {
156-
clearTimeout(_autoFocusTimer);
156+
Timers.clearTimeout(_autoFocusTimer);
157157
}
158158

159159
const focusArbitratorProvider: FocusArbitratorProvider =

src/common/utils/FocusManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export abstract class FocusManager {
378378

379379
private static _clearRestoreRestrictionTimeout() {
380380
if (FocusManager._restoreRestrictionTimer) {
381-
clearTimeout(FocusManager._restoreRestrictionTimer);
381+
Timers.clearTimeout(FocusManager._restoreRestrictionTimer);
382382
FocusManager._restoreRestrictionTimer = undefined;
383383
FocusManager._pendingPrevFocusedComponent = undefined;
384384
}

src/native-common/ActivityIndicator.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as React from 'react';
1111
import * as RN from 'react-native';
1212

1313
import { Types } from '../common/Interfaces';
14+
import Timers from '../common/utils/Timers';
1415

1516
export interface ActivityIndicatorState {
1617
isVisible?: boolean;
@@ -29,7 +30,7 @@ export class ActivityIndicator extends React.Component<Types.ActivityIndicatorPr
2930
this._isMounted = true;
3031

3132
if (this.props.deferTime && this.props.deferTime > 0) {
32-
setTimeout(() => {
33+
Timers.setTimeout(() => {
3334
if (this._isMounted) {
3435
this.setState({ isVisible: true });
3536
}

src/native-common/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export class Button extends ButtonBase {
216216
if (this._isTouchFeedbackApplicable()) {
217217
if (this.props.underlayColor) {
218218
if (this._hideTimeout) {
219-
clearTimeout(this._hideTimeout);
219+
Timers.clearTimeout(this._hideTimeout);
220220
this._hideTimeout = undefined;
221221
}
222222
this._showUnderlay();
@@ -237,7 +237,7 @@ export class Button extends ButtonBase {
237237
if (this._isTouchFeedbackApplicable()) {
238238
if (this.props.underlayColor) {
239239
if (this._hideTimeout) {
240-
clearTimeout(this._hideTimeout);
240+
Timers.clearTimeout(this._hideTimeout);
241241
}
242242
this._hideTimeout = Timers.setTimeout(this._hideUnderlay, _hideUnderlayTimeout);
243243
}

src/native-common/FrontLayerViewManager.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import SubscribableEvent from 'subscribableevent';
1414

1515
import { Types } from '../common/Interfaces';
1616
import { ModalContainer } from '../native-common/ModalContainer';
17+
import Timers from '../common/utils/Timers';
1718

1819
import * as _ from './utils/lodashMini';
1920
import PopupContainerView from './PopupContainerView';
@@ -243,7 +244,7 @@ export class FrontLayerViewManager {
243244
// UI making it not doing one of the two animations (i.e.: Opening an actionsheet
244245
// while dismissing a popup). We introduce this delay to make sure the popup
245246
// dimissing animation has finished before we call the event handler.
246-
setTimeout(() => { activePopupContext.popupOptions.onAnchorPressed!(e); }, 500);
247+
Timers.setTimeout(() => { activePopupContext.popupOptions.onAnchorPressed!(e); }, 500);
247248
}
248249
}
249250
);

src/native-common/GestureView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export abstract class GestureView extends React.Component<Types.GestureViewProps
264264
// Cancels any pending double-tap timer.
265265
private _cancelDoubleTapTimer() {
266266
if (this._doubleTapTimer) {
267-
clearTimeout(this._doubleTapTimer);
267+
Timers.clearTimeout(this._doubleTapTimer);
268268
this._doubleTapTimer = undefined;
269269
}
270270
}
@@ -280,7 +280,7 @@ export abstract class GestureView extends React.Component<Types.GestureViewProps
280280

281281
private _cancelLongPressTimer() {
282282
if (this._longPressTimer) {
283-
clearTimeout(this._longPressTimer);
283+
Timers.clearTimeout(this._longPressTimer);
284284
this._longPressTimer = undefined;
285285
}
286286
this._pendingLongPressEvent = undefined;

src/native-common/Popup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import assert from '../common/assert';
1111
import * as RX from '../common/Interfaces';
12+
import Timers from '../common/utils/Timers';
1213

1314
import FrontLayerViewManager from './FrontLayerViewManager';
1415

@@ -23,7 +24,7 @@ export class Popup extends RX.Popup {
2324
autoDismiss(popupId: string, delay?: number): void {
2425
assert(popupId, `popupId must be a non-empty string. Actual: ${ popupId }`);
2526

26-
setTimeout(() => FrontLayerViewManager.dismissPopup(popupId), delay || 0);
27+
Timers.setTimeout(() => FrontLayerViewManager.dismissPopup(popupId), delay || 0);
2728
}
2829

2930
dismiss(popupId: string): void {

src/native-common/PopupContainerView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export class PopupContainerView extends PopupContainerViewBase<PopupContainerVie
226226

227227
private _stopRepositionPopupTimer() {
228228
if (this._respositionPopupTimer) {
229-
clearInterval(this._respositionPopupTimer);
229+
Timers.clearInterval(this._respositionPopupTimer);
230230
this._respositionPopupTimer = undefined;
231231
}
232232
}

src/native-common/View.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export class View extends ViewBase<RX.Types.ViewProps, RX.Types.Stateless, RN.Vi
525525
if (this._isTouchFeedbackApplicable()) {
526526
if (this.props.underlayColor) {
527527
if (this._hideTimeout) {
528-
clearTimeout(this._hideTimeout);
528+
Timers.clearTimeout(this._hideTimeout);
529529
this._hideTimeout = undefined;
530530
}
531531
this._showUnderlay();
@@ -542,7 +542,7 @@ export class View extends ViewBase<RX.Types.ViewProps, RX.Types.Stateless, RN.Vi
542542
if (this._isTouchFeedbackApplicable()) {
543543
if (this.props.underlayColor) {
544544
if (this._hideTimeout) {
545-
clearTimeout(this._hideTimeout);
545+
Timers.clearTimeout(this._hideTimeout);
546546
}
547547
this._hideTimeout = Timers.setTimeout(this._hideUnderlay, _hideUnderlayTimeout);
548548
}

src/native-desktop/RootView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function applyDesktopBehaviorMixin<TRootViewBase extends Constructor<React.Compo
8080
const activeComponent = FocusManager.getCurrentFocusedComponent();
8181

8282
if (this._isNavigatingWithKeyboardUpateTimer) {
83-
clearTimeout(this._isNavigatingWithKeyboardUpateTimer);
83+
Timers.clearTimeout(this._isNavigatingWithKeyboardUpateTimer);
8484
}
8585

8686
this._isNavigatingWithKeyboardUpateTimer = Timers.setTimeout(() => {
@@ -95,7 +95,7 @@ function applyDesktopBehaviorMixin<TRootViewBase extends Constructor<React.Compo
9595

9696
_updateKeyboardNavigationState(isNavigatingWithKeyboard: boolean) {
9797
if (this._isNavigatingWithKeyboardUpateTimer) {
98-
clearTimeout(this._isNavigatingWithKeyboardUpateTimer);
98+
Timers.clearTimeout(this._isNavigatingWithKeyboardUpateTimer);
9999
this._isNavigatingWithKeyboardUpateTimer = undefined;
100100
}
101101

0 commit comments

Comments
 (0)