diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 2802e65c6586..8727afadd2dd 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -360,9 +360,7 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & MAP_SCROLL_VIEW_PROP(showsHorizontalScrollIndicator); MAP_SCROLL_VIEW_PROP(showsVerticalScrollIndicator); - if (oldScrollViewProps.automaticallyAdjustKeyboardInsets != newScrollViewProps.automaticallyAdjustKeyboardInsets) { - _automaticallyAdjustKeyboardInsets = newScrollViewProps.automaticallyAdjustKeyboardInsets; - } + _automaticallyAdjustKeyboardInsets = newScrollViewProps.automaticallyAdjustKeyboardInsets; if (oldScrollViewProps.scrollIndicatorInsets != newScrollViewProps.scrollIndicatorInsets) { _scrollView.scrollIndicatorInsets = RCTUIEdgeInsetsFromEdgeInsets(newScrollViewProps.scrollIndicatorInsets); @@ -690,6 +688,8 @@ - (void)prepareForRecycle _state.reset(); const auto &props = static_cast(*_props); + // Cancel keyboard animations before resetting the state they manage. + [_scrollView.layer removeAllAnimations]; _scrollView.contentOffset = RCTCGPointFromPoint(props.contentOffset); // Reset zoom scale to default _scrollView.zoomScale = 1.0; @@ -697,11 +697,13 @@ - (void)prepareForRecycle // container frame after zoomScale reset (which may have mutated it in RTL). _contentSize = CGSizeZero; _scrollView.contentInset = RCTUIEdgeInsetsFromEdgeInsets(props.contentInset); + _scrollView.verticalScrollIndicatorInsets = RCTUIEdgeInsetsFromEdgeInsets(props.scrollIndicatorInsets); // We set the default behavior to "never" so that iOS // doesn't do weird things to UIScrollView insets automatically // and keeps it as an opt-in behavior. _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; _shouldUpdateContentInsetAdjustmentBehavior = YES; + _automaticallyAdjustKeyboardInsets = NO; _isUserTriggeredScrolling = NO; CGRect oldFrame = self.frame; self.frame = CGRectZero;