diff --git a/packages/components-native/src/Form/Form.tsx b/packages/components-native/src/Form/Form.tsx index eb7c63479d..d958977a2b 100644 --- a/packages/components-native/src/Form/Form.tsx +++ b/packages/components-native/src/Form/Form.tsx @@ -122,8 +122,9 @@ function InternalForm({ const keyboardProps = Platform.select({ ios: { - onKeyboardWillHide: handleKeyboardHide, - onKeyboardWillShow: handleKeyboardShow, + // onKeyboardDidHide: handleKeyboardHide, + // onKeyboardDidShow: handleKeyboardShow, + onKeyboardDidChangeFrame: handleKeyboardDidChangeFrame, }, android: { onKeyboardDidHide: handleKeyboardHide, @@ -229,6 +230,21 @@ function InternalForm({ ); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function handleKeyboardDidChangeFrame(frames: Record) { + if ( + frames && + "endCoordinates" in frames && + "height" in frames.endCoordinates && + typeof frames.endCoordinates.height === "number" && + frames.endCoordinates.height > keyboardHeight + ) { + handleKeyboardShow(frames); + } else { + handleKeyboardHide(); + } + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any function handleKeyboardShow(frames: Record) { setKeyboardScreenY(frames.endCoordinates.screenY);