Skip to content

[iOS] Fixes scrollIndicatorInsets not work in old arch#46944

Closed
zhongwuzw wants to merge 3 commits into
facebook:mainfrom
zhongwuzw:features/fix_scrollIndicatorInsets
Closed

[iOS] Fixes scrollIndicatorInsets not work in old arch#46944
zhongwuzw wants to merge 3 commits into
facebook:mainfrom
zhongwuzw:features/fix_scrollIndicatorInsets

Conversation

@zhongwuzw
Copy link
Copy Markdown
Contributor

Summary:

Fixes #46918 . break change comes from #44820 and #44789 .

Changelog:

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

Test Plan:

scrollIndicatorInsets should work in old arch.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Oct 10, 2024

- (void)setScrollIndicatorInsets:(UIEdgeInsets)value
{
CGPoint contentOffset = _scrollView.contentOffset;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line and line 1062 should not be required.
Line 1061 set the scroll indiciator insets but it does not use the contentOffset, so why are we reading and then setting it again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cipolleschi I just restore the old logic,

RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIEdgeInsets);
, maybe it's because setting indicator insets may affects the contentOffset.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should not. There should not be side effects, and even if there are, they should be contained in the UIScrollView. Can we test what happen if we remove those extra lines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test it, seems not affects contentoffset, I removed it.

RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval)
RCT_EXPORT_VIEW_PROPERTY(zoomScale, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets)
RCT_EXPORT_VIEW_PROPERTY(verticalScrollIndicatorInsets, UIEdgeInsets)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. JS would not see the vertical scroll indicator anymore and JS components that use it will break. Can we:

  1. deprecate the verticalScrollIndicatorInsets prop
  2. add the scrollIndicatorInsetsprops
  3. make sure that the verticalScrollIndicatorInsets prop uses the scrollIndicatorInsets under the hood
  4. Add a deprecation warning in JS, somehow so users that are using that prop can change it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cipolleschi I don't see ScrollView props have verticalScrollIndicatorInsets, actually it's changed from scrollIndicatorInsetsprops to verticalScrollIndicatorInsets in #44820 , but I don't know why..

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we need to keep the vertical version around, because the RCT_EXPORT_VIEW_PROPERTY macro exposes the verticalScrollIndicatorInsets to JS and there might be product code that uses that prop.
If we change it to scrollIndicatorInsets, the product code will break.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cipolleschi I restore the verticalScrollIndicatorInsets, but actually, if product use it, it would crash because RCTScrollView not implements verticalScrollIndicatorInsets methods.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RCTScrollView not implements verticalScrollIndicatorInsets methods.

How did it work before? 😱

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any relevant context in the pull request at #44820. It may just be an oversight. :)

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Oct 15, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@cipolleschi merged this pull request in c1178ac.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @zhongwuzw in c1178ac

When will my fix make it into a release? | How to file a pick request?

gaearon added a commit to bluesky-social/social-app that referenced this pull request Dec 16, 2024
gaearon added a commit to bluesky-social/social-app that referenced this pull request Dec 16, 2024
* Undo expo modules patch

* Upgrade expo modules release

* Patch facebook/react-native#46944

* Remove explicit prebuild config dep

* Bump to rm duplicates
Signez pushed a commit to Signez/bsky-social-app that referenced this pull request Dec 26, 2024
* Undo expo modules patch

* Upgrade expo modules release

* Patch facebook/react-native#46944

* Remove explicit prebuild config dep

* Bump to rm duplicates
joemun pushed a commit to discord/react-native that referenced this pull request Jan 11, 2025
Summary:
Fixes facebook#46918 . break change comes from facebook#44820 and facebook#44789 .

## Changelog:

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

Pull Request resolved: facebook#46944

Test Plan: scrollIndicatorInsets should work in old arch.

Reviewed By: philIip

Differential Revision: D64173490

Pulled By: cipolleschi

fbshipit-source-id: f7186439146d1b811c02e584fd1d94fcbb5d88a2
joemun pushed a commit to discord/react-native that referenced this pull request Jan 16, 2025
Summary:
Fixes facebook#46918 . break change comes from facebook#44820 and facebook#44789 .

## Changelog:

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

Pull Request resolved: facebook#46944

Test Plan: scrollIndicatorInsets should work in old arch.

Reviewed By: philIip

Differential Revision: D64173490

Pulled By: cipolleschi

fbshipit-source-id: f7186439146d1b811c02e584fd1d94fcbb5d88a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] scrollIndicatorInsets ignored since RN 0.75

4 participants