Implement fading edges for ScrollView and it's dependent FlatList (#26163)

Summary:
This should add props for enabling horizontal and vertical fading
edges for Scrollview and FlatList.
These fading edges are used to communicate to the user that there is more content to see.

## Changelog

[Android] [Added] - fading edges props to the FlatList and ScrollView components
Pull Request resolved: https://github.com/facebook/react-native/pull/26163

Test Plan:
Open the React Native test app and navigate to the FlatList section.
Enable the `useFadingEdges` switch and insert a number into `Fading edge length`.

![device-2019-08-23-123745](https://user-images.githubusercontent.com/222393/63587150-7385cb00-c5a3-11e9-98dc-bffe8276d30c.png)
![device-2019-08-23-123844](https://user-images.githubusercontent.com/222393/63587156-75e82500-c5a3-11e9-9e9f-66876ac8f506.png)

Differential Revision: D16992488

Pulled By: sahrens

fbshipit-source-id: f72a9a890d9056bb017cc5747c6f66b7c35633dd
This commit is contained in:
André Krüger
2019-08-23 13:02:52 -07:00
committed by Facebook Github Bot
parent 41525c02a2
commit f8a64f9d61
5 changed files with 83 additions and 1 deletions
@@ -276,4 +276,14 @@ public class ReactHorizontalScrollViewManager extends ViewGroupManager<ReactHori
public void setPersistentScrollbar(ReactHorizontalScrollView view, boolean value) {
view.setScrollbarFadingEnabled(!value);
}
@ReactProp(name = "horizontalFadingEdgesEnabled")
public void setHorizontalFadingEdgesEnabled(ReactHorizontalScrollView view, boolean value) {
view.setHorizontalFadingEdgeEnabled(value);
}
@ReactProp(name = "fadingEdgeLength")
public void setFadingEdgeLength(ReactHorizontalScrollView view, int value) {
view.setFadingEdgeLength(value);
}
}
@@ -278,6 +278,16 @@ public class ReactScrollViewManager extends ViewGroupManager<ReactScrollView>
view.setScrollbarFadingEnabled(!value);
}
@ReactProp(name = "verticalFadingEdgesEnabled")
public void setVerticalFadingEdgesEnabled(ReactScrollView view, boolean value) {
view.setVerticalFadingEdgeEnabled(value);
}
@ReactProp(name = "fadingEdgeLength")
public void setFadingEdgeLength(ReactScrollView view, int value) {
view.setFadingEdgeLength(value);
}
@Override
public @Nullable Map<String, Object> getExportedCustomDirectEventTypeConstants() {
return createExportedCustomDirectEventTypeConstants();