Skip to content

Commit 2bd9d7d

Browse files
committed
Merge branch 'master' of github.com:facebook/react-native
2 parents da1575f + e0adedd commit 2bd9d7d

316 files changed

Lines changed: 11881 additions & 3123 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.

.flowconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
1616
.*/node_modules/react-tools/src/event/EventPropagators.js
1717

18+
# Ignore commoner tests
19+
.*/node_modules/react-tools/node_modules/commoner/test/.*
20+
21+
# See https://github.com/facebook/flow/issues/442
22+
.*/react-tools/node_modules/commoner/lib/reader.js
23+
1824
# Ignore jest
1925
.*/react-native/node_modules/jest-cli/.*
2026

@@ -29,3 +35,6 @@ Examples/UIExplorer/ImageMocks.js
2935

3036
[options]
3137
module.system=haste
38+
39+
[version]
40+
0.10.0

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cache:
77
before_install:
88
- brew update
99
install:
10-
- brew reinstall flow watchman xctool
10+
- brew reinstall flow xctool
1111
- npm config set spin=false
1212
- npm install
1313

CONTRIBUTING.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,27 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
5252

5353
### Code
5454

55-
* Use semicolons;
55+
#### General
56+
5657
* Add trailing commas,
5758
* 2 spaces for indentation (no tabs)
58-
* Prefer `'` over `"`
59-
* `'use strict';`
60-
* 80 character line length
6159
* "Attractive"
60+
61+
#### JavaScript
62+
63+
* Use semicolons;
64+
* `'use strict';`
65+
* Prefer `'` over `"`
6266
* Do not use the optional parameters of `setTimeout` and `setInterval`
67+
* 80 character line length
68+
69+
#### Objective-C
70+
71+
* Space after `@property` declarations
72+
* Brackets on *every* `if`, on the *same* line
73+
* `- method`, `@interface`, and `@implementation` brackets on the following line
74+
* *Try* to keep it around 80 characters line length (sometimes it's just not possible...)
75+
* `*` operator goes with the variable name (e.g. `NSObject *variableName;`)
6376

6477
### Documentation
6578

Examples/2048/2048/AppDelegate.m

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2222
{
2323
NSURL *jsCodeLocation;
2424

25-
// Loading JavaScript code - uncomment the one you want.
26-
27-
// OPTION 1
28-
// Load from development server. Start the server from the repository root:
29-
//
30-
// $ npm start
31-
//
32-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
33-
// iOS device are on the same Wi-Fi network.
25+
/**
26+
* Loading JavaScript code - uncomment the one you want.
27+
*
28+
* OPTION 1
29+
* Load from development server. Start the server from the repository root:
30+
*
31+
* $ npm start
32+
*
33+
* To run on device, change `localhost` to the IP address of your computer
34+
* (you can get this by typing `ifconfig` into the terminal and selecting the
35+
* `inet` value under `en0:`) and make sure your computer and iOS device are
36+
* on the same Wi-Fi network.
37+
*/
38+
3439
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/2048/Game2048.includeRequire.runModule.bundle"];
3540

36-
// OPTION 2
37-
// Load from pre-bundled file on disk. To re-generate the static bundle, run
38-
//
39-
// $ curl http://localhost:8081/Examples/2048/Game2048.includeRequire.runModule.bundle -o main.jsbundle
40-
//
41-
// and uncomment the next following line
42-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
41+
/**
42+
* OPTION 2
43+
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
44+
* to your Xcode project folder in the terminal, and run
45+
*
46+
* $ curl 'http://localhost:8081/Examples/2048/Game2048.includeRequire.runModule.bundle' -o main.jsbundle
47+
*
48+
* then add the `main.jsbundle` file to your project and uncomment this line:
49+
*/
50+
51+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
4352

4453
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4554
moduleName:@"Game2048"

Examples/Movies/Movies/AppDelegate.m

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2323
{
2424
NSURL *jsCodeLocation;
2525

26-
// Loading JavaScript code - uncomment the one you want.
26+
/**
27+
* Loading JavaScript code - uncomment the one you want.
28+
*
29+
* OPTION 1
30+
* Load from development server. Start the server from the repository root:
31+
*
32+
* $ npm start
33+
*
34+
* To run on device, change `localhost` to the IP address of your computer
35+
* (you can get this by typing `ifconfig` into the terminal and selecting the
36+
* `inet` value under `en0:`) and make sure your computer and iOS device are
37+
* on the same Wi-Fi network.
38+
*/
2739

28-
// OPTION 1
29-
// Load from development server. Start the server from the repository root:
30-
//
31-
// $ npm start
32-
//
33-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
34-
// iOS device are on the same Wi-Fi network.
3540
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle"];
3641

37-
// OPTION 2
38-
// Load from pre-bundled file on disk. To re-generate the static bundle, run
39-
//
40-
// $ curl http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle -o main.jsbundle
41-
//
42-
// and uncomment the next following line
43-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
42+
/**
43+
* OPTION 2
44+
* Load from pre-bundled file on disk. To re-generate the static bundle, `cd`
45+
* to your Xcode project folder in the terminal, and run
46+
*
47+
* $ curl 'http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle' -o main.jsbundle
48+
*
49+
* then add the `main.jsbundle` file to your project and uncomment this line:
50+
*/
51+
52+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
4453

4554
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4655
moduleName:@"MoviesApp"

Examples/Movies/SearchScreen.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ var TimerMixin = require('react-timer-mixin');
2929
var MovieCell = require('./MovieCell');
3030
var MovieScreen = require('./MovieScreen');
3131

32-
var fetch = require('fetch');
33-
3432
/**
3533
* This is for demo purposes only, and rate limited.
3634
* In case you want to use the Rotten Tomatoes' API on a real app you should

Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
1818
00E356F31AD99517003FC87E /* SampleAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* SampleAppTests.m */; };
1919
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
20+
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
2021
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
2122
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
2223
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
@@ -82,6 +83,13 @@
8283
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
8384
remoteInfo = SampleApp;
8485
};
86+
139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
87+
isa = PBXContainerItemProxy;
88+
containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
89+
proxyType = 2;
90+
remoteGlobalIDString = 134814201AA4EA6300B7C361;
91+
remoteInfo = RCTSettings;
92+
};
8593
146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
8694
isa = PBXContainerItemProxy;
8795
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
@@ -117,6 +125,7 @@
117125
00E356EE1AD99517003FC87E /* SampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
118126
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
119127
00E356F21AD99517003FC87E /* SampleAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SampleAppTests.m; sourceTree = "<group>"; };
128+
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../../Libraries/Settings/RCTSettings.xcodeproj; sourceTree = "<group>"; };
120129
13B07F961A680F5B00A75B9A /* SampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
121130
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = "<group>"; };
122131
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = "<group>"; };
@@ -142,6 +151,7 @@
142151
buildActionMask = 2147483647;
143152
files = (
144153
146834051AC3E58100842450 /* libReact.a in Frameworks */,
154+
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
145155
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */,
146156
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
147157
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */,
@@ -230,6 +240,14 @@
230240
name = "Supporting Files";
231241
sourceTree = "<group>";
232242
};
243+
139105B71AF99BAD00B5F7CC /* Products */ = {
244+
isa = PBXGroup;
245+
children = (
246+
139105C11AF99BAD00B5F7CC /* libRCTSettings.a */,
247+
);
248+
name = Products;
249+
sourceTree = "<group>";
250+
};
233251
13B07FAE1A68108700A75B9A /* SampleApp */ = {
234252
isa = PBXGroup;
235253
children = (
@@ -263,14 +281,15 @@
263281
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
264282
isa = PBXGroup;
265283
children = (
266-
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
267284
146833FF1AC3E56700842450 /* React.xcodeproj */,
268-
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
269285
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
270286
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */,
271287
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
272288
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
289+
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
273290
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
291+
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */,
292+
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
274293
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
275294
00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */,
276295
);
@@ -395,6 +414,10 @@
395414
ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
396415
ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
397416
},
417+
{
418+
ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
419+
ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
420+
},
398421
{
399422
ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
400423
ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
@@ -470,6 +493,13 @@
470493
remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
471494
sourceTree = BUILT_PRODUCTS_DIR;
472495
};
496+
139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
497+
isa = PBXReferenceProxy;
498+
fileType = archive.ar;
499+
path = libRCTSettings.a;
500+
remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */;
501+
sourceTree = BUILT_PRODUCTS_DIR;
502+
};
473503
146834041AC3E56700842450 /* libReact.a */ = {
474504
isa = PBXReferenceProxy;
475505
fileType = archive.ar;

Examples/SampleApp/SampleAppTests/SampleAppTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ - (void)testRendersWelcomeScreen {
4444
NSString *redboxError = nil;
4545

4646
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
47-
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
48-
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
47+
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48+
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
4949

5050
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
5151

Examples/SampleApp/_flowconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
1616
.*/node_modules/react-tools/src/event/EventPropagators.js
1717

18+
# Ignore commoner tests
19+
.*/node_modules/react-tools/node_modules/commoner/test/.*
20+
21+
# See https://github.com/facebook/flow/issues/442
22+
.*/react-tools/node_modules/commoner/lib/reader.js
23+
1824
# Ignore jest
1925
.*/react-native/node_modules/jest-cli/.*
2026

Examples/SampleApp/iOS/AppDelegate.m

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,33 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1717
{
1818
NSURL *jsCodeLocation;
1919

20-
// Loading JavaScript code - uncomment the one you want.
21-
22-
// OPTION 1
23-
// Load from development server. Start the server from the repository root:
24-
//
25-
// $ npm start
26-
//
27-
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
28-
// iOS device are on the same Wi-Fi network.
20+
/**
21+
* Loading JavaScript code - uncomment the one you want.
22+
*
23+
* OPTION 1
24+
* Load from development server. Start the server from the repository root:
25+
*
26+
* $ npm start
27+
*
28+
* To run on device, change `localhost` to the IP address of your computer
29+
* (you can get this by typing `ifconfig` into the terminal and selecting the
30+
* `inet` value under `en0:`) and make sure your computer and iOS device are
31+
* on the same Wi-Fi network.
32+
*/
33+
2934
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/Examples/SampleApp/index.ios.bundle"];
3035

31-
// OPTION 2
32-
// Load from pre-bundled file on disk. To re-generate the static bundle,
33-
// from the root of your project directory, run
34-
//
35-
// $ react-native bundle
36-
//
37-
// and uncomment the next following line
38-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
36+
/**
37+
* OPTION 2
38+
* Load from pre-bundled file on disk. To re-generate the static bundle
39+
* from the root of your project directory, run
40+
*
41+
* $ react-native bundle --minify
42+
*
43+
* see http://facebook.github.io/react-native/docs/runningondevice.html
44+
*/
45+
46+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
3947

4048
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4149
moduleName:@"SampleApp"

0 commit comments

Comments
 (0)