Skip to content

Commit

Permalink
Merge branch 'master' into dynamic-toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-Dobell authored Jun 8, 2017
2 parents 83e2572 + 71c812a commit dcc7af6
Show file tree
Hide file tree
Showing 904 changed files with 25,152 additions and 65,682 deletions.
1 change: 0 additions & 1 deletion .buckconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
central = https://repo1.maven.org/maven2

[alias]
movies = //Examples/Movies/android/app:app
rntester = //RNTester/android/app:app
9 changes: 3 additions & 6 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js

[include]

Expand All @@ -31,8 +30,6 @@ emoji=true

module.system=haste

experimental.strict_type_args=true

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
Expand All @@ -41,12 +38,12 @@ suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-5]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
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]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

unsafe.enable_getters_and_setters=true

[version]
^0.45.0
^0.47.0
28 changes: 18 additions & 10 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
Please read the following carefully before opening a new issue.
Your issue may be closed if it does not provide the information required by this template.
Please read the following carefully. Issues that do not follow these guidelines will be closed.

We use GitHub Issues exclusively for tracking bugs in React Native.

- If you have a question, ask on Stack Overflow: http://stackoverflow.com/questions/tagged/react-native
- If you have a feature request, post it on Canny: https://react-native.canny.io/feature-requests
- Have a question? Ask on Stack Overflow: http://stackoverflow.com/questions/tagged/react-native
- Have a feature request? Submit it here: https://react-native.canny.io/feature-requests
- Want to know more about future plans? Check out the roadmap: https://github.com/facebook/react-native/wiki/Roadmap

Make sure your issue reproduces on master. Your issue may already have been fixed!
If your issue is present in master and in the stable release, try to reproduce your bug on https://snack.expo.io/
If you can't reproduce the bug on Snack, provide a sample project.
At the very least, provide an example of your code.
## Reporting Bugs

Report a single bug per issue.

### Reproducing bugs

- Always provide reproduction steps.
- Use Snack. Try to reproduce your bug on https://snack.expo.io/ first of all.
If the bug cannot be reproduced using Snack, verify that the issue can be reproduced locally by targeting the latest release candidate. Ideally, check if the issue is present in master as well.
- Do not forget to include sample code that reproduces the issue.

Issues that do not describe a bug or do not follow the template will be closed.

--- Delete everything above this line ---

Expand All @@ -21,7 +29,7 @@ Explain what you did, what you expected to happen, and what actually happens.

List all the steps required to reproduce the issue you're reporting. These steps should be clear and concise.

***An example of your code is REQUIRED***
***An example of your code or a repro using Snack is REQUIRED***


### Solution
Expand All @@ -32,5 +40,5 @@ What needs to be done to address this issue? Ideally, provide a pull request wit

* React Native version: [FILL THIS OUT: Be specific, filling out "latest" here is not enough.]
* Platform: [FILL THIS OUT: iOS, Android, or both?]
* Development Operating System: [FILL THIS OUT: Are you developing on MacOS, Linux, or Windows?]
* Development Operating System: [FILL THIS OUT: Are you developing on macOS, Linux, or Windows?]
* Dev tools: [FILL THIS OUT: Xcode or Android Studio version, iOS or Android SDK version, if applicable]
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ project.xcworkspace

# Gradle
/build/
/Examples/**/android/app/build/
/Examples/**/android/app/gradle/
/Examples/**/android/app/gradlew
/Examples/**/android/app/gradlew.bat
/RNTester/android/app/build/
/RNTester/android/app/gradle/
/RNTester/android/app/gradlew
/RNTester/android/app/gradlew.bat
/ReactAndroid/build/

# Buck
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: objective-c

osx_image: xcode8.2
osx_image: xcode8.3

install:
- mkdir -p /Users/travis/build/facebook/.nvm
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/LayoutEventsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var { TestModule } = ReactNative.NativeModules;

var deepDiffer = require('deepDiffer');

function debug() {
function debug(...args) {
// console.log.apply(null, arguments);
}

Expand Down
3 changes: 2 additions & 1 deletion Libraries/ART/ReactNativeART.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,12 @@ function extractFont(font) {
}
var fontFamily = extractSingleFontFamily(font.fontFamily);
var fontSize = +font.fontSize || 12;
var fontWeight = font.fontWeight != null ? font.fontWeight.toString() : '400';
return {
// Normalize
fontFamily: fontFamily,
fontSize: fontSize,
fontWeight: font.fontWeight,
fontWeight: fontWeight,
fontStyle: font.fontStyle,
};
}
Expand Down
13 changes: 11 additions & 2 deletions Libraries/Animated/src/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1839,10 +1839,16 @@ function createAnimatedComponent(Component: any): any {
}

