Skip to content

Commit

Permalink
Fixes scrollIndicatorInsets not work in old arch (#46944)
Browse files Browse the repository at this point in the history
Summary:
Fixes #46918 . break change comes from #44820 and #44789 .

## Changelog:

[IOS] [FIXED] - Fixes scrollIndicatorInsets not work in old arch

Pull Request resolved: #46944

Test Plan: scrollIndicatorInsets should work in old arch.

Reviewed By: philIip

Differential Revision: D64173490

Pulled By: cipolleschi

fbshipit-source-id: f7186439146d1b811c02e584fd1d94fcbb5d88a2
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Oct 15, 2024
1 parent 08bd8ac commit c1178ac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/react-native/React/Views/ScrollView/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,23 @@ -(type)getter \
RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL)
RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat);

- (void)setScrollIndicatorInsets:(UIEdgeInsets)value
{
[_scrollView setScrollIndicatorInsets:value];
}

- (UIEdgeInsets)scrollIndicatorInsets
{
UIEdgeInsets verticalScrollIndicatorInsets = [_scrollView verticalScrollIndicatorInsets];
UIEdgeInsets horizontalScrollIndicatorInsets = [_scrollView horizontalScrollIndicatorInsets];

return UIEdgeInsetsMake(
verticalScrollIndicatorInsets.top,
horizontalScrollIndicatorInsets.left,
verticalScrollIndicatorInsets.bottom,
horizontalScrollIndicatorInsets.right);
}

- (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts API_AVAILABLE(ios(13.0))
{
// `automaticallyAdjustsScrollIndicatorInsets` is available since iOS 13.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval)
RCT_EXPORT_VIEW_PROPERTY(zoomScale, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets)
RCT_EXPORT_VIEW_PROPERTY(scrollIndicatorInsets, UIEdgeInsets)
RCT_EXPORT_VIEW_PROPERTY(verticalScrollIndicatorInsets, UIEdgeInsets)
RCT_EXPORT_VIEW_PROPERTY(scrollToOverflowEnabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(snapToInterval, int)
Expand Down

0 comments on commit c1178ac

Please sign in to comment.