Skip to content

Commit 976a9da

Browse files
committed
Updates from Thu 28 May
2 parents 7c0756f + 6075cef commit 976a9da

72 files changed

Lines changed: 1478 additions & 730 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eslintrc‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
{
2+
"parser": "babel-eslint",
3+
4+
"ecmaFeatures": {
5+
"jsx": true
6+
},
7+
28
"env": {
9+
"es6": true,
310
"jasmine": true,
411
},
512

13+
"plugins": [
14+
"react"
15+
],
16+
617
// Map from global var to bool specifying if it can be redefined
718
"globals": {
819
"__DEV__": true,
@@ -36,10 +47,10 @@
3647
},
3748

3849
"rules": {
50+
"comma-dangle": 0, // disallow trailing commas in object literals
3951
"no-cond-assign": 1, // disallow assignment in conditional expressions
4052
"no-console": 0, // disallow use of console (off by default in the node environment)
4153
"no-constant-condition": 0, // disallow use of constant expressions in conditions
42-
"no-comma-dangle": 0, // disallow trailing commas in object literals
4354
"no-control-regex": 1, // disallow control characters in regular expressions
4455
"no-debugger": 1, // disallow use of debugger
4556
"no-dupe-keys": 1, // disallow duplicate keys when creating object literals
@@ -107,6 +118,7 @@
107118
"no-warning-comments": 0, // disallow usage of configurable warning terms in comments": 1, // e.g. TODO or FIXME (off by default)
108119
"no-with": 1, // disallow use of the with statement
109120
"radix": 1, // require use of the second argument for parseInt() (off by default)
121+
"semi-spacing": 1, // require a space after a semi-colon
110122
"vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default)
111123
"wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default)
112124
"yoda": 1, // require or disallow Yoda conditions
@@ -177,7 +189,7 @@
177189
"space-in-parens": 0, // require or disallow spaces inside parentheses (off by default)
178190
"space-infix-ops": 1, // require spaces around operators
179191
"space-return-throw-case": 1, // require a space after return, throw, and case
180-
"space-unary-word-ops": 1, // require a space around word operators such as typeof (off by default)
192+
"space-unary-ops": [1, { "words": true, "nonwords": false }], // require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
181193
"max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default)
182194
"one-var": 0, // allow just one var statement per function (off by default)
183195
"wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default)
@@ -190,6 +202,22 @@
190202
"max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default)
191203
"max-statements": 0, // specify the maximum number of statement allowed in a function (off by default)
192204
"no-bitwise": 1, // disallow use of bitwise operators (off by default)
193-
"no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default)
205+
"no-plusplus": 0, // disallow use of unary operators, ++ and -- (off by default)
206+
207+
"react/display-name": 0,
208+
"react/jsx-boolean-value": 0,
209+
"react/jsx-quotes": [1, "double", "avoid-escape"],
210+
"react/jsx-no-undef": 1,
211+
"react/jsx-sort-props": 0,
212+
"react/jsx-uses-react": 0,
213+
"react/jsx-uses-vars": 1,
214+
"react/no-did-mount-set-state": [1, "allow-in-func"],
215+
"react/no-did-update-set-state": [1, "allow-in-func"],
216+
"react/no-multi-comp": 0,
217+
"react/no-unknown-property": 0,
218+
"react/prop-types": 0,
219+
"react/react-in-jsx-scope": 0,
220+
"react/self-closing-comp": 1,
221+
"react/wrap-multilines": 0
194222
}
195223
}

‎.flowconfig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
.*/node_modules/react-tools/src/event/EventPropagators.js
1717

1818
# Ignore commoner tests
19-
.*/node_modules/react-tools/node_modules/commoner/test/.*
19+
.*/node_modules/commoner/test/.*
2020

2121
# See https://github.com/facebook/flow/issues/442
2222
.*/react-tools/node_modules/commoner/lib/reader.js
2323

2424
# Ignore jest
25-
.*/react-native/node_modules/jest-cli/.*
25+
.*/node_modules/jest-cli/.*
2626

2727
# Ignore Website
2828
.*/website/.*

‎Examples/Movies/MovieCell.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ var MovieCell = React.createClass({
3434
var criticsScore = this.props.movie.ratings.critics_score;
3535
return (
3636
<View>
37-
<TouchableHighlight onPress={this.props.onSelect}>
37+
<TouchableHighlight
38+
onPress={this.props.onSelect}
39+
onShowUnderlay={this.props.onHighlight}
40+
onHideUnderlay={this.props.onUnhighlight}>
3841
<View style={styles.row}>
3942
<Image
4043
source={getImageSource(this.props.movie, 'det')}
@@ -54,7 +57,6 @@ var MovieCell = React.createClass({
5457
</View>
5558
</View>
5659
</TouchableHighlight>
57-
<View style={styles.cellBorder} />
5860
</View>
5961
);
6062
}

‎Examples/Movies/Movies.xcodeproj/project.pbxproj‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
140D9B661AC36C42004F25EE /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14312D241AC3654D00CDC950 /* libRCTLinking.a */; };
1717
14A2D4421AC3E43800CC738A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14A2D4411AC3E41A00CC738A /* libReact.a */; };
1818
58C5726B1AA6239E00CDF9C8 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58C5725B1AA6236500CDF9C8 /* libRCTText.a */; };
19+
67C95F201B0E64A30040BCE2 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 67C95F1E1B0E647A0040BCE2 /* libRCTWebSocket.a */; };
1920
/* End PBXBuildFile section */
2021

