Skip to content

Commit d18a233

Browse files
committed
Merge pull request #792 from facebook/10-apr
Updates from Fri 10 Apr
2 parents 0dace35 + 096f1d9 commit d18a233

File tree

25 files changed

+607
-127
lines changed

25 files changed

+607
-127
lines changed

Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj

+30-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
1616
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
1717
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
18+
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
1819
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
1920
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
2021
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
@@ -80,6 +81,13 @@
8081
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
8182
remoteInfo = React;
8283
};
84+
78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
85+
isa = PBXContainerItemProxy;
86+
containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
87+
proxyType = 2;
88+
remoteGlobalIDString = 134814201AA4EA6300B7C361;
89+
remoteInfo = RCTLinking;
90+
};
8391
832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
8492
isa = PBXContainerItemProxy;
8593
containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
@@ -91,7 +99,6 @@
9199

92100
/* Begin PBXFileReference section */
93101
00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = ../../Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj; sourceTree = "<group>"; };
94-
00481BE91AC0C89D00671115 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
95102
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = "<group>"; };
96103
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../../Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = "<group>"; };
97104
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = ../../Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = "<group>"; };
@@ -107,6 +114,7 @@
107114
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = "<group>"; };
108115
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = "<group>"; };
109116
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../../React/React.xcodeproj; sourceTree = "<group>"; };
117+
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../../Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = "<group>"; };
110118
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
111119
/* End PBXFileReference section */
112120

@@ -121,6 +129,7 @@
121129
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */,
122130
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
123131
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
132+
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
124133
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
125134
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
126135
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
@@ -208,9 +217,18 @@
208217
name = Products;
209218
sourceTree = "<group>";
210219
};
220+
78C398B11ACF4ADC00677621 /* Products */ = {
221+
isa = PBXGroup;
222+
children = (
223+
78C398B91ACF4ADC00677621 /* libRCTLinking.a */,
224+
);
225+
name = Products;
226+
sourceTree = "<group>";
227+
};
211228
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
212229
isa = PBXGroup;
213230
children = (
231+
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
214232
146833FF1AC3E56700842450 /* React.xcodeproj */,
215233
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
216234
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
@@ -220,7 +238,6 @@
220238
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
221239
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
222240
00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */,
223-
00481BE91AC0C89D00671115 /* libicucore.dylib */,
224241
);
225242
name = Libraries;
226243
sourceTree = "<group>";
@@ -309,6 +326,10 @@
309326
ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
310327
ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
311328
},
329+
{
330+
ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
331+
ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
332+
},
312333
{
313334
ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
314335
ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
@@ -394,6 +415,13 @@
394415
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
395416
sourceTree = BUILT_PRODUCTS_DIR;
396417
};
418+
78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
419+
isa = PBXReferenceProxy;
420+
fileType = archive.ar;
421+
path = libRCTLinking.a;
422+
remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
423+
sourceTree = BUILT_PRODUCTS_DIR;
424+
};
397425
832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
398426
isa = PBXReferenceProxy;
399427
fileType = archive.ar;

