Skip to content

Commit

Permalink
clean flow errors in react-native-github
Browse files Browse the repository at this point in the history
Summary:
Gets the error count for currently @flow'd files in react-native-github
down to 0. (Lots more still lack @flow.)

Test Plan: Run modified apps from App Explorer.
  • Loading branch information
Basil Hosmer authored and oss sync committed Apr 12, 2015
1 parent d33d336 commit bd8e93d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
5 changes: 1 addition & 4 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@

# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/vendor/.*
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
.*/node_modules/react-tools/src/browser/.*
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
.*/node_modules/react-tools/src/event/.*

# Ignore jest
.*/react-native/node_modules/jest-cli/.*

# Ignore Libraries
.*/Libraries/.*

[include]

[libs]
Expand Down
5 changes: 5 additions & 0 deletions Examples/2048/Game2048.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,16 @@ class GameEndOverlay extends React.Component {
}

class Game2048 extends React.Component {
startX: number;
startY: number;

constructor(props) {
super(props);
this.state = {
board: new GameBoard(),
};
this.startX = 0;
this.startY = 0;
}

restartGame() {
Expand Down
4 changes: 2 additions & 2 deletions Examples/UIExplorer/ListViewPagingExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ var ListViewPagingExample = React.createClass({
};
},

renderRow: function(rowData, sectionID, rowID) {
renderRow: function(rowData: string, sectionID: string, rowID: string): ReactElement {
return (<Thumb text={rowData}/>);
},

renderSectionHeader: function(sectionData, sectionID) {
renderSectionHeader: function(sectionData: string, sectionID: string) {
return (
<View style={styles.section}>
<Text style={styles.text}>
Expand Down
7 changes: 3 additions & 4 deletions Libraries/Animation/POPAnimationMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
'use strict';

var POPAnimation = require('POPAnimation');

if (!POPAnimation) {
// POP animation isn't available in the OSS fork - this is a temporary
// workaround to enable its availability to be determined at runtime.
module.exports = null;
module.exports = (null : ?{});
} else {

var invariant = require('invariant');
Expand Down Expand Up @@ -224,12 +225,10 @@ var POPAnimationMixin = {
w: frame.width,
h: frame.height
};
frame = undefined;
var velocity = velocity || [0, 0];
var posAnim = POPAnimation.createAnimation(type, {
property: POPAnimation.Properties.position,
toValue: [animFrame.x, animFrame.y],
velocity: velocity,
velocity: velocity || [0, 0],
});
var sizeAnim = POPAnimation.createAnimation(type, {
property: POPAnimation.Properties.size,
Expand Down
12 changes: 8 additions & 4 deletions Libraries/Components/ListView/ListViewDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ class ListViewDataSource {
/**
* @param {number} index
*
* Gets the rowID at index provided if the dataSource arrays were flattened
* Gets the rowID at index provided if the dataSource arrays were flattened,
* or null of out of range indexes.
*/
getRowIDForFlatIndex(index: number): string {
getRowIDForFlatIndex(index: number): ?string {
var accessIndex = index;
for (var ii = 0; ii < this.sectionIdentities.length; ii++) {
if (accessIndex >= this.rowIdentities[ii].length) {
Expand All @@ -226,14 +227,16 @@ class ListViewDataSource {
return this.rowIdentities[ii][accessIndex];
}
}
return null;
}

/**
* @param {number} index
*
* Gets the sectionID at index provided if the dataSource arrays were flattened
* Gets the sectionID at index provided if the dataSource arrays were flattened,
* or null for out of range indexes.
*/
getSectionIDForFlatIndex(index: number): string {
getSectionIDForFlatIndex(index: number): ?string {
var accessIndex = index;
for (var ii = 0; ii < this.sectionIdentities.length; ii++) {
if (accessIndex >= this.rowIdentities[ii].length) {
Expand All @@ -242,6 +245,7 @@ class ListViewDataSource {
return this.sectionIdentities[ii];
}
}
return null;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions Libraries/react-native/addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var addons = {
batchedUpdates: ReactUpdates.batchedUpdates,
cloneWithProps: cloneWithProps,
update: update,
Perf: undefined,
TestUtils: undefined,
};

if (__DEV__) {
Expand Down

0 comments on commit bd8e93d

Please sign in to comment.