Skip to content

Commit

Permalink
Back out "[react-native][PR] [Android] Implement fading edges for Scr…
Browse files Browse the repository at this point in the history
…ollView 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: #26163

Original commit changeset: f72a9a890d90

Reviewed By: TheSavior

Differential Revision: D16997468

fbshipit-source-id: 7973262287a7ec2cee5957f8dc1806a0f28c1432
  • Loading branch information
sahrens authored and facebook-github-bot committed Aug 24, 2019
1 parent f8dff0b commit 8e04a14
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 83 deletions.
21 changes: 0 additions & 21 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<{|
Expand Down
12 changes: 0 additions & 12 deletions Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,6 @@ type OptionalProps<ItemT> = {
* will be called when its corresponding ViewabilityConfig's conditions are met.
*/
viewabilityConfigCallbackPairs?: Array<ViewabilityConfigCallbackPair>,
/**
* 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<ItemT> = RequiredProps<ItemT> &
OptionalProps<ItemT> &
Expand Down
31 changes: 1 addition & 30 deletions RNTester/js/examples/FlatList/FlatListExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -58,8 +51,6 @@ type State = {|
virtualized: boolean,
empty: boolean,
useFlatListItemComponent: boolean,
useFadingEdges: boolean,
fadingEdgeLength: number,
|};

class FlatListExample extends React.PureComponent<Props, State> {
Expand All @@ -74,8 +65,6 @@ class FlatListExample extends React.PureComponent<Props, State> {
virtualized: true,
empty: false,
useFlatListItemComponent: false,
useFadingEdges: false,
fadingEdgeLength: 0,
};

_onChangeFilterText = filterText => {
Expand Down Expand Up @@ -135,29 +124,11 @@ class FlatListExample extends React.PureComponent<Props, State> {
{renderSmallSwitchOption(this, 'empty')}
{renderSmallSwitchOption(this, 'debug')}
{renderSmallSwitchOption(this, 'useFlatListItemComponent')}
{Platform.OS === 'android' && (
<View>
{renderSmallSwitchOption(this, 'useFadingEdges')}
<TextInput
placeholder="Fading edge length"
underlineColorAndroid="black"
keyboardType={'numeric'}
onChange={event =>
this.setState({
fadingEdgeLength: Number(event.nativeEvent.text),
})
}
/>
</View>
)}
<Spindicator value={this._scrollPos} />
</View>
</View>
<SeparatorComponent />
<Animated.FlatList
horizontalFadingEdgesEnabled={this.state.useFadingEdges}
verticalFadingEdgesEnabled={this.state.useFadingEdges}
fadingEdgeLength={this.state.fadingEdgeLength}
ItemSeparatorComponent={ItemSeparatorComponent}
ListHeaderComponent={<HeaderComponent />}
ListFooterComponent={FooterComponent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> getExportedCustomDirectEventTypeConstants() {
return createExportedCustomDirectEventTypeConstants();
Expand Down

0 comments on commit 8e04a14

Please sign in to comment.