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: D17080676

Pulled By: TheSavior

fbshipit-source-id: 91df629c17052d43c99145672e9084e1379a4113
This commit is contained in:
André Krüger
2019-08-27 18:37:04 -07:00
committed by Facebook Github Bot
parent c9ff99f18e
commit 51aacd5241
5 changed files with 63 additions and 1 deletions
@@ -276,4 +276,15 @@ public class ReactHorizontalScrollViewManager extends ViewGroupManager<ReactHori
public void setPersistentScrollbar(ReactHorizontalScrollView view, boolean value) {
view.setScrollbarFadingEnabled(!value);
}
@ReactProp(name = "fadingEdgeLength")
public void setFadingEdgeLength(ReactHorizontalScrollView view, int value) {
if (value > 0) {
view.setHorizontalFadingEdgeEnabled(true);
view.setFadingEdgeLength(value);
} else {
view.setHorizontalFadingEdgeEnabled(false);
view.setFadingEdgeLength(0);
}
}
}
@@ -278,6 +278,17 @@ public class ReactScrollViewManager extends ViewGroupManager<ReactScrollView>
view.setScrollbarFadingEnabled(!value);
}
@ReactProp(name = "fadingEdgeLength")
public void setFadingEdgeLength(ReactScrollView view, int value) {
if (value > 0) {
view.setVerticalFadingEdgeEnabled(true);
view.setFadingEdgeLength(value);
} else {
view.setVerticalFadingEdgeEnabled(false);
view.setFadingEdgeLength(0);
}
}
@Override
public @Nullable Map<String, Object> getExportedCustomDirectEventTypeConstants() {
return createExportedCustomDirectEventTypeConstants();