Skip to content

Commit f19ee28

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Adding $FlowFixMe to invalid prop accesses
Reviewed By: yungsters Differential Revision: D7977387 fbshipit-source-id: 442e7445be62f78bdf166a2b97ef031e39877355
1 parent 7ba7acd commit f19ee28

File tree

12 files changed

+55
-0
lines changed

12 files changed

+55
-0
lines changed

Libraries/Components/ScrollView/ScrollView.js

+13
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ const ScrollView = createReactClass({
636636
},
637637

638638
_getKeyForIndex: function(index, childArray) {
639+
// $FlowFixMe Invalid prop usage
639640
const child = childArray[index];
640641
return child && child.key;
641642
},
@@ -668,6 +669,7 @@ const ScrollView = createReactClass({
668669
if (!this.props.stickyHeaderIndices) {
669670
return;
670671
}
672+
// $FlowFixMe Invalid prop usage
671673
const childArray = React.Children.toArray(this.props.children);
672674
if (key !== this._getKeyForIndex(index, childArray)) {
673675
// ignore stale layout update
@@ -677,8 +679,10 @@ const ScrollView = createReactClass({
677679
const layoutY = event.nativeEvent.layout.y;
678680
this._headerLayoutYs.set(key, layoutY);
679681

682+
// $FlowFixMe Invalid prop usage
680683
const indexOfIndex = this.props.stickyHeaderIndices.indexOf(index);
681684
const previousHeaderIndex = this.props.stickyHeaderIndices[
685+
// $FlowFixMe Invalid prop usage
682686
indexOfIndex - 1
683687
];
684688
if (previousHeaderIndex != null) {
@@ -799,12 +803,16 @@ const ScrollView = createReactClass({
799803
const hasStickyHeaders =
800804
stickyHeaderIndices && stickyHeaderIndices.length > 0;
801805
const childArray =
806+
// $FlowFixMe Invalid prop usage
802807
hasStickyHeaders && React.Children.toArray(this.props.children);
803808
const children = hasStickyHeaders
809+
// $FlowFixMe Invalid prop usage
804810
? childArray.map((child, index) => {
811+
// $FlowFixMe Invalid prop usage
805812
const indexOfIndex = child ? stickyHeaderIndices.indexOf(index) : -1;
806813
if (indexOfIndex > -1) {
807814
const key = child.key;
815+
// $FlowFixMe Invalid prop usage
808816
const nextIndex = stickyHeaderIndices[indexOfIndex + 1];
809817
return (
810818
<ScrollViewStickyHeader
@@ -826,10 +834,12 @@ const ScrollView = createReactClass({
826834
return child;
827835
}
828836
})
837+
// $FlowFixMe Invalid prop usage
829838
: this.props.children;
830839
const contentContainer = (
831840
<ScrollContentContainerViewClass
832841
{...contentSizeChangeProps}
842+
// $FlowFixMe Invalid prop usage
833843
ref={this._setInnerViewRef}
834844
style={contentContainerStyle}
835845
removeClippedSubviews={
@@ -913,6 +923,7 @@ const ScrollView = createReactClass({
913923
// On iOS the RefreshControl is a child of the ScrollView.
914924
// tvOS lacks native support for RefreshControl, so don't include it in that case
915925
return (
926+
// $FlowFixMe Invalid prop usage
916927
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
917928
{Platform.isTVOS ? null : refreshControl}
918929
{contentContainer}
@@ -931,13 +942,15 @@ const ScrollView = createReactClass({
931942
<ScrollViewClass
932943
{...props}
933944
style={baseStyle}
945+
// $FlowFixMe Invalid prop usage
934946
ref={this._setScrollViewRef}>
935947
{contentContainer}
936948
</ScrollViewClass>,
937949
);
938950
}
939951
}
940952
return (
953+
// $FlowFixMe Invalid prop usage
941954
<ScrollViewClass {...props} ref={this._setScrollViewRef}>
942955
{contentContainer}
943956
</ScrollViewClass>

Libraries/Components/TextInput/TextInput.js

+1
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,7 @@ const TextInput = createReactClass({
10401040
},
10411041

10421042
_onTextInput: function(event: Event) {
1043+
// $FlowFixMe Invalid prop usage
10431044
this.props.onTextInput && this.props.onTextInput(event);
10441045
},
10451046

Libraries/Components/Touchable/TouchableBounce.js

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ const TouchableBounce = createReactClass({
138138
},
139139

140140
touchableGetPressRectOffset: function(): typeof PRESS_RETENTION_OFFSET {
141+
// $FlowFixMe Invalid prop usage
141142
return this.props.pressRetentionOffset || PRESS_RETENTION_OFFSET;
142143
},
143144

Libraries/Components/Touchable/TouchableHighlight.js

+12
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ const TouchableHighlight = createReactClass({
190190
getDefaultProps: () => DEFAULT_PROPS,
191191

192192
getInitialState: function() {
193+
// $FlowFixMe Invalid prop usage
193194
this._isMounted = false;
194195
if (this.props.testOnly_pressed) {
195196
return {
@@ -211,11 +212,13 @@ const TouchableHighlight = createReactClass({
211212
},
212213

213214
componentDidMount: function() {
215+
// $FlowFixMe Invalid prop usage
214216
this._isMounted = true;
215217
ensurePositiveDelayProps(this.props);
216218
},
217219

218220
componentWillUnmount: function() {
221+
// $FlowFixMe Invalid prop usage
219222
this._isMounted = false;
220223
clearTimeout(this._hideTimeout);
221224
},
@@ -235,12 +238,14 @@ const TouchableHighlight = createReactClass({
235238
*/
236239
touchableHandleActivePressIn: function(e: PressEvent) {
237240
clearTimeout(this._hideTimeout);
241+
// $FlowFixMe Invalid prop usage
238242
this._hideTimeout = null;
239243
this._showUnderlay();
240244
this.props.onPressIn && this.props.onPressIn(e);
241245
},
242246

243247
touchableHandleActivePressOut: function(e: PressEvent) {
248+
// $FlowFixMe Invalid prop usage
244249
if (!this._hideTimeout) {
245250
this._hideUnderlay();
246251
}
@@ -251,6 +256,7 @@ const TouchableHighlight = createReactClass({
251256
clearTimeout(this._hideTimeout);
252257
if (!Platform.isTVOS) {
253258
this._showUnderlay();
259+
// $FlowFixMe Invalid prop usage
254260
this._hideTimeout = setTimeout(
255261
this._hideUnderlay,
256262
this.props.delayPressOut,
@@ -284,6 +290,7 @@ const TouchableHighlight = createReactClass({
284290
},
285291

286292
_showUnderlay: function() {
293+
// $FlowFixMe Invalid prop usage
287294
if (!this._isMounted || !this._hasPressHandler()) {
288295
return;
289296
}
@@ -300,6 +307,7 @@ const TouchableHighlight = createReactClass({
300307

301308
_hideUnderlay: function() {
302309
clearTimeout(this._hideTimeout);
310+
// $FlowFixMe Invalid prop usage
303311
this._hideTimeout = null;
304312
if (this.props.testOnly_pressed) {
305313
return;
@@ -323,10 +331,12 @@ const TouchableHighlight = createReactClass({
323331
},
324332

325333
render: function() {
334+
// $FlowFixMe Invalid prop usage
326335
const child = React.Children.only(this.props.children);
327336
return (
328337
<View
329338
accessible={this.props.accessible !== false}
339+
// $FlowFixMe Invalid prop usage
330340
accessibilityLabel={this.props.accessibilityLabel}
331341
accessibilityComponentType={this.props.accessibilityComponentType}
332342
accessibilityTraits={this.props.accessibilityTraits}
@@ -347,7 +357,9 @@ const TouchableHighlight = createReactClass({
347357
onResponderMove={this.touchableHandleResponderMove}
348358
onResponderRelease={this.touchableHandleResponderRelease}
349359
onResponderTerminate={this.touchableHandleResponderTerminate}
360+
// $FlowFixMe Invalid prop usage
350361
nativeID={this.props.nativeID}
362+
// $FlowFixMe Invalid prop usage
351363
testID={this.props.testID}>
352364
{React.cloneElement(child, {
353365
style: StyleSheet.compose(

Libraries/Components/Touchable/TouchableWithoutFeedback.js

+4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ const TouchableWithoutFeedback = createReactClass({
144144
},
145145

146146
touchableGetPressRectOffset: function(): typeof PRESS_RETENTION_OFFSET {
147+
// $FlowFixMe Invalid prop usage
147148
return this.props.pressRetentionOffset || PRESS_RETENTION_OFFSET;
148149
},
149150

@@ -194,10 +195,13 @@ const TouchableWithoutFeedback = createReactClass({
194195
: child.props.style;
195196
return (React: any).cloneElement(child, {
196197
accessible: this.props.accessible !== false,
198+
// $FlowFixMe Invalid prop usage
197199
accessibilityLabel: this.props.accessibilityLabel,
198200
accessibilityComponentType: this.props.accessibilityComponentType,
199201
accessibilityTraits: this.props.accessibilityTraits,
202+
// $FlowFixMe Invalid prop usage
200203
nativeID: this.props.nativeID,
204+
// $FlowFixMe Invalid prop usage
201205
testID: this.props.testID,
202206
onLayout: this.props.onLayout,
203207
hitSlop: this.props.hitSlop,

Libraries/Experimental/SwipeableRow/SwipeableListView.js

+2
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ class SwipeableListView extends React.Component<Props, State> {
117117

118118
render(): React.Node {
119119
return (
120+
// $FlowFixMe Invalid prop usage
120121
<ListView
121122
{...this.props}
122123
ref={ref => {
124+
// $FlowFixMe Invalid prop usage
123125
this._listViewRef = ref;
124126
}}
125127
dataSource={this.state.dataSource.getDataSource()}

Libraries/Lists/FlatList.js

+1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
476476
_virtualizedListPairs: Array<ViewabilityConfigCallbackPair> = [];
477477

478478
_captureRef = ref => {
479+
// $FlowFixMe Invalid prop usage
479480
this._listRef = ref;
480481
};
481482

Libraries/Lists/ListView/ListView.js

+2
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,10 @@ const ListView = createReactClass({
516516
if (props.removeClippedSubviews === undefined) {
517517
props.removeClippedSubviews = true;
518518
}
519+
// $FlowFixMe Invalid prop usage
519520
Object.assign(props, {
520521
onScroll: this._onScroll,
522+
// $FlowFixMe Invalid prop usage
521523
stickyHeaderIndices: this.props.stickyHeaderIndices.concat(
522524
stickySectionHeaderIndices,
523525
),

Libraries/Lists/MetroListView.js

+7
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
8585
}
8686
scrollToOffset(params: {animated?: ?boolean, offset: number}) {
8787
const {animated, offset} = params;
88+
// $FlowFixMe Invalid prop usage
8889
this._listRef.scrollTo(
8990
this.props.horizontal ? {x: offset, animated} : {y: offset, animated},
9091
);
@@ -94,6 +95,7 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
9495
}
9596
setNativeProps(props: Object) {
9697
if (this._listRef) {
98+
// $FlowFixMe Invalid prop usage
9799
this._listRef.setNativeProps(props);
98100
}
99101
}
@@ -102,6 +104,7 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
102104
renderScrollComponent: (props: Props) => {
103105
if (props.onRefresh) {
104106
return (
107+
// $FlowFixMe Invalid prop usage
105108
<ScrollView
106109
{...props}
107110
refreshControl={
@@ -117,6 +120,7 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
117120
/>
118121
);
119122
} else {
123+
// $FlowFixMe Invalid prop usage
120124
return <ScrollView {...props} />;
121125
}
122126
},
@@ -135,13 +139,15 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
135139
}
136140
render() {
137141
return (
142+
// $FlowFixMe Invalid prop usage
138143
<ListView
139144
{...this.props}
140145
dataSource={this.state.ds}
141146
ref={this._captureRef}
142147
renderRow={this._renderRow}
143148
renderFooter={this.props.FooterComponent && this._renderFooter}
144149
renderSectionHeader={this.props.sections && this._renderSectionHeader}
150+
// $FlowFixMe Invalid prop usage
145151
renderSeparator={this.props.SeparatorComponent && this._renderSeparator}
146152
/>
147153
);
@@ -167,6 +173,7 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
167173
} else {
168174
invariant(!props.sections, 'Cannot have both sections and items props.');
169175
return {
176+
// $FlowFixMe Invalid prop usage
170177
ds: state.ds.cloneWithRows(props.items),
171178
sectionHeaderData,
172179
};

Libraries/Lists/SectionList.js

+5
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
284284
*/
285285
recordInteraction() {
286286
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
287+
// $FlowFixMe Invalid prop usage
287288
listRef && listRef.recordInteraction();
288289
}
289290

@@ -294,6 +295,7 @@ class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
294295
*/
295296
flashScrollIndicators() {
296297
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
298+
// $FlowFixMe Invalid prop usage
297299
listRef && listRef.flashScrollIndicators();
298300
}
299301

@@ -303,20 +305,23 @@ class SectionList<SectionT: SectionBase<any>> extends React.PureComponent<
303305
getScrollResponder(): ?ScrollView {
304306
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
305307
if (listRef) {
308+
// $FlowFixMe Invalid prop usage
306309
return listRef.getScrollResponder();
307310
}
308311
}
309312

310313
getScrollableNode() {
311314
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
312315
if (listRef) {
316+
// $FlowFixMe Invalid prop usage
313317
return listRef.getScrollableNode();
314318
}
315319
}
316320

317321
setNativeProps(props: Object) {
318322
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
319323
if (listRef) {
324+
// $FlowFixMe Invalid prop usage
320325
listRef.setNativeProps(props);
321326
}
322327
}

Libraries/Lists/VirtualizedList.js

+3
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
924924
(this.props.renderScrollComponent || this._defaultRenderScrollComponent)(
925925
scrollProps,
926926
),
927+
// $FlowFixMe Invalid prop usage
927928
{
928929
ref: this._captureScrollRef,
929930
},
@@ -1016,6 +1017,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
10161017
'`',
10171018
);
10181019
return (
1020+
// $FlowFixMe Invalid prop usage
10191021
<ScrollView
10201022
{...props}
10211023
refreshControl={
@@ -1032,6 +1034,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
10321034
/>
10331035
);
10341036
} else {
1037+
// $FlowFixMe Invalid prop usage
10351038
return <ScrollView {...props} />;
10361039
}
10371040
};

RNTester/js/ScrollViewExample.js

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ exports.examples = [
3939
<View>
4040
<ScrollView
4141
ref={scrollView => {
42+
// $FlowFixMe Invalid prop usage
4243
_scrollView = scrollView;
4344
}}
4445
automaticallyAdjustContentInsets={false}
@@ -96,18 +97,21 @@ exports.examples = [
9697
<Button
9798
label="Scroll to start"
9899
onPress={() => {
100+
// $FlowFixMe Invalid prop usage
99101
_scrollView.scrollTo({x: 0});
100102
}}
101103
/>
102104
<Button
103105
label="Scroll to end"
104106
onPress={() => {
107+
// $FlowFixMe Invalid prop usage
105108
_scrollView.scrollToEnd({animated: true});
106109
}}
107110
/>
108111
<Button
109112
label="Flash scroll indicators"
110113
onPress={() => {
114+
// $FlowFixMe Invalid prop usage
111115
_scrollView.flashScrollIndicators();
112116
}}
113117
/>

0 commit comments

Comments
 (0)