From a66fad52b65874abcfc1ac79da81057279dd5dac Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sat, 21 Mar 2015 10:07:45 -0700 Subject: [PATCH] Updates from Fri 20 Mar - declare timeoutID | Basil Hosmer - [react-packager] Allow entry point extensions like .ios.js | Amjad Masad - [react-native] Use SpreadProperty to make react-docgen happy | Felix Kling - clean Examples/2048 | Basil Hosmer - [ReactNative] Adjust packager default root when running from within node_modules | Alex Kotliarskyi - [ReactNative] Add missing websocket dependency | Alex Kotliarskyi - [react-packager] change all but one `ix` to `require` | Amjad Masad --- Examples/2048/GameBoard.js | 14 ++++---- Examples/Movies/SearchScreen.js | 2 ++ Examples/UIExplorer/ImageCapInsetsExample.js | 5 ++- Examples/UIExplorer/ImageExample.js | 21 ++++++----- Examples/UIExplorer/TabBarExample.js | 7 ++-- .../Touchable/TouchableHighlight.js | 2 +- .../Components/Touchable/TouchableOpacity.js | 2 +- .../Components/View/ViewStylePropTypes.js | 8 ++--- Libraries/Image/Image.ios.js | 2 +- Libraries/Image/ImageStylePropTypes.js | 28 +++++++-------- Libraries/Image/ix.js | 26 -------------- Libraries/Text/TextStylePropTypes.js | 35 +++++++++---------- Libraries/react-native/react-native.js | 2 +- packager/packager.js | 7 +++- .../src/Server/__tests__/Server-test.js | 19 ++++++++-- packager/react-packager/src/Server/index.js | 26 +++++++------- website/server/extractDocs.js | 2 +- 17 files changed, 97 insertions(+), 111 deletions(-) delete mode 100644 Libraries/Image/ix.js diff --git a/Examples/2048/GameBoard.js b/Examples/2048/GameBoard.js index 8db899116..39b72141a 100644 --- a/Examples/2048/GameBoard.js +++ b/Examples/2048/GameBoard.js @@ -2,11 +2,12 @@ * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule GameBoard + * @flow */ 'use strict'; // NB: Taken straight from: https://github.com/IvanVergiliev/2048-react/blob/master/src/board.js -// with no modificiation except to format it for CommonJS and fix lint errors +// with no modificiation except to format it for CommonJS and fix lint/flow errors var rotateLeft = function (matrix) { var rows = matrix.length; @@ -21,9 +22,10 @@ var rotateLeft = function (matrix) { return res; }; -var Tile = function (value, row, column) { +var Tile = function (value?: number, row?: number, column?: number) { this.value = value || 0; this.row = row || -1; + this.column = column || -1; this.oldRow = -1; this.oldColumn = -1; @@ -102,8 +104,8 @@ Board.prototype.moveLeft = function () { targetTile.value += tile2.value; } resultRow[target] = targetTile; - this.won |= (targetTile.value === 2048); - hasChanged |= (targetTile.value !== this.cells[row][target].value); + this.won = this.won || (targetTile.value === 2048); + hasChanged = hasChanged || (targetTile.value !== this.cells[row][target].value); } this.cells[row] = resultRow; } @@ -172,14 +174,14 @@ Board.prototype.hasLost = function () { var canMove = false; for (var row = 0; row < Board.size; ++row) { for (var column = 0; column < Board.size; ++column) { - canMove |= (this.cells[row][column].value === 0); + canMove = canMove || (this.cells[row][column].value === 0); for (var dir = 0; dir < 4; ++dir) { var newRow = row + Board.deltaX[dir]; var newColumn = column + Board.deltaY[dir]; if (newRow < 0 || newRow >= Board.size || newColumn < 0 || newColumn >= Board.size) { continue; } - canMove |= (this.cells[row][column].value === this.cells[newRow][newColumn].value); + canMove = canMove || (this.cells[row][column].value === this.cells[newRow][newColumn].value); } } } diff --git a/Examples/Movies/SearchScreen.js b/Examples/Movies/SearchScreen.js index 822147516..700be18a1 100644 --- a/Examples/Movies/SearchScreen.js +++ b/Examples/Movies/SearchScreen.js @@ -39,6 +39,8 @@ var LOADING = {}; var SearchScreen = React.createClass({ mixins: [TimerMixin], + timeoutID: (null: any), + getInitialState: function() { return { isLoading: false, diff --git a/Examples/UIExplorer/ImageCapInsetsExample.js b/Examples/UIExplorer/ImageCapInsetsExample.js index 20fea43c7..d1efbdf2f 100644 --- a/Examples/UIExplorer/ImageCapInsetsExample.js +++ b/Examples/UIExplorer/ImageCapInsetsExample.js @@ -11,7 +11,6 @@ var { StyleSheet, Text, View, - ix, } = React; var ImageCapInsetsExample = React.createClass({ @@ -23,7 +22,7 @@ var ImageCapInsetsExample = React.createClass({ capInsets: none @@ -33,7 +32,7 @@ var ImageCapInsetsExample = React.createClass({ capInsets: 15 diff --git a/Examples/UIExplorer/ImageExample.js b/Examples/UIExplorer/ImageExample.js index 12b4d8843..7daf53791 100644 --- a/Examples/UIExplorer/ImageExample.js +++ b/Examples/UIExplorer/ImageExample.js @@ -9,7 +9,6 @@ var { StyleSheet, Text, View, - ix, } = React; var ImageCapInsetsExample = require('./ImageCapInsetsExample'); @@ -34,15 +33,15 @@ exports.examples = [ }, { title: 'Plain Static Image', - description: 'Static assets must be referenced with the `ix` wrapper and ' + - 'located in the app bundle.', + description: 'Static assets should be required by prefixing with `image!` ' + + 'and are located in the app bundle.', render: function() { return ( - - - - + + + + ); }, @@ -184,19 +183,19 @@ exports.examples = [ return ( diff --git a/Examples/UIExplorer/TabBarExample.js b/Examples/UIExplorer/TabBarExample.js index 34518284d..cd116b3e7 100644 --- a/Examples/UIExplorer/TabBarExample.js +++ b/Examples/UIExplorer/TabBarExample.js @@ -10,7 +10,6 @@ var StyleSheet = require('StyleSheet'); var Text = require('Text'); var View = require('View'); -var ix = require('ix'); var TabBarExample = React.createClass({ @@ -42,7 +41,7 @@ var TabBarExample = React.createClass({ selectedTab={this.state.selectedTab}> { @@ -55,7 +54,7 @@ var TabBarExample = React.createClass({ { @@ -68,7 +67,7 @@ var TabBarExample = React.createClass({ { diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index 9bb539ceb..0794e19ae 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -41,7 +41,7 @@ var DEFAULT_PROPS = { * * * * ); diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 549df36a8..680fc87f5 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -30,7 +30,7 @@ var onlyChild = require('onlyChild'); * * * * ); diff --git a/Libraries/Components/View/ViewStylePropTypes.js b/Libraries/Components/View/ViewStylePropTypes.js index c049c3d53..3c226bcde 100644 --- a/Libraries/Components/View/ViewStylePropTypes.js +++ b/Libraries/Components/View/ViewStylePropTypes.js @@ -8,13 +8,11 @@ var LayoutPropTypes = require('LayoutPropTypes'); var ReactPropTypes = require('ReactPropTypes'); -var merge = require('merge'); - /** * Warning: Some of these properties may not be supported in all releases. */ -var ViewStylePropTypes = merge( - LayoutPropTypes, { +var ViewStylePropTypes = { + ...LayoutPropTypes, backgroundColor: ReactPropTypes.string, borderColor: ReactPropTypes.string, borderTopColor: ReactPropTypes.string, @@ -36,6 +34,6 @@ var ViewStylePropTypes = merge( scaleY: ReactPropTypes.number, translateX: ReactPropTypes.number, translateY: ReactPropTypes.number, -}); +}; module.exports = ViewStylePropTypes; diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 315667d25..c25e92654 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -36,7 +36,7 @@ var warning = require('warning'); * * *