Skip to content

Commit

Permalink
Revert "Improve Flow Type for ScrollResponder"
Browse files Browse the repository at this point in the history
This reverts commit 54bf3ae.
  • Loading branch information
grabbou committed Oct 29, 2019
1 parent 43593c7 commit 18cfb31
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
16 changes: 1 addition & 15 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<ScrollView, 'getScrollableNode'>,
getInnerViewNode: $PropertyType<ScrollView, 'getInnerViewNode'>,
getNativeScrollRef: $PropertyType<ScrollView, 'getNativeScrollRef'>,

setNativeProps: $PropertyType<ScrollView, 'setNativeProps'>,
scrollTo: $PropertyType<ScrollView, 'scrollTo'>,
scrollWithoutAnimationTo: $PropertyType<
ScrollView,
'scrollWithoutAnimationTo',
>,
flashScrollIndicators: $PropertyType<ScrollView, 'flashScrollIndicators'>,

...ScrollView,
...typeof ScrollResponder.Mixin,
};

Expand Down
3 changes: 1 addition & 2 deletions Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -442,7 +441,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
/**
* Provides a handle to the underlying scroll responder.
*/
getScrollResponder(): ?ScrollResponderType {
getScrollResponder(): any {
if (this._listRef) {
return this._listRef.getScrollResponder();
}
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Lists/SectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -276,7 +275,7 @@ class SectionList<SectionT: SectionBase<any>> 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();
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -432,7 +431,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
* 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();
}
Expand Down

0 comments on commit 18cfb31

Please sign in to comment.