Skip to content

Commit d172fd8

Browse files
authored
Merge branch 'master' into patch-1
2 parents 4f311c9 + 44955df commit d172fd8

File tree

194 files changed

+2514
-1734
lines changed

Some content is hidden

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

194 files changed

+2514
-1734
lines changed

.flowconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ suppress_type=$FlowIssue
4141
suppress_type=$FlowFixMe
4242
suppress_type=$FixMe
4343

44-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-5]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
45-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-5]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
44+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-6]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
45+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-6]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
4646
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
4747
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4848

4949
unsafe.enable_getters_and_setters=true
5050

5151
[version]
52-
^0.45.0
52+
^0.46.0

Libraries/Components/TextInput/TextInput.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const DataDetectorTypes = [
7474
* import React, { Component } from 'react';
7575
* import { AppRegistry, TextInput } from 'react-native';
7676
*
77-
* class UselessTextInput extends Component {
77+
* export default class UselessTextInput extends Component {
7878
* constructor(props) {
7979
* super(props);
8080
* this.state = { text: 'Useless Placeholder' };
@@ -91,7 +91,7 @@ const DataDetectorTypes = [
9191
* }
9292
* }
9393
*
94-
* // App registration and rendering
94+
* // skip this line if using Create React Native App
9595
* AppRegistry.registerComponent('AwesomeProject', () => UselessTextInput);
9696
* ```
9797
*
@@ -117,7 +117,7 @@ const DataDetectorTypes = [
117117
* }
118118
* }
119119
*
120-
* class UselessTextInputMultiline extends Component {
120+
* export default class UselessTextInputMultiline extends Component {
121121
* constructor(props) {
122122
* super(props);
123123
* this.state = {
@@ -145,7 +145,7 @@ const DataDetectorTypes = [
145145
* }
146146
* }
147147
*
148-
* // App registration and rendering
148+
* // skip these lines if using Create React Native App
149149
* AppRegistry.registerComponent(
150150
* 'AwesomeProject',
151151
* () => UselessTextInputMultiline

Libraries/Components/UnimplementedViews/UnimplementedView.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
/**
2-
* Common implementation for a simple stubbed view. Simply applies the view's styles to the inner
3-
* View component and renders its children.
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
48
*
59
* @providesModule UnimplementedView
10+
* @flow
611
*/
7-
812
'use strict';
913

1014
var React = require('React');
1115
var StyleSheet = require('StyleSheet');
1216

17+
/**
18+
* Common implementation for a simple stubbed view. Simply applies the view's styles to the inner
19+
* View component and renders its children.
20+
*/
1321
class UnimplementedView extends React.Component {
1422
setNativeProps = () => {
1523
// Do nothing.

Libraries/Core/InitializeCore.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ BatchedBridge.registerCallableModule('HeapCapture', require('HeapCapture'));
112112
BatchedBridge.registerCallableModule('SamplingProfiler', require('SamplingProfiler'));
113113

114114
if (__DEV__) {
115-
BatchedBridge.registerCallableModule('HMRClient', require('HMRClient'));
115+
if (!global.__RCTProfileIsProfiling) {
116+
BatchedBridge.registerCallableModule('HMRClient', require('HMRClient'));
117+
}
116118
}
117119

118120
// RCTLog needs to register with BatchedBridge
@@ -203,19 +205,23 @@ defineProperty(global, 'Set', () => require('Set'), true);
203205

204206
// Set up devtools
205207
if (__DEV__) {
206-
// not when debugging in chrome
207-
// TODO(t12832058) This check is broken
208-
if (!window.document) {
209-
require('setupDevtools');
210-
}
208+
if (!global.__RCTProfileIsProfiling) {
209+
// not when debugging in chrome
210+
// TODO(t12832058) This check is broken
211+
if (!window.document) {
212+
require('setupDevtools');
213+
}
211214

212-
require('RCTDebugComponentOwnership');
215+
require('RCTDebugComponentOwnership');
216+
}
213217
}
214218

215219
// Set up inspector
216220
if (__DEV__) {
217-
const JSInspector = require('JSInspector');
218-
JSInspector.registerAgent(require('NetworkAgent'));
221+
if (!global.__RCTProfileIsProfiling) {
222+
const JSInspector = require('JSInspector');
223+
JSInspector.registerAgent(require('NetworkAgent'));
224+
}
219225
}
220226

221227
// Just to make sure the JS gets packaged up. Wait until the JS environment has

Libraries/Image/Image.ios.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const ImageViewManager = NativeModules.ImageViewManager;
4141
* import React, { Component } from 'react';
4242
* import { AppRegistry, View, Image } from 'react-native';
4343
*
44-
* class DisplayAnImage extends Component {
44+
* export default class DisplayAnImage extends Component {
4545
* render() {
4646
* return (
4747
* <View>
@@ -57,7 +57,7 @@ const ImageViewManager = NativeModules.ImageViewManager;
5757
* }
5858
* }
5959
*
60-
* // App registration and rendering
60+
* // skip this line if using Create React Native App
6161
* AppRegistry.registerComponent('DisplayAnImage', () => DisplayAnImage);
6262
* ```
6363
*
@@ -74,7 +74,7 @@ const ImageViewManager = NativeModules.ImageViewManager;
7474
* }
7575
* });
7676
*
77-
* class DisplayAnImageWithStyle extends Component {
77+
* export default class DisplayAnImageWithStyle extends Component {
7878
* render() {
7979
* return (
8080
* <View>
@@ -87,7 +87,7 @@ const ImageViewManager = NativeModules.ImageViewManager;
8787
* }
8888
* }
8989
*
90-
* // App registration and rendering
90+
* // skip these lines if using Create React Native App
9191
* AppRegistry.registerComponent(
9292
* 'DisplayAnImageWithStyle',
9393
* () => DisplayAnImageWithStyle
@@ -96,7 +96,7 @@ const ImageViewManager = NativeModules.ImageViewManager;
9696
*
9797
* ### GIF and WebP support on Android
9898
*
99-
* By default, GIF and WebP are not supported on Android.
99+
* When building your own native code, GIF and WebP are not supported by default on Android.
100100
*
101101
* You will need to add some optional modules in `android/app/build.gradle`, depending on the needs of your app.
102102
*

Libraries/LayoutAnimation/LayoutAnimation.js

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,42 @@
88
*
99
* @providesModule LayoutAnimation
1010
* @flow
11+
* @format
1112
*/
1213
'use strict';
1314

14-
var UIManager = require('UIManager');
15+
const PropTypes = require('prop-types');
16+
const UIManager = require('UIManager');
1517

16-
var keyMirror = require('fbjs/lib/keyMirror');
18+
const keyMirror = require('fbjs/lib/keyMirror');
1719

18-
var {checkPropTypes, PropTypes} = require('react');
20+
const {checkPropTypes} = PropTypes;
1921

20-
var TypesEnum = {
22+
const TypesEnum = {
2123
spring: true,
2224
linear: true,
2325
easeInEaseOut: true,
2426
easeIn: true,
2527
easeOut: true,
2628
keyboard: true,
2729
};
28-
var Types = keyMirror(TypesEnum);
30+
const Types = keyMirror(TypesEnum);
2931

30-
var PropertiesEnum = {
32+
const PropertiesEnum = {
3133
opacity: true,
3234
scaleXY: true,
3335
};
34-
var Properties = keyMirror(PropertiesEnum);
36+
const Properties = keyMirror(PropertiesEnum);
3537

36-
var animType = PropTypes.shape({
38+
const animType = PropTypes.shape({
3739
duration: PropTypes.number,
3840
delay: PropTypes.number,
3941
springDamping: PropTypes.number,
4042
initialVelocity: PropTypes.number,
41-
type: PropTypes.oneOf(
42-
Object.keys(Types)
43-
).isRequired,
44-
property: PropTypes.oneOf( // Only applies to create/delete
45-
Object.keys(Properties)
43+
type: PropTypes.oneOf(Object.keys(Types)).isRequired,
44+
property: PropTypes.oneOf(
45+
// Only applies to create/delete
46+
Object.keys(Properties),
4647
),
4748
});
4849

@@ -53,9 +54,9 @@ type Anim = {
5354
initialVelocity?: number,
5455
type?: $Enum<typeof TypesEnum>,
5556
property?: $Enum<typeof PropertiesEnum>,
56-
}
57+
};
5758

58-
var configType = PropTypes.shape({
59+
const configType = PropTypes.shape({
5960
duration: PropTypes.number.isRequired,
6061
create: animType,
6162
update: animType,
@@ -67,7 +68,7 @@ type Config = {
6768
create?: Anim,
6869
update?: Anim,
6970
delete?: Anim,
70-
}
71+
};
7172

7273
function checkConfig(config: Config, location: string, name: string) {
7374
checkPropTypes({config: configType}, {config}, location, name);
@@ -78,7 +79,11 @@ function configureNext(config: Config, onAnimationDidEnd?: Function) {
7879
checkConfig(config, 'config', 'LayoutAnimation.configureNext');
7980
}
8081
UIManager.configureNextLayoutAnimation(
81-
config, onAnimationDidEnd || function() {}, function() { /* unused */ }
82+
config,
83+
onAnimationDidEnd || function() {},
84+
function() {
85+
/* unused */
86+
},
8287
);
8388
}
8489

@@ -99,13 +104,9 @@ function create(duration: number, type, creationProp): Config {
99104
};
100105
}
101106

102-
var Presets = {
103-
easeInEaseOut: create(
104-
300, Types.easeInEaseOut, Properties.opacity
105-
),
106-
linear: create(
107-
500, Types.linear, Properties.opacity
108-
),
107+
const Presets = {
108+
easeInEaseOut: create(300, Types.easeInEaseOut, Properties.opacity),
109+
linear: create(500, Types.linear, Properties.opacity),
109110
spring: {
110111
duration: 700,
111112
create: {
@@ -133,7 +134,7 @@ var Presets = {
133134
*
134135
* UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
135136
*/
136-
var LayoutAnimation = {
137+
const LayoutAnimation = {
137138
/**
138139
* Schedules an animation to happen on the next layout.
139140
*
@@ -157,15 +158,9 @@ var LayoutAnimation = {
157158
Properties,
158159
checkConfig,
159160
Presets,
160-
easeInEaseOut: configureNext.bind(
161-
null, Presets.easeInEaseOut
162-
),
163-
linear: configureNext.bind(
164-
null, Presets.linear
165-
),
166-
spring: configureNext.bind(
167-
null, Presets.spring
168-
),
161+
easeInEaseOut: configureNext.bind(null, Presets.easeInEaseOut),
162+
linear: configureNext.bind(null, Presets.linear),
163+
spring: configureNext.bind(null, Presets.spring),
169164
};
170165

171166
module.exports = LayoutAnimation;

Libraries/Linking/Linking.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,44 @@ const LinkingManager = Platform.OS === 'android' ?
6666
* android:launchMode="singleTask">
6767
* ```
6868
*
69-
* NOTE: On iOS you'll need to link `RCTLinking` to your project by following
69+
* NOTE: On iOS, you'll need to link `RCTLinking` to your project by following
7070
* the steps described [here](docs/linking-libraries-ios.html#manual-linking).
71-
* In case you also want to listen to incoming app links during your app's
72-
* execution you'll need to add the following lines to your `*AppDelegate.m`:
71+
* If you also want to listen to incoming app links during your app's
72+
* execution, you'll need to add the following lines to your `*AppDelegate.m`:
7373
*
7474
* ```
75+
* // iOS 10
76+
* #import <React/RCTLinkingManager.h>
77+
* - (BOOL)application:(UIApplication *)application
78+
* openURL:(NSURL *)url
79+
* options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
80+
* {
81+
*
82+
* return [RCTLinkingManager application:application openURL:url
83+
* sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
84+
* annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
85+
*
86+
* }
87+
* ```
88+
*
89+
* If you're targeting iOS 9 or older, you can use the following code instead:
90+
*
91+
* ```
92+
* // iOS 9 or older
7593
* #import <React/RCTLinkingManager.h>
7694
*
7795
* - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
7896
* sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
7997
* {
8098
* return [RCTLinkingManager application:application openURL:url
81-
* sourceApplication:sourceApplication annotation:annotation];
99+
* sourceApplication:sourceApplication annotation:annotation];
82100
* }
83-
*
84-
* // Only if your app is using [Universal Links](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html).
101+
* ```
102+
*
103+
* If your app is using [Universal Links](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html),
104+
* you'll need to add the following code as well:
105+
*
106+
* ```
85107
* - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
86108
* restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
87109
* {

0 commit comments

Comments
 (0)