Skip to content

Conversation

@markv
Copy link
Contributor

@markv markv commented May 7, 2025

Summary:
Allows the start and end of the scrollview to be faded to different values independently by passing an object containing a "start" and "end" value to the fadingEdgeLength prop.

To support non-uniform edge lengths we use the FadingEdgeStrength api to set different values for the start/end of the scrollview. The FadingEdgeStrength value is multiplied by the FadingEdgeLength value internally by Android when drawing the view.

Because the value of FadingEdgeStrength is required to be between 0 and 1, we set setFadingEdgeLength to the max value and set the smaller side as a percentage of that value.

Changelog: [Android][Added] Allow fadingEdgeLength to be set independently on the start and end of the scrollview

Reviewed By: martinbooth

Differential Revision: D74222606

…f the scrollview

Summary:
Allows the start and end of the scrollview to be faded to different values independently by passing an object containing a "start" and "end" value to the fadingEdgeLength prop.

To support non-uniform edge lengths we use the [FadingEdgeStrength](https://developer.android.com/reference/android/view/View#getTopFadingEdgeStrength()) api to set different values for the start/end of the scrollview. The FadingEdgeStrength value is multiplied by the FadingEdgeLength value [internally by Android when drawing the view.](https://cs.android.com/android/platform/superproject/+/android15-qpr1-release:frameworks/base/core/java/android/view/View.java;l=25007)

Because the value of FadingEdgeStrength is required to be between 0 and 1, we set setFadingEdgeLength to the max value and set the smaller side as a percentage of that value.

Changelog: [Android][Added] Allow fadingEdgeLength to be set independently on the start and end of the scrollview

Reviewed By: martinbooth

Differential Revision: D74222606
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 7, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74222606

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by Mark Verlingieri in a21a4b8

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

@react-native-bot react-native-bot added the Merged This PR has been merged. label May 8, 2025
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in a21a4b8.

@pkfms
Copy link

pkfms commented Sep 15, 2025

a21a4b8#commitcomment-164494231

Looks like this did go into RN 0.81 - however, for some reason now the beginning of the content already fades at vertical scroll position 0 - which means the content is already fading on start although nobody scrolled so far. This is independent whether you use a number now or { start, end } construct. Both is not the case in RN 0.80.2 - here only in case you scroll from start to a position > 0 the start is fading. Is this the intended behavior (as from my point of view this is a breaking change). Besides, in general I think it's a good idea to control start and end - but this way we no longer can use fadingEdgeLength at all ...

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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants