From 3be204efbb972586bff7adb073762cdd9cee2dc4 Mon Sep 17 00:00:00 2001 From: miroslav Date: Thu, 5 Jan 2023 11:12:16 +0100 Subject: [PATCH] fix crash after clicking back button during manual bank account flow --- src/components/TextInput/BaseTextInput.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index 0fed14ea4317..5bd2a2344f02 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -66,7 +66,8 @@ class BaseTextInput extends Component { } if (this.props.shouldDelayFocus) { - return setTimeout(() => this.input.focus(), CONST.ANIMATED_TRANSITION); + this.focusTimeout = setTimeout(() => this.input.focus(), CONST.ANIMATED_TRANSITION); + return; } this.input.focus(); } @@ -94,6 +95,10 @@ class BaseTextInput extends Component { } componentWillUnmount() { + if (this.focusTimeout) { + clearTimeout(this.focusTimeout); + } + if (!this.props.disableKeyboard || !this.appStateSubscription) { return; }