Skip to content

Commit 39f475e

Browse files
committed
2015-02-07 updates
- Random little fixes | Andres Suarez - Add backButtonTitle to Navigator | Nick Poulden - [react-pacakger] Ignore malformed package.json | Amjad Masad - Renamed hasMove to hasMark | Rich Seymour - Update XMLHttpRequest.ios.js | Nick Poulden - Warn about missing dependencies for issue #16 | Andrew McCloud
1 parent 462c7ed commit 39f475e

File tree

13 files changed

+125
-58
lines changed

13 files changed

+125
-58
lines changed

Examples/TicTacToe/TicTacToeApp.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Board {
4040
return this;
4141
}
4242

43-
hasMove(row: number, col: number): boolean {
43+
hasMark(row: number, col: number): boolean {
4444
return this.grid[row][col] !== 0;
4545
}
4646

@@ -132,7 +132,10 @@ var Cell = React.createClass({
132132

133133
render() {
134134
return (
135-
<TouchableHighlight onPress={this.props.onPress} underlayColor={'clear'} activeOpacity={0.5}>
135+
<TouchableHighlight
136+
onPress={this.props.onPress}
137+
underlayColor="transparent"
138+
activeOpacity={0.5}>
136139
<View style={[styles.cell, this.cellStyle()]}>
137140
<Image source={{uri: this.imageContents()}} />
138141
</View>
@@ -161,7 +164,10 @@ var GameEndOverlay = React.createClass({
161164
return (
162165
<View style={styles.overlay}>
163166
<Text style={styles.overlayMessage}>{message}</Text>
164-
<TouchableHighlight onPress={this.props.onRestart} underlayColor={'clear'} activeOpacity={0.5}>
167+
<TouchableHighlight
168+
onPress={this.props.onRestart}
169+
underlayColor="transparent"
170+
activeOpacity={0.5}>
165171
<View style={styles.newGame}>
166172
<Text style={styles.newGameText}>New Game</Text>
167173
</View>
@@ -185,7 +191,7 @@ var TicTacToeApp = React.createClass({
185191
},
186192

187193
handleCellPress(row: number, col: number) {
188-
if (this.state.board.hasMove(row, col)) {
194+
if (this.state.board.hasMark(row, col)) {
189195
return;
190196
}
191197

@@ -214,7 +220,10 @@ var TicTacToeApp = React.createClass({
214220
<View style={styles.board}>
215221
{rows}
216222
</View>
217-
<GameEndOverlay board={this.state.board} onRestart={this.restartGame} />
223+
<GameEndOverlay
224+
board={this.state.board}
225+
onRestart={this.restartGame}
226+
/>
218227
</View>
219228
);
220229
}

Examples/UIExplorer/LayoutExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ var LayoutExample = React.createClass({
124124
</UIExplorerBlock>
125125
<UIExplorerBlock title="Flex Wrap">
126126
<CircleBlock style={{flexWrap: 'wrap'}}>
127-
{'oooooooooooooooo'.split('').map(() => <Circle />)}
127+
{'oooooooooooooooo'.split('').map((char, i) => <Circle key={i} />)}
128128
</CircleBlock>
129129
</UIExplorerBlock>
130130
</UIExplorerPage>

Examples/UIExplorer/NavigatorIOSExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var NavigatorIOSExample = React.createClass({
6060
this.props.navigator.push({
6161
title: NavigatorIOSExample.title,
6262
component: NavigatorIOSExample,
63+
backButtonTitle: 'Custom Back',
6364
passProps: {topExampleRoute: this.props.topExampleRoute || this.props.route},
6465
});
6566
})}

Examples/UIExplorer/ScrollViewExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var Thumb = React.createClass({
5454

5555
var THUMBS = ['https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851549_767334479959628_274486868_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851561_767334496626293_1958532586_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851579_767334503292959_179092627_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851589_767334513292958_1747022277_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851563_767334559959620_1193692107_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851593_767334566626286_1953955109_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851591_767334523292957_797560749_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851567_767334529959623_843148472_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851548_767334489959627_794462220_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851575_767334539959622_441598241_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-ash3/t39.1997/p128x128/851573_767334549959621_534583464_n.png', 'https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/t39.1997/p128x128/851583_767334573292952_1519550680_n.png'];
5656
THUMBS = THUMBS.concat(THUMBS); // double length of THUMBS
57-
var createThumbRow = (uri, i) => <Thumb uri={uri}/>;
57+
var createThumbRow = (uri, i) => <Thumb key={i} uri={uri} />;
5858

5959
var styles = StyleSheet.create({
6060
scrollView: {

Examples/UIExplorer/UIExplorerList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ var UIExplorerList = React.createClass({
4545
);
4646
},
4747

48-
_renderRow: function(example) {
48+
_renderRow: function(example, i) {
4949
invariant(example.title, 'Example must provide a title.');
5050
return (
51-
<View>
51+
<View key={i}>
5252
<TouchableHighlight onPress={() => this._onPressRow(example)}>
5353
<View style={styles.row}>
5454
<Text style={styles.rowTitleText}>

Examples/UIExplorer/createExamplePage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var createExamplePage = function(title, exampleModule) {
2020
description: exampleModule.description,
2121
},
2222

23-
getBlock: function(example) {
23+
getBlock: function(example, i) {
2424
// Hack warning: This is a hack because the www UI explorer requires
2525
// renderComponent to be called.
2626
var originalRenderComponent = React.renderComponent;
@@ -37,6 +37,7 @@ var createExamplePage = function(title, exampleModule) {
3737
React.render = originalRender;
3838
return (
3939
<UIExplorerBlock
40+
key={i}
4041
title={example.title}
4142
description={example.description}>
4243
{renderedComponent}

Libraries/Components/ListView/ListView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ var ListView = React.createClass({
104104
initialListSize: PropTypes.number,
105105
/**
106106
* Called when all rows have been rendered and the list has been scrolled
107-
* to within onEndReachedThreashold of the bottom. The native scroll
107+
* to within onEndReachedThreshold of the bottom. The native scroll
108108
* event is provided.
109109
*/
110110
onEndReached: PropTypes.func,

Libraries/Components/Navigation/NavigatorIOS.ios.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ var NavigatorIOS = React.createClass({
179179
*/
180180
passProps: PropTypes.object,
181181

182+
/**
183+
* If set, the left header button will appear with this name. Note that
184+
* this doesn't apply for the header of the current view, but the ones
185+
* of the views that are pushed afterward.
186+
*/
187+
backButtonTitle: PropTypes.string,
188+
182189
/**
183190
* If set, the right header button will appear with this name
184191
*/
@@ -493,6 +500,7 @@ var NavigatorIOS = React.createClass({
493500
this.props.itemWrapperStyle,
494501
route.wrapperStyle
495502
]}
503+
backButtonTitle={route.backButtonTitle}
496504
rightButtonTitle={route.rightButtonTitle}
497505
onNavRightButtonTap={route.onRightButtonPress}
498506
tintColor={this.props.tintColor}>

Libraries/XMLHttpRequest/XMLHttpRequest.ios.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class XMLHttpRequest {
5858
return '';
5959
}
6060

61+
getResponseHeader(header: string): ?string {
62+
/* Stub */
63+
return '';
64+
}
65+
6166
setRequestHeader(header: string, value: any): void {
6267
this._headers[header] = value;
6368
}

0 commit comments

Comments
 (0)