diff --git a/native/account/logged-out-modal.react.js b/native/account/logged-out-modal.react.js --- a/native/account/logged-out-modal.react.js +++ b/native/account/logged-out-modal.react.js @@ -240,6 +240,8 @@ +panelOpacity: Node, +combinedSetMode: LoggedOutMode => void, +goBackToPrompt: () => void, + +activeAlertRef: { current: boolean }, + +setActiveAlert: boolean => void, // Navigation state +isForeground: boolean, // Redux state @@ -256,8 +258,6 @@ keyboardShowListener: ?EventSubscription; keyboardHideListener: ?EventSubscription; - activeAlert = false; - componentDidMount() { if (this.props.rehydrateConcluded) { this.onInitialAppLoad(); @@ -359,15 +359,11 @@ }; keyboardHide = () => { - if (!this.activeAlert) { + if (!this.props.activeAlertRef.current) { this.props.keyboardHeightValue.setValue(0); } }; - setActiveAlert = (activeAlert: boolean) => { - this.activeAlert = activeAlert; - }; - render(): React.Node { const { styles } = this.props; @@ -398,7 +394,7 @@ if (this.props.mode.curMode === 'log-in') { panel = ( @@ -406,7 +402,7 @@ } else if (this.props.mode.curMode === 'register') { panel = ( @@ -825,6 +821,11 @@ } }, [persistedStateLoaded, combinedSetMode]); + const activeAlertRef = React.useRef(false); + const setActiveAlert = React.useCallback((activeAlert: boolean) => { + activeAlertRef.current = activeAlert; + }, []); + const navContext = React.useContext(NavContext); const isForeground = isForegroundSelector(navContext); @@ -851,6 +852,8 @@ panelOpacity={panelOpacity} combinedSetMode={combinedSetMode} goBackToPrompt={goBackToPrompt} + activeAlertRef={activeAlertRef} + setActiveAlert={setActiveAlert} isForeground={isForeground} rehydrateConcluded={rehydrateConcluded} cookie={cookie}