From 18cfb3162cb2e6d218fbcd7f051219557a0d02b0 Mon Sep 17 00:00:00 2001 From: grabbou Date: Tue, 29 Oct 2019 11:40:52 +0100 Subject: [PATCH] Revert "Improve Flow Type for ScrollResponder" This reverts commit 54bf3ae1cfaf49562d60ebf06386c157fc27131e. --- Libraries/Components/ScrollView/ScrollView.js | 16 +--------------- Libraries/Lists/FlatList.js | 3 +-- Libraries/Lists/SectionList.js | 3 +-- Libraries/Lists/VirtualizedList.js | 3 +-- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index d477cbad085..e1021e3de91 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -64,21 +64,7 @@ if (Platform.OS === 'android') { } export type ScrollResponderType = { - // We'd like to do ...ScrollView here, however Flow doesn't seem - // to see the imperative methods of ScrollView that way. Workaround the - // issue by specifying them manually. - getScrollableNode: $PropertyType, - getInnerViewNode: $PropertyType, - getNativeScrollRef: $PropertyType, - - setNativeProps: $PropertyType, - scrollTo: $PropertyType, - scrollWithoutAnimationTo: $PropertyType< - ScrollView, - 'scrollWithoutAnimationTo', - >, - flashScrollIndicators: $PropertyType, - + ...ScrollView, ...typeof ScrollResponder.Mixin, }; diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 41354f7e53c..3afed1ba5a7 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -18,7 +18,6 @@ const StyleSheet = require('../StyleSheet/StyleSheet'); const invariant = require('invariant'); -import type {ScrollResponderType} from '../Components/ScrollView/ScrollView'; import type {ViewStyleProp} from '../StyleSheet/StyleSheet'; import type { ViewabilityConfig, @@ -442,7 +441,7 @@ class FlatList extends React.PureComponent, void> { /** * Provides a handle to the underlying scroll responder. */ - getScrollResponder(): ?ScrollResponderType { + getScrollResponder(): any { if (this._listRef) { return this._listRef.getScrollResponder(); } diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index d9ef718090a..99b621a2eb3 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -14,7 +14,6 @@ const React = require('react'); const ScrollView = require('../Components/ScrollView/ScrollView'); const VirtualizedSectionList = require('./VirtualizedSectionList'); -import type {ScrollResponderType} from '../Components/ScrollView/ScrollView'; import type {ViewToken} from './ViewabilityHelper'; import type { SectionBase as _SectionBase, @@ -276,7 +275,7 @@ class SectionList> extends React.PureComponent< /** * Provides a handle to the underlying scroll responder. */ - getScrollResponder(): ?ScrollResponderType { + getScrollResponder(): ?ScrollView { const listRef = this._wrapperListRef && this._wrapperListRef.getListRef(); if (listRef) { return listRef.getScrollResponder(); diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 62f614ec06e..7dffc1729ef 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -27,7 +27,6 @@ const warning = require('fbjs/lib/warning'); const {computeWindowedRenderLimits} = require('./VirtualizeUtils'); -import type {ScrollResponderType} from '../Components/ScrollView/ScrollView'; import type {ViewStyleProp} from '../StyleSheet/StyleSheet'; import type { ViewabilityConfig, @@ -432,7 +431,7 @@ class VirtualizedList extends React.PureComponent { * Note that `this._scrollRef` might not be a `ScrollView`, so we * need to check that it responds to `getScrollResponder` before calling it. */ - getScrollResponder(): ?ScrollResponderType { + getScrollResponder(): any { if (this._scrollRef && this._scrollRef.getScrollResponder) { return this._scrollRef.getScrollResponder(); }