render() {
const props = this._propsAnimated.__getValue();
return (
<Component
{...this._propsAnimated.__getValue()}
{...props}
ref={this._setComponentRef}
// The native driver updates views directly through the UI thread so we
// have to make sure the view doesn't get optimized away because it cannot
// go through the NativeViewHierachyManager since it operates on the shadow
// thread.
collapsable={this._propsAnimated.__isNative ? false : props.collapsable}
/>
);
}
Expand Down Expand Up @@ -2738,10 +2744,13 @@ module.exports = {
* [Origami](https://facebook.github.io/origami/). Tracks velocity state to
* create fluid motions as the `toValue` updates, and can be chained together.
*
* Config is an object that may have the following options:
* Config is an object that may have the following options. Note that you can
* only define bounciness/speed or tension/friction but not both:
*
* - `friction`: Controls "bounciness"/overshoot. Default 7.
* - `tension`: Controls speed. Default 40.
* - `speed`: Controls speed of the animation. Default 12.
* - `bounciness`: Controls bounciness. Default 8.
* - `useNativeDriver`: Uses the native driver when true. Default false.
*/
spring,
Expand Down
63 changes: 23 additions & 40 deletions Libraries/AppState/AppState.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

const EventEmitter = require('EventEmitter');
const MissingNativeEventEmitterShim = require('MissingNativeEventEmitterShim');
const NativeEventEmitter = require('NativeEventEmitter');
const NativeModules = require('NativeModules');
const RCTAppState = NativeModules.AppState;
Expand All @@ -32,8 +32,8 @@ const invariant = require('fbjs/lib/invariant');
* - `background` - The app is running in the background. The user is either
* in another app or on the home screen
* - `inactive` - This is a state that occurs when transitioning between
* foreground & background, and during periods of inactivity such as
* entering the Multitasking view or in the event of an incoming call
* foreground & background, and during periods of inactivity such as
* entering the Multitasking view or in the event of an incoming call
*
* For more information, see
* [Apple's documentation](https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html)
Expand Down Expand Up @@ -87,7 +87,7 @@ class AppState extends NativeEventEmitter {

_eventHandlers: Object;
currentState: ?string;
isAvailable: boolean;
isAvailable: boolean = true;

constructor() {
super(RCTAppState);
Expand Down Expand Up @@ -176,48 +176,31 @@ class AppState extends NativeEventEmitter {
}
}

function throwMissingNativeModule() {
invariant(
false,
'Cannot use AppState module when native RCTAppState is not included in the build.\n' +
'Either include it, or check AppState.isAvailable before calling any methods.'
);
}

class MissingNativeAppStateShim extends EventEmitter {
// AppState
isAvailable: boolean = false;
currentState: ?string = null;

addEventListener() {
throwMissingNativeModule();
}

removeEventListener() {
throwMissingNativeModule();
}
if (__DEV__ && !RCTAppState) {
class MissingNativeAppStateShim extends MissingNativeEventEmitterShim {
constructor() {
super('RCTAppState', 'AppState');
}

// EventEmitter
addListener() {
throwMissingNativeModule();
}
get currentState(): ?string {
this.throwMissingNativeModule();
}

removeAllListeners() {
throwMissingNativeModule();
}
addEventListener(...args: Array<any>) {
this.throwMissingNativeModule();
}

removeSubscription() {
throwMissingNativeModule();
removeEventListener(...args: Array<any>) {
this.throwMissingNativeModule();
}
}
}

// This module depends on the native `RCTAppState` module. If you don't include it,
// `AppState.isAvailable` will return `false`, and any method calls will throw.
// We reassign the class variable to keep the autodoc generator happy.
if (RCTAppState) {
AppState = new AppState();
} else {
// This module depends on the native `RCTAppState` module. If you don't include it,
// `AppState.isAvailable` will return `false`, and any method calls will throw.
// We reassign the class variable to keep the autodoc generator happy.
AppState = new MissingNativeAppStateShim();
} else {
AppState = new AppState();
}

module.exports = AppState;
33 changes: 24 additions & 9 deletions Libraries/BatchedBridge/MessageQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TRACE_TAG_REACT_APPS = 1 << 17;
const DEBUG_INFO_LIMIT = 32;

class MessageQueue {
_callableModules: {[key: string]: Object};
_lazyCallableModules: {[key: string]: void => Object};
_queue: [Array<number>, Array<number>, Array<any>, number];
_successCallbacks: Array<?Function>;
_failureCallbacks: Array<?Function>;
Expand All @@ -58,7 +58,7 @@ class MessageQueue {
__spy: ?(data: SpyData) => void;

constructor() {
this._callableModules = {};
this._lazyCallableModules = {};
this._queue = [[], [], [], 0];
this._successCallbacks = [];
this._failureCallbacks = [];
Expand Down Expand Up @@ -99,7 +99,6 @@ class MessageQueue {
callFunctionReturnFlushedQueue(module: string, method: string, args: Array<any>) {
this.__guard(() => {
this.__callFunction(module, method, args);
this.__callImmediates();
});

return this.flushedQueue();
Expand All @@ -109,7 +108,6 @@ class MessageQueue {
let result;
this.__guard(() => {
result = this.__callFunction(module, method, args);
this.__callImmediates();
});

return [result, this.flushedQueue()];
Expand All @@ -118,14 +116,15 @@ class MessageQueue {
invokeCallbackAndReturnFlushedQueue(cbID: number, args: Array<any>) {
this.__guard(() => {
this.__invokeCallback(cbID, args);
this.__callImmediates();
});

return this.flushedQueue();
}

flushedQueue() {
this.__callImmediates();
this.__guard(() => {
this.__callImmediates();
});

const queue = this._queue;
this._queue = [[], [], [], this._callID];
Expand All @@ -137,7 +136,23 @@ class MessageQueue {
}

registerCallableModule(name: string, module: Object) {
this._callableModules[name] = module;
this._lazyCallableModules[name] = () => module;
}

registerLazyCallableModule(name: string, factory: void => Object) {
let module: Object;
let getValue: ?(void => Object) = factory;
this._lazyCallableModules[name] = () => {
if (getValue) {
module = getValue();
getValue = null;
}
return module;
};
}

_getCallableModule(name: string) {
return this._lazyCallableModules[name]();
}

enqueueNativeCall(moduleID: number, methodID: number, params: Array<any>, onFail: ?Function, onSucc: ?Function) {
Expand Down Expand Up @@ -220,7 +235,7 @@ class MessageQueue {

__callImmediates() {
Systrace.beginEvent('JSTimersExecution.callImmediates()');
this.__guard(() => JSTimersExecution.callImmediates());
JSTimersExecution.callImmediates();
Systrace.endEvent();
}

Expand All @@ -231,7 +246,7 @@ class MessageQueue {
if (this.__spy) {
this.__spy({ type: TO_JS, module, method, args});
}
const moduleMethods = this._callableModules[module];
const moduleMethods = this._getCallableModule(module);
invariant(
!!moduleMethods,
'Module %s is not a registered callable module (calling %s)',
Expand Down
6 changes: 6 additions & 0 deletions Libraries/BatchedBridge/NativeModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) {
};
} else if (type === 'sync') {
fn = function(...args: Array<any>) {
if (__DEV__) {
invariant(global.nativeCallSyncHook, 'Calling synchronous methods on native ' +
'modules is not supported in Chrome.\n\n Consider providing alternative ' +
'methods to expose this method in debug mode, e.g. by exposing constants ' +
'ahead-of-time.');
}
return global.nativeCallSyncHook(moduleID, methodID, args);
};
} else {
Expand Down
5 changes: 4 additions & 1 deletion Libraries/CameraRoll/CameraRoll.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ class CameraRoll {
static GroupTypesOptions: Object = GROUP_TYPES_OPTIONS;
static AssetTypeOptions: Object = ASSET_TYPE_OPTIONS;

/**
* `CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.
*/
static saveImageWithTag(tag: string): Promise<Object> {
console.warn(
'CameraRoll.saveImageWithTag is deprecated. Use CameraRoll.saveToCameraRoll instead',
'`CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.',
);
return this.saveToCameraRoll(tag, 'photo');
}
Expand Down
Loading

0 comments on commit dcc7af6

Please sign in to comment.