From c43d1458c7c71f17b29413b613780b15a8222e62 Mon Sep 17 00:00:00 2001 From: Basil Hosmer Date: Wed, 18 Mar 2015 12:11:40 -0700 Subject: [PATCH] clean flow errors in react-native-github --- .flowconfig | 5 +---- Examples/2048/Game2048.js | 5 +++++ Examples/UIExplorer/ListViewPagingExample.js | 4 ++-- Libraries/Animation/POPAnimationMixin.js | 7 +++---- Libraries/Components/ListView/ListViewDataSource.js | 12 ++++++++---- Libraries/react-native/addons.js | 2 ++ 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.flowconfig b/.flowconfig index 20bb687568b14d..82d818dcc09b5b 100644 --- a/.flowconfig +++ b/.flowconfig @@ -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] diff --git a/Examples/2048/Game2048.js b/Examples/2048/Game2048.js index e6b7fa6d4c194a..f4ad51b41ed204 100644 --- a/Examples/2048/Game2048.js +++ b/Examples/2048/Game2048.js @@ -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() { diff --git a/Examples/UIExplorer/ListViewPagingExample.js b/Examples/UIExplorer/ListViewPagingExample.js index c74795eb5a104e..0eec2700c3c2e3 100644 --- a/Examples/UIExplorer/ListViewPagingExample.js +++ b/Examples/UIExplorer/ListViewPagingExample.js @@ -99,11 +99,11 @@ var ListViewPagingExample = React.createClass({ }; }, - renderRow: function(rowData, sectionID, rowID) { + renderRow: function(rowData: string, sectionID: string, rowID: string): ReactElement { return (); }, - renderSectionHeader: function(sectionData, sectionID) { + renderSectionHeader: function(sectionData: string, sectionID: string) { return ( diff --git a/Libraries/Animation/POPAnimationMixin.js b/Libraries/Animation/POPAnimationMixin.js index a3f4b7defeb6ac..49145ebd4f859c 100644 --- a/Libraries/Animation/POPAnimationMixin.js +++ b/Libraries/Animation/POPAnimationMixin.js @@ -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, diff --git a/Libraries/Components/ListView/ListViewDataSource.js b/Libraries/Components/ListView/ListViewDataSource.js index 3be10944321940..b1916bc64498df 100644 --- a/Libraries/Components/ListView/ListViewDataSource.js +++ b/Libraries/Components/ListView/ListViewDataSource.js @@ -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; } /** diff --git a/Libraries/react-native/addons.js b/Libraries/react-native/addons.js index fcef285e223909..864d8906d11159 100644 --- a/Libraries/react-native/addons.js +++ b/Libraries/react-native/addons.js @@ -19,6 +19,8 @@ var addons = { batchedUpdates: ReactUpdates.batchedUpdates, cloneWithProps: cloneWithProps, update: update, + Perf: undefined, + TestUtils: undefined, }; if (__DEV__) {