From c9be8cf398f92837863ed0400acfc5a80adaec8a Mon Sep 17 00:00:00 2001 From: Oliver Wilks Date: Sat, 8 Oct 2022 16:20:57 +0100 Subject: [PATCH] Fix for App crash while navigating back from Contacts --- src/components/OptionsSelector/BaseOptionsSelector.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index 690e21b6b073..9152c93db016 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -88,7 +88,7 @@ class BaseOptionsSelector extends Component { } if (this.props.shouldDelayFocus) { - setTimeout(() => this.textInput.focus(), CONST.ANIMATED_TRANSITION); + this.focusTimeout = setTimeout(() => this.textInput.focus(), CONST.ANIMATED_TRANSITION); } else { this.textInput.focus(); } @@ -121,6 +121,10 @@ class BaseOptionsSelector extends Component { } componentWillUnmount() { + if (this.focusTimeout) { + clearTimeout(this.focusTimeout); + } + if (this.unsubscribeEnter) { this.unsubscribeEnter(); }