Examples/UIExplorer/TextInputExample.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ exports.examples = [
251251
return (
252252
<View>
253253
<WithLabel label="true">
254-
<TextInput secureTextEntry={true} style={styles.default} value="abc" />
254+
<TextInput password={true} style={styles.default} value="abc" />
255255
</WithLabel>
256256
</View>
257257
);

Libraries/Components/Navigation/NavigatorIOS.ios.js

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var RCTNavigatorItem = createReactIOSNativeComponentClass({
5050
rightButtonTitle: true,
5151
onNavRightButtonTap: true,
5252
tintColor: true,
53+
navigationBarHidden: true,
5354
backButtonTitle: true,
5455
titleTextColor: true,
5556
style: true,
@@ -235,6 +236,11 @@ var NavigatorIOS = React.createClass({
235236

236237
}).isRequired,
237238

239+
/**
240+
* A Boolean value that indicates whether the navigation bar is hidden
241+
*/
242+
navigationBarHidden: PropTypes.bool,
243+
238244
/**
239245
* The default wrapper style for components in the navigator.
240246
* A common use case is to set the backgroundColor for every page
@@ -547,6 +553,7 @@ var NavigatorIOS = React.createClass({
547553
backButtonTitle={route.backButtonTitle}
548554
rightButtonTitle={route.rightButtonTitle}
549555
onNavRightButtonTap={route.onRightButtonPress}
556+
navigationBarHidden={this.props.navigationBarHidden}
550557
tintColor={this.props.tintColor}>
551558
<Component
552559
navigator={this.navigator}

Libraries/Components/TextInput/TextInput.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@ var TextInput = React.createClass({
198198
* automatically enables it when there is text. Default value is false.
199199
*/
200200
enablesReturnKeyAutomatically: PropTypes.bool,
201-
202-
/**
203-
* If true, the text input obscures the text entered so that sensitive text
204-
* like passwords stay secure. Default value is false.
205-
*/
206-
secureTextEntry: PropTypes.bool,
207201
/**
208202
* If true, the text input can be multiple lines. Default value is false.
209203
*/
@@ -221,11 +215,17 @@ var TextInput = React.createClass({
221215
*/
222216
onChange: PropTypes.func,
223217
onChangeText: PropTypes.func,
224-
218+
/**
219+
* Callback that is called when text input ends.
220+
*/
225221
onEndEditing: PropTypes.func,
222+
/**
223+
* Callback that is called when the text input's submit button is pressed.
224+
*/
226225
onSubmitEditing: PropTypes.func,
227226
/**
228-
* If true, the TextInput will be a password field. Default value is false.
227+
* If true, the text input obscures the text entered so that sensitive text
228+
* like passwords stay secure. Default value is false.
229229
*/
230230
password: PropTypes.bool,
231231
/**
@@ -419,7 +419,7 @@ var TextInput = React.createClass({
419419
keyboardType={keyboardType}
420420
returnKeyType={returnKeyType}
421421
enablesReturnKeyAutomatically={this.props.enablesReturnKeyAutomatically}
422-
secureTextEntry={this.props.secureTextEntry}
422+
secureTextEntry={this.props.password || this.props.secureTextEntry}
423423
onFocus={this._onFocus}
424424
onBlur={this._onBlur}
425425
onChange={this._onChange}
@@ -464,7 +464,7 @@ var TextInput = React.createClass({
464464
keyboardType={keyboardType}
465465
returnKeyType={returnKeyType}
466466
enablesReturnKeyAutomatically={this.props.enablesReturnKeyAutomatically}
467-
secureTextEntry={this.props.secureTextEntry}
467+
secureTextEntry={this.props.password || this.props.secureTextEntry}
468468
onFocus={this._onFocus}
469469
onBlur={this._onBlur}
470470
onChange={this._onChange}
@@ -505,7 +505,7 @@ var TextInput = React.createClass({
505505
onChange={this._onChange}
506506
onEndEditing={this.props.onEndEditing}
507507
onSubmitEditing={this.props.onSubmitEditing}
508-
password={this.props.password}
508+
password={this.props.password || this.props.secureTextEntry}
509509
placeholder={this.props.placeholder}
510510
value={this.state.bufferedValue}
511511
/>;

Libraries/Components/WebView/WebView.android.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ var WebViewState = keyMirror({
3434
var WebView = React.createClass({
3535

3636
propTypes: {
37-
renderError: PropTypes.func.isRequired, // view to show if there's an error
38-
renderLoading: PropTypes.func.isRequired, // loading indicator to show
37+
renderError: PropTypes.func, // view to show if there's an error
38+
renderLoading: PropTypes.func, // loading indicator to show
3939
url: PropTypes.string.isRequired,
4040
automaticallyAdjustContentInsets: PropTypes.bool,
4141
contentInset: EdgeInsetsPropType,
@@ -66,10 +66,10 @@ var WebView = React.createClass({
6666
var otherView = null;
6767

6868
if (this.state.viewState === WebViewState.LOADING) {
69-
otherView = this.props.renderLoading();
69+
otherView = this.props.renderLoading && this.props.renderLoading();
7070
} else if (this.state.viewState === WebViewState.ERROR) {
7171
var errorEvent = this.state.lastErrorEvent;
72-
otherView = this.props.renderError(
72+
otherView = this.props.renderError && this.props.renderError(
7373
errorEvent.domain,
7474
errorEvent.code,
7575
errorEvent.description);

Libraries/LinkingIOS/RCTLinkingManager.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
@interface RCTLinkingManager : NSObject <RCTBridgeModule>
1515

16-
+ (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
16+
+ (BOOL)application:(UIApplication *)application
17+
openURL:(NSURL *)URL
18+
sourceApplication:(NSString *)sourceApplication
19+
annotation:(id)annotation;
1720

1821
@end

Libraries/LinkingIOS/RCTLinkingManager.m

+9-10
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ - (void)dealloc
3737
}
3838

3939
+ (BOOL)application:(UIApplication *)application
40-
openURL:(NSURL *)url
40+
openURL:(NSURL *)URL
4141
sourceApplication:(NSString *)sourceApplication
4242
annotation:(id)annotation
4343
{
44-
NSDictionary *payload = @{@"url": [url absoluteString]};
44+
NSDictionary *payload = @{@"url": [URL absoluteString]};
4545
[[NSNotificationCenter defaultCenter] postNotificationName:RCTOpenURLNotification
4646
object:self
4747
userInfo:payload];
@@ -54,23 +54,22 @@ - (void)handleOpenURLNotification:(NSNotification *)notification
5454
body:[notification userInfo]];
5555
}
5656

57-
RCT_EXPORT_METHOD(openURL:(NSURL *)url)
57+
RCT_EXPORT_METHOD(openURL:(NSURL *)URL)
5858
{
59-
[[UIApplication sharedApplication] openURL:url];
59+
[[UIApplication sharedApplication] openURL:URL];
6060
}
6161

62-
RCT_EXPORT_METHOD(canOpenURL:(NSURL *)url
62+
RCT_EXPORT_METHOD(canOpenURL:(NSURL *)URL
6363
callback:(RCTResponseSenderBlock)callback)
6464
{
65-
BOOL supported = [[UIApplication sharedApplication] canOpenURL:url];
66-
callback(@[@(supported)]);
65+
BOOL canOpen = [[UIApplication sharedApplication] canOpenURL:URL];
66+
callback(@[@(canOpen)]);
6767
}
6868

6969
- (NSDictionary *)constantsToExport
7070
{
71-
return @{
72-
@"initialURL": [[_bridge.launchOptions objectForKey:UIApplicationLaunchOptionsURLKey] absoluteString] ?: [NSNull null]
73-
};
71+
NSURL *initialURL = _bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
72+
return @{@"initialURL": [initialURL absoluteString] ?: [NSNull null]};
7473
}
7574

7675
@end

Libraries/Network/RCTDataManager.m

+23-22
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import "RCTDataManager.h"
1111

1212
#import "RCTAssert.h"
13+
#import "RCTConvert.h"
1314
#import "RCTLog.h"
1415
#import "RCTUtils.h"
1516

@@ -22,46 +23,46 @@ @implementation RCTDataManager
2223
* The responseSender block won't be called on same thread as called.
2324
*/
2425
RCT_EXPORT_METHOD(queryData:(NSString *)queryType
25-
withQuery:(id)query
26+
withQuery:(NSDictionary *)query
2627
queryHash:(__unused NSString *)queryHash
2728
responseSender:(RCTResponseSenderBlock)responseSender)
2829
{
2930
if ([queryType isEqualToString:@"http"]) {
3031

31-
// Parse query
32-
NSDictionary *queryDict = query;
33-
if ([query isKindOfClass:[NSString class]]) {
34-
// TODO: it would be more efficient just to send a dictionary
35-
queryDict = RCTJSONParse(query, NULL);
36-
}
37-
3832
// Build request
39-
NSURL *url = [NSURL URLWithString:queryDict[@"url"]];
40-
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
41-
request.HTTPMethod = queryDict[@"method"] ?: @"GET";
42-
request.allHTTPHeaderFields = queryDict[@"headers"];
43-
if ([queryDict[@"data"] isKindOfClass:[NSString class]]) {
44-
request.HTTPBody = [queryDict[@"data"] dataUsingEncoding:NSUTF8StringEncoding];
45-
}
33+
NSURL *URL = [RCTConvert NSURL:query[@"url"]];
34+
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
35+
request.HTTPMethod = [RCTConvert NSString:query[@"method"]] ?: @"GET";
36+
request.allHTTPHeaderFields = [RCTConvert NSDictionary:query[@"headers"]];
37+
request.HTTPBody = [RCTConvert NSData:query[@"data"]];
4638

4739
// Build data task
4840
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *connectionError) {
4941

5042
// Build response
5143
NSDictionary *responseJSON;
5244
if (connectionError == nil) {
53-
NSStringEncoding encoding;
45+
NSStringEncoding encoding = NSUTF8StringEncoding;
5446
if (response.textEncodingName) {
5547
CFStringEncoding cfEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName);
5648
encoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding);
57-
} else {
58-
encoding = NSUTF8StringEncoding;
5949
}
60-
int responseCode = (int)[((NSHTTPURLResponse *)response) statusCode];
61-
NSString *returnData = [[NSString alloc] initWithData:data encoding:encoding];
62-
responseJSON = @{@"status": @(responseCode), @"responseText": returnData};
50+
NSHTTPURLResponse *httpResponse = nil;
51+
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
52+
// Might be a local file request
53+
httpResponse = (NSHTTPURLResponse *)response;
54+
}
55+
responseJSON = @{
56+
@"status": @([httpResponse statusCode] ?: 200),
57+
@"responseHeaders": [httpResponse allHeaderFields] ?: @{},
58+
@"responseText": [[NSString alloc] initWithData:data encoding:encoding] ?: @""
59+
};
6360
} else {
64-
responseJSON = @{@"status": @0, @"responseText": [connectionError localizedDescription]};
61+
responseJSON = @{
62+
@"status": @0,
63+
@"responseHeaders": @{},
64+
@"responseText": [connectionError localizedDescription]
65+
};
6566
}
6667

6768
// Send response (won't be sent on same thread as caller)

Libraries/Network/XMLHttpRequest.ios.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ class XMLHttpRequest extends XMLHttpRequestBase {
2222
sendImpl(method: ?string, url: ?string, headers: Object, data: any): void {
2323
RCTDataManager.queryData(
2424
'http',
25-
JSON.stringify({
25+
{
2626
method: method,
2727
url: url,
2828
data: data,
2929
headers: headers,
30-
}),
30+
},
31+
// TODO: Do we need this? is it used anywhere?
3132
'h' + crc32(method + '|' + url + '|' + data),
3233
(result) => {
3334
result = JSON.parse(result);

0 commit comments

Comments
 (0)