2122
/* Begin PBXContainerItemProxy section */
@@ -54,6 +55,13 @@
5455
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
5556
remoteInfo = RCTText;
5657
};
58+
67C95F1D1B0E647A0040BCE2 /* PBXContainerItemProxy */ = {
59+
isa = PBXContainerItemProxy;
60+
containerPortal = 67C95F151B0E647A0040BCE2 /* RCTWebSocket.xcodeproj */;
61+
proxyType = 2;
62+
remoteGlobalIDString = 3C86DF461ADF2C930047B81A;
63+
remoteInfo = RCTWebSocket;
64+
};
5765
/* End PBXContainerItemProxy section */
5866

5967
/* Begin PBXFileReference section */
@@ -69,13 +77,15 @@
6977
14312D1E1AC3654D00CDC950 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../../Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = "<group>"; };
7078
14A2D43C1AC3E41A00CC738A /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../../React/React.xcodeproj; sourceTree = "<group>"; };
7179
587650F61A9EB120008B8F17 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = SOURCE_ROOT; };
80+
67C95F151B0E647A0040BCE2 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../../Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = "<group>"; };
7281
/* End PBXFileReference section */
7382

7483
/* Begin PBXFrameworksBuildPhase section */
7584
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
7685
isa = PBXFrameworksBuildPhase;
7786
buildActionMask = 2147483647;
7887
files = (
88+
67C95F201B0E64A30040BCE2 /* libRCTWebSocket.a in Frameworks */,
7989
14A2D4421AC3E43800CC738A /* libReact.a in Frameworks */,
8090
140D9B661AC36C42004F25EE /* libRCTLinking.a in Frameworks */,
8191
1341801E1AA91750003F314A /* libRCTNetwork.a in Frameworks */,
@@ -135,6 +145,7 @@
135145
58C571FC1AA6124500CDF9C8 /* Libraries */ = {
136146
isa = PBXGroup;
137147
children = (
148+
67C95F151B0E647A0040BCE2 /* RCTWebSocket.xcodeproj */,
138149
14A2D43C1AC3E41A00CC738A /* React.xcodeproj */,
139150
14312D1E1AC3654D00CDC950 /* RCTLinking.xcodeproj */,
140151
134180151AA91740003F314A /* RCTNetwork.xcodeproj */,
@@ -152,6 +163,14 @@
152163
name = Products;
153164
sourceTree = "<group>";
154165
};
166+
67C95F161B0E647A0040BCE2 /* Products */ = {
167+
isa = PBXGroup;
168+
children = (
169+
67C95F1E1B0E647A0040BCE2 /* libRCTWebSocket.a */,
170+
);
171+
name = Products;
172+
sourceTree = "<group>";
173+
};
155174
83CBB9F61A601CBA00E9B192 = {
156175
isa = PBXGroup;
157176
children = (
@@ -228,6 +247,10 @@
228247
ProductGroup = 58C572571AA6236500CDF9C8 /* Products */;
229248
ProjectRef = 587650F61A9EB120008B8F17 /* RCTText.xcodeproj */;
230249
},
250+
{
251+
ProductGroup = 67C95F161B0E647A0040BCE2 /* Products */;
252+
ProjectRef = 67C95F151B0E647A0040BCE2 /* RCTWebSocket.xcodeproj */;
253+
},
231254
{
232255
ProductGroup = 14A2D43D1AC3E41A00CC738A /* Products */;
233256
ProjectRef = 14A2D43C1AC3E41A00CC738A /* React.xcodeproj */;
@@ -276,6 +299,13 @@
276299
remoteRef = 58C5725A1AA6236500CDF9C8 /* PBXContainerItemProxy */;
277300
sourceTree = BUILT_PRODUCTS_DIR;
278301
};
302+
67C95F1E1B0E647A0040BCE2 /* libRCTWebSocket.a */ = {
303+
isa = PBXReferenceProxy;
304+
fileType = archive.ar;
305+
path = libRCTWebSocket.a;
306+
remoteRef = 67C95F1D1B0E647A0040BCE2 /* PBXContainerItemProxy */;
307+
sourceTree = BUILT_PRODUCTS_DIR;
308+
};
279309
/* End PBXReferenceProxy section */
280310

281311
/* Begin PBXResourcesBuildPhase section */

‎Examples/Movies/SearchScreen.js‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,31 @@ var SearchScreen = React.createClass({
237237
return <ActivityIndicatorIOS style={styles.scrollSpinner} />;
238238
},
239239

240-
renderRow: function(movie: Object) {
240+
renderSeparator: function(
241+
sectionID: number | string,
242+
rowID: number | string,
243+
adjacentRowHighlighted: boolean
244+
) {
245+
var style = styles.rowSeparator;
246+
if (adjacentRowHighlighted) {
247+
style = [style, styles.rowSeparatorHide];
248+
}
249+
return (
250+
<View key={"SEP_" + sectionID + "_" + rowID} style={style}/>
251+
);
252+
},
253+
254+
renderRow: function(
255+
movie: Object,
256+
sectionID: number | string,
257+
rowID: number | string,
258+
highlightRowFunc: (sectionID: ?number | string, rowID: ?number | string) => void,
259+
) {
241260
return (
242261
<MovieCell
243262
onSelect={() => this.selectMovie(movie)}
263+
onHighlight={() => highlightRowFunc(sectionID, rowID)}
264+
onUnhighlight={() => highlightRowFunc(null, null)}
244265
movie={movie}
245266
/>
246267
);
@@ -254,6 +275,7 @@ var SearchScreen = React.createClass({
254275
/> :
255276
<ListView
256277
ref="listview"
278+
renderSeparator={this.renderSeparator}
257279
dataSource={this.state.dataSource}
258280
renderFooter={this.renderFooter}
259281
renderRow={this.renderRow}
@@ -352,6 +374,14 @@ var styles = StyleSheet.create({
352374
scrollSpinner: {
353375
marginVertical: 20,
354376
},
377+
rowSeparator: {
378+
backgroundColor: 'rgba(0, 0, 0, 0.1)',
379+
height: 1,
380+
marginLeft: 4,
381+
},
382+
rowSeparatorHide: {
383+
opacity: 0.0,
384+
},
355385
});
356386

357387
module.exports = SearchScreen;

‎Examples/SampleApp/SampleAppTests/SampleAppTests.m‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,8 @@ - (void)testRendersWelcomeScreen {
5050
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
5151

5252
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
53-
if ([view respondsToSelector:@selector(attributedText)]) {
54-
NSString *text = [(id)view attributedText].string;
55-
if ([text isEqualToString:TEXT_TO_LOOK_FOR]) {
56-
return YES;
57-
}
53+
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
54+
return YES;
5855
}
5956
return NO;
6057
}];

‎Examples/UIExplorer/AppStateIOSExample.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,19 @@ var AppStateSubscription = React.createClass({
2828
return {
2929
appState: AppStateIOS.currentState,
3030
previousAppStates: [],
31+
memoryWarnings: 0,
3132
};
3233
},
3334
componentDidMount: function() {
3435
AppStateIOS.addEventListener('change', this._handleAppStateChange);
36+
AppStateIOS.addEventListener('memoryWarning', this._handleMemoryWarning);
3537
},
3638
componentWillUnmount: function() {
3739
AppStateIOS.removeEventListener('change', this._handleAppStateChange);
40+
AppStateIOS.removeEventListener('memoryWarning', this._handleMemoryWarning);
41+
},
42+
_handleMemoryWarning: function() {
43+
this.setState({memoryWarnings: this.state.memoryWarnings + 1})
3844
},
3945
_handleAppStateChange: function(appState) {
4046
var previousAppStates = this.state.previousAppStates.slice();
@@ -45,6 +51,13 @@ var AppStateSubscription = React.createClass({
4551
});
4652
},
4753
render() {
54+
if (this.props.showMemoryWarnings) {
55+
return (
56+
<View>
57+
<Text>{this.state.memoryWarnings}</Text>
58+
</View>
59+
);
60+
}
4861
if (this.props.showCurrentOnly) {
4962
return (
5063
<View>
@@ -77,4 +90,9 @@ exports.examples = [
7790
title: 'Previous states:',
7891
render(): ReactElement { return <AppStateSubscription showCurrentOnly={false} />; }
7992
},
93+
{
94+
title: 'Memory Warnings',
95+
description: "In the simulator, hit Shift+Command+M to simulate a memory warning.",
96+
render(): ReactElement { return <AppStateSubscription showMemoryWarnings={true} />; }
97+
},
8098
];

‎Examples/UIExplorer/BorderExample.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ var styles = StyleSheet.create({
8080

8181
borderTopLeftRadius: 100,
8282
},
83+
border7: {
84+
borderRadius: 20,
85+
},
86+
border7_inner: {
87+
backgroundColor: 'blue',
88+
flex: 1,
89+
},
8390
});
8491

8592
exports.title = 'Border';
@@ -134,4 +141,15 @@ exports.examples = [
134141
return <View style={[styles.box, styles.border6]} />;
135142
}
136143
},
144+
{
145+
title: 'Custom Borders',
146+
description: 'borderRadius & clipping',
147+
render() {
148+
return (
149+
<View style={[styles.box, styles.border7]}>
150+
<View style={styles.border7_inner} />
151+
</View>
152+
);
153+
}
154+
},
137155
];

‎Examples/UIExplorer/TabBarIOSExample.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ var TabBarExample = React.createClass({
4848

4949
render: function() {
5050
return (
51-
<TabBarIOS>
51+
<TabBarIOS
52+
tintColor="black"
53+
barTintColor="#3abeff">
5254
<TabBarIOS.Item
5355
title="Blue Tab"
5456
selected={this.state.selectedTab === 'blueTab'}
-53.7 KB
Loading

0 commit comments

Comments
 (0)