From 08bd8ac47da60121225e7b281bbf566e2c5a291e Mon Sep 17 00:00:00 2001 From: Qichen Zhu <57348009+QichenZhu@users.noreply.github.com> Date: Tue, 15 Oct 2024 08:03:13 -0700 Subject: [PATCH] Fix KeyboardAvoidingView not aware of the keyboard closing after it is unmounted (#46952) Summary: In the new architecture, if you open the soft keyboard, unmount `KeyboardAvoidingView`, close the keyboard, and then remount `KeyboardAvoidingView`, it still assumes the keyboard is open and displays the keyboard avoiding area. We need to check if the keyboard is still open after remounting. Fixes https://github.com/facebook/react-native/issues/46942 ## Changelog: [GENERAL] [FIXED] - Fix KeyboardAvoidingView not aware of the keyboard closing it is unmounted Pull Request resolved: https://github.com/facebook/react-native/pull/46952 Test Plan: Code to reproduce in RNTester: ```JSX import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import {Button, KeyboardAvoidingView, Text, TextInput, View} from 'react-native'; import {Fragment, Suspense, useState} from "react"; const infiniteThenable = { then() {} }; function Suspender({ freeze, children }) { if (freeze) { throw infiniteThenable; } return {children}; } function Freeze({ freeze, children }) { return ( {children} ); } function Playground() { const [isFrozen, setIsFrozen] = useState(false); return ( <>