Merge pull request #32612 from szdc/react-native-add-method-to-flatlist

[react-native] add missing flashScrollIndicators method to FlatList component
This commit is contained in:
Eloy Durán
2019-01-30 13:19:56 +01:00
committed by GitHub
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -4111,6 +4111,11 @@ export class FlatList<ItemT> extends React.Component<FlatListProps<ItemT>> {
* by taps on items or by navigation actions.
*/
recordInteraction: () => void;
/**
* Displays the scroll indicators momentarily.
*/
flashScrollIndicators: () => void;
}
/**
+9
View File
@@ -332,6 +332,14 @@ InteractionManager.runAfterInteractions(() => {
}).then(() => "done");
export class FlatListTest extends React.Component<FlatListProps<number>, {}> {
list: FlatList<any> | null = null;
componentDidMount(): void {
if (this.list) {
this.list.flashScrollIndicators();
}
}
_renderItem = (rowData: any) => {
return (
<View>
@@ -345,6 +353,7 @@ export class FlatListTest extends React.Component<FlatListProps<number>, {}> {
render() {
return (
<FlatList
ref={list => (this.list = list)}
data={[1, 2, 3, 4, 5]}
renderItem={this._renderItem}
ItemSeparatorComponent={this._renderSeparator}