From 8e04a1485f377e2d7d744fe74fc26e1dd0c056fc Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Fri, 23 Aug 2019 17:09:33 -0700 Subject: [PATCH] Back out "[react-native][PR] [Android] Implement fading edges for ScrollView and it's dependent FlatList" Summary: After some thought, we decided we don't need the flexibility of separate horizontal and vertical props - it would be much nicer to just have a single prop for the edge length and then the native code can enable the booleans as appropriate. Original PR: https://github.com/facebook/react-native/pull/26163 Original commit changeset: f72a9a890d90 Reviewed By: TheSavior Differential Revision: D16997468 fbshipit-source-id: 7973262287a7ec2cee5957f8dc1806a0f28c1432 --- Libraries/Components/ScrollView/ScrollView.js | 21 ------------- Libraries/Lists/FlatList.js | 12 ------- .../js/examples/FlatList/FlatListExample.js | 31 +------------------ .../ReactHorizontalScrollViewManager.java | 10 ------ .../views/scroll/ReactScrollViewManager.java | 10 ------ 5 files changed, 1 insertion(+), 83 deletions(-) diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 019a48b4f3c5df..b4298158b3354f 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -335,27 +335,6 @@ type AndroidProps = $ReadOnly<{| * @platform android */ persistentScrollbar?: ?boolean, - /** - * Fades out the left and right edges. - * The default value is false. - * - * @platform android - */ - horizontalFadingEdgesEnabled?: ?boolean, - /** - * Fades out the up and down edges. - * The default value is false. - * - * @platform android - */ - verticalFadingEdgesEnabled?: ?boolean, - /** - * The amount of fading. - * The default value is 0. - * - * @platform android - */ - fadingEdgeLength?: ?number, |}>; type VRProps = $ReadOnly<{| diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 26d87615880826..f9fb2a6aca1e00 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -233,18 +233,6 @@ type OptionalProps = { * will be called when its corresponding ViewabilityConfig's conditions are met. */ viewabilityConfigCallbackPairs?: Array, - /** - * See `ScrollView` for flow type and further documentation. - */ - horizontalFadingEdgesEnabled?: ?boolean, - /** - * See `ScrollView` for flow type and further documentation. - */ - verticalFadingEdgesEnabled?: ?boolean, - /** - * See `ScrollView` for flow type and further documentation. - */ - fadingEdgeLength?: ?number, }; export type Props = RequiredProps & OptionalProps & diff --git a/RNTester/js/examples/FlatList/FlatListExample.js b/RNTester/js/examples/FlatList/FlatListExample.js index 86a0741c002643..bb7cc9afe88c02 100644 --- a/RNTester/js/examples/FlatList/FlatListExample.js +++ b/RNTester/js/examples/FlatList/FlatListExample.js @@ -29,14 +29,7 @@ const { pressItem, renderSmallSwitchOption, } = require('../../components/ListExampleShared'); -const { - Alert, - Animated, - Platform, - StyleSheet, - TextInput, - View, -} = require('react-native'); +const {Alert, Animated, StyleSheet, View} = require('react-native'); import type {Item} from '../../components/ListExampleShared'; @@ -58,8 +51,6 @@ type State = {| virtualized: boolean, empty: boolean, useFlatListItemComponent: boolean, - useFadingEdges: boolean, - fadingEdgeLength: number, |}; class FlatListExample extends React.PureComponent { @@ -74,8 +65,6 @@ class FlatListExample extends React.PureComponent { virtualized: true, empty: false, useFlatListItemComponent: false, - useFadingEdges: false, - fadingEdgeLength: 0, }; _onChangeFilterText = filterText => { @@ -135,29 +124,11 @@ class FlatListExample extends React.PureComponent { {renderSmallSwitchOption(this, 'empty')} {renderSmallSwitchOption(this, 'debug')} {renderSmallSwitchOption(this, 'useFlatListItemComponent')} - {Platform.OS === 'android' && ( - - {renderSmallSwitchOption(this, 'useFadingEdges')} - - this.setState({ - fadingEdgeLength: Number(event.nativeEvent.text), - }) - } - /> - - )} } ListFooterComponent={FooterComponent} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java index f6563a20aa0c59..a8c9898e10d5d7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java @@ -276,14 +276,4 @@ public void setOverflow(ReactHorizontalScrollView view, @Nullable String overflo 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); - } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java index 1a2350174e9f1d..cb8befaca24300 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java @@ -278,16 +278,6 @@ public void setPersistentScrollbar(ReactScrollView view, boolean value) { 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 getExportedCustomDirectEventTypeConstants() { return createExportedCustomDirectEventTypeConstants();