From 3107bc82eb55a87cb8fdbe0d45405082d126f673 Mon Sep 17 00:00:00 2001 From: Prakash Gurung Date: Mon, 23 Jan 2023 12:20:24 +0000 Subject: [PATCH] [iOS] Fix ScrollView automaticallyAdjustKeyboardInsets not resetting when Prefer Cross-Fade Transitions is enabled when using with TextInput --- React/Views/ScrollView/RCTScrollView.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index f0f64021aca6..f9819b47bc3a 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -331,6 +331,16 @@ - (void)_keyboardWillChangeFrame:(NSNotification *)notification newContentOffset.y -= contentDiff; } + if (@available(iOS 14.0, *)) { + // On iOS when Prefer Cross-Fade Transitions is enabled, the keyboard position + // & height is reported differently (0 instead of Y position value matching height of frame) + // Fixes similar issue we saw with https://github.com/facebook/react-native/pull/34503 + if (UIAccessibilityPrefersCrossFadeTransitions() && endFrame.size.height == 0) { + newContentOffset.y = 0; + newEdgeInsets.bottom = 0; + } + } + [UIView animateWithDuration:duration delay:0.0 options:animationOptionsWithCurve(curve)