clean flow errors in react-native-github

This commit is contained in:
Basil Hosmer 2015-03-18 12:11:40 -07:00
parent 0f5a3c16e4
commit c43d1458c7
6 changed files with 21 additions and 14 deletions

View File

@ -9,7 +9,7 @@
# 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/.*
@ -17,9 +17,6 @@
# Ignore jest
.*/react-native/node_modules/jest-cli/.*
# Ignore Libraries
.*/Libraries/.*
[include]
[libs]

View File

@ -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() {

View File

@ -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}>

View File

@ -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');
@ -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,

View File

@ -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) {
@ -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) {
@ -242,6 +245,7 @@ class ListViewDataSource {
return this.sectionIdentities[ii];
}
}
return null;
}
/**

View File

@ -19,6 +19,8 @@ var addons = {
batchedUpdates: ReactUpdates.batchedUpdates,
cloneWithProps: cloneWithProps,
update: update,
Perf: undefined,
TestUtils: undefined,
};
if (__DEV__) {