From c56c45f5465f8fa81efc3604f628022312028391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20M=C4=99drek?= Date: Sat, 28 Jun 2025 12:05:51 +0200 Subject: [PATCH] fix(#226): incorrect height reported when UIAccessibilityPrefersCrossFadeTransitions is enabled --- .../ios/AvoidSoftInputListener.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/react-native-avoid-softinput/ios/AvoidSoftInputListener.mm b/packages/react-native-avoid-softinput/ios/AvoidSoftInputListener.mm index 36093d6..616cb4c 100644 --- a/packages/react-native-avoid-softinput/ios/AvoidSoftInputListener.mm +++ b/packages/react-native-avoid-softinput/ios/AvoidSoftInputListener.mm @@ -92,6 +92,14 @@ - (void)softInputHeightWillChange:(NSNotification *)notification BOOL isOrientationChange = screenHeight != previousScreenHeight; CGFloat newSoftInputHeight = screenHeight - softInputUserInfo.CGRectValue.origin.y; + + /// https://github.com/mateusz1913/react-native-avoid-softinput/issues/226 + /// The frame can be zero, when UIAccessibility.prefersCrossFadeTransitions setting is enabled + /// In that case, let's default to "closed" keyboard value + if (softInputUserInfo.CGRectValue.origin.y == 0) { + newSoftInputHeight = 0; + } + // notification begin frame info is not reliable, so instead get previous cached value CGFloat oldSoftInputHeight = previousSoftInputHeight;