Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

fix: add clearTimeout to keyboard manager #275

Merged
merged 4 commits into from
Oct 24, 2019

Conversation

wojtus7
Copy link
Contributor

@wojtus7 wojtus7 commented Oct 24, 2019

No description provided.

@@ -14,6 +14,13 @@ export default class KeyboardManager extends React.Component<Props> {
// When a gesture didn't change the tab, we can restore the focused input with this
private previouslyFocusedTextInput: number | null = null;
private startTimestamp: number = 0;
private keyboardTimeout: NodeJS.Timer | null = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined is good

Suggested change
private keyboardTimeout: NodeJS.Timer | null = null;
private keyboardTimeout: NodeJS.Timer;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private keyboardTimeout: NodeJS.Timeout


componentWillUnmount = () => {
if (this.keyboardTimeout !== null) {
global.clearTimeout(this.keyboardTimeout);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
global.clearTimeout(this.keyboardTimeout);
clearTimeout(this.keyboardTimeout);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should also clear the time out on beginning of handlePageChangeStart, handlePageChangeConfirm and handlePageChangeCancel in case there is another quick swipe after cancel?

@osdnk osdnk merged commit f33e839 into react-navigation:master Oct 24, 2019
@@ -14,8 +14,21 @@ export default class KeyboardManager extends React.Component<Props> {
// When a gesture didn't change the tab, we can restore the focused input with this
private previouslyFocusedTextInput: number | null = null;
private startTimestamp: number = 0;
private keyboardTimeout: NodeJS.Timeout | undefined;

clearKeyboardTimeout = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be private

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants