From 1b8d1d1b20bd2bf78cd6b1319224a529e586a7a0 Mon Sep 17 00:00:00 2001 From: Luis Flores Date: Tue, 7 Mar 2017 15:06:48 +0000 Subject: [PATCH 0001/1153] Fix ListViewMock unique key error Add key prop to renderHeader and renderFooter --- .../ListView/__mocks__/ListViewMock.js | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/Libraries/CustomComponents/ListView/__mocks__/ListViewMock.js b/Libraries/CustomComponents/ListView/__mocks__/ListViewMock.js index a3e5e1245373..23fc0adc0b0e 100644 --- a/Libraries/CustomComponents/ListView/__mocks__/ListViewMock.js +++ b/Libraries/CustomComponents/ListView/__mocks__/ListViewMock.js @@ -20,33 +20,46 @@ class ListViewMock extends React.Component { static defaultProps = { renderScrollComponent: (props) => , } + componentDidMount() { ListViewMock.latestRef = this; } + render() { - const {dataSource, renderFooter, renderHeader} = this.props; - const rows = [renderHeader && renderHeader()]; - const allRowIDs = dataSource.rowIdentities; - for (let sectionIdx = 0; sectionIdx < allRowIDs.length; sectionIdx++) { - const sectionID = dataSource.sectionIdentities[sectionIdx]; - const rowIDs = allRowIDs[sectionIdx]; - for (let rowIdx = 0; rowIdx < rowIDs.length; rowIdx++) { - const rowID = rowIDs[rowIdx]; - rows.push( - - ); - } - } - renderFooter && rows.push(renderFooter()); + const { dataSource, renderFooter, renderHeader } = this.props; + let rows = [renderHeader && + + ]; + + const dataSourceRows = dataSource.rowIdentities.map((rowIdentity, rowIdentityIndex) => { + const sectionID = dataSource.sectionIdentities[rowIdentityIndex]; + return rowIdentity.map((row, rowIndex) => ( + + )); + }); + + rows = [...rows, ...dataSourceRows]; + renderFooter && rows.push( + + ); + return this.props.renderScrollComponent({...this.props, children: rows}); } static DataSource = ListViewDataSource; From 7168ed295496dbfb503076737f1931eee9d6e137 Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Mon, 20 Mar 2017 04:57:35 -0700 Subject: [PATCH 0002/1153] Revert D4676282: [rn] Move idle detection classes to its own directory Differential Revision: D4676282 fbshipit-source-id: ad5ee4f2cdbe407f67cfed74af7ddec18dabff3d --- .../java/com/facebook/react/testing/BUCK | 6 +- .../{idledetection => }/IdleWaiter.java | 2 +- .../ReactAppInstrumentationTestCase.java | 2 +- .../react/testing/ReactAppTestActivity.java | 2 - .../ReactBridgeIdleSignaler.java | 2 +- .../react/testing/ReactIdleDetectionUtil.java | 2 +- .../testing/ReactIntegrationTestCase.java | 2 - .../testing/SingleTouchGestureGenerator.java | 2 - .../facebook/react/testing/idledetection/BUCK | 14 -- .../idledetection/ReactIdleDetectionUtil.java | 125 ------------------ .../java/com/facebook/react/tests/BUCK | 1 - 11 files changed, 5 insertions(+), 155 deletions(-) rename ReactAndroid/src/androidTest/java/com/facebook/react/testing/{idledetection => }/IdleWaiter.java (90%) rename ReactAndroid/src/androidTest/java/com/facebook/react/testing/{idledetection => }/ReactBridgeIdleSignaler.java (97%) delete mode 100644 ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK delete mode 100644 ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK index 6814e3aa3161..5cf6affe9a6f 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK @@ -2,10 +2,7 @@ include_defs("//ReactAndroid/DEFS") android_library( name = "testing", - srcs = glob( - ["**/*.java"], - excludes = ["idledetection/**/*.java"], - ), + srcs = glob(["**/*.java"]), visibility = [ "PUBLIC", ], @@ -28,6 +25,5 @@ android_library( react_native_target("java/com/facebook/react/modules/debug:interfaces"), react_native_target("java/com/facebook/react/shell:shell"), react_native_target("java/com/facebook/react/uimanager:uimanager"), - react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"), ], ) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IdleWaiter.java similarity index 90% rename from ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java rename to ReactAndroid/src/androidTest/java/com/facebook/react/testing/IdleWaiter.java index 1b94b7c1fc88..98884c1033a3 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IdleWaiter.java @@ -6,7 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.testing.idledetection; +package com.facebook.react.testing; /** * Interface for something that knows how to wait for bridge and UI idle. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java index eeb8c02e0671..aaba651def94 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java @@ -20,7 +20,6 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.ReactContext; -import com.facebook.react.testing.idledetection.IdleWaiter; /** * Base class for instrumentation tests that runs React based react application in UI mode @@ -124,6 +123,7 @@ public void run() { } }; + getActivity().runOnUiThread(getScreenshotRunnable); try { if (!latch.await(5000, TimeUnit.MILLISECONDS)) { diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java index 11edda17a429..022e7826c1fe 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java @@ -28,8 +28,6 @@ import com.facebook.react.common.LifecycleState; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.shell.MainReactPackage; -import com.facebook.react.testing.idledetection.ReactBridgeIdleSignaler; -import com.facebook.react.testing.idledetection.ReactIdleDetectionUtil; import com.facebook.react.uimanager.UIImplementationProvider; public class ReactAppTestActivity extends FragmentActivity implements diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactBridgeIdleSignaler.java similarity index 97% rename from ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java rename to ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactBridgeIdleSignaler.java index 4aaa451e43ab..ffd941f9a228 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactBridgeIdleSignaler.java @@ -6,7 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.testing.idledetection; +package com.facebook.react.testing; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIdleDetectionUtil.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIdleDetectionUtil.java index af6ca2ebb82a..49e2219327b9 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIdleDetectionUtil.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIdleDetectionUtil.java @@ -6,7 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.testing.idledetection; +package com.facebook.react.testing; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java index 77f5492c36ca..752c89ea6181 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java @@ -32,8 +32,6 @@ import com.facebook.react.common.futures.SimpleSettableFuture; import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.modules.core.Timing; -import com.facebook.react.testing.idledetection.ReactBridgeIdleSignaler; -import com.facebook.react.testing.idledetection.ReactIdleDetectionUtil; import com.facebook.soloader.SoLoader; import static org.mockito.Mockito.mock; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java index f0ae877a953d..278facbcb280 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java @@ -13,8 +13,6 @@ import android.view.View; import android.view.ViewConfiguration; -import com.facebook.react.testing.idledetection.IdleWaiter; - /** * Provides methods for generating touch events and dispatching them directly to a given view. * Events scenarios are based on {@link android.test.TouchUtils} but they get gets dispatched diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK deleted file mode 100644 index f6b33535737d..000000000000 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK +++ /dev/null @@ -1,14 +0,0 @@ -include_defs("//ReactAndroid/DEFS") - -android_library( - name = "idledetection", - srcs = glob(["**/*.java"]), - visibility = [ - "PUBLIC", - ], - deps = [ - react_native_dep("third-party/java/testing-support-lib:runner"), - react_native_target("java/com/facebook/react/bridge:bridge"), - react_native_target("java/com/facebook/react/modules/core:core"), - ], -) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java deleted file mode 100644 index af6ca2ebb82a..000000000000 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package com.facebook.react.testing.idledetection; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import android.app.Instrumentation; -import android.os.SystemClock; -import android.support.test.InstrumentationRegistry; - -import com.facebook.react.bridge.ReactContext; -import com.facebook.react.bridge.UiThreadUtil; -import com.facebook.react.modules.core.ChoreographerCompat; - -public class ReactIdleDetectionUtil { - - /** - * Waits for both the UI thread and bridge to be idle. It determines this by waiting for the - * bridge to become idle, then waiting for the UI thread to become idle, then checking if the - * bridge is idle again (if the bridge was idle before and is still idle after running the UI - * thread to idle, then there are no more events to process in either place). - *

- * Also waits for any Choreographer callbacks to run after the initial sync since things like UI - * events are initiated from Choreographer callbacks. - */ - public static void waitForBridgeAndUIIdle( - ReactBridgeIdleSignaler idleSignaler, - final ReactContext reactContext, - long timeoutMs) { - UiThreadUtil.assertNotOnUiThread(); - - long startTime = SystemClock.uptimeMillis(); - waitInner(idleSignaler, timeoutMs); - - long timeToWait = Math.max(1, timeoutMs - (SystemClock.uptimeMillis() - startTime)); - waitForChoreographer(timeToWait); - waitForJSIdle(reactContext); - - timeToWait = Math.max(1, timeoutMs - (SystemClock.uptimeMillis() - startTime)); - waitInner(idleSignaler, timeToWait); - timeToWait = Math.max(1, timeoutMs - (SystemClock.uptimeMillis() - startTime)); - waitForChoreographer(timeToWait); - } - - private static void waitForChoreographer(long timeToWait) { - final int waitFrameCount = 2; - final CountDownLatch latch = new CountDownLatch(1); - UiThreadUtil.runOnUiThread( - new Runnable() { - @Override - public void run() { - ChoreographerCompat.getInstance().postFrameCallback( - new ChoreographerCompat.FrameCallback() { - - private int frameCount = 0; - - @Override - public void doFrame(long frameTimeNanos) { - frameCount++; - if (frameCount == waitFrameCount) { - latch.countDown(); - } else { - ChoreographerCompat.getInstance().postFrameCallback(this); - } - } - }); - } - }); - try { - if (!latch.await(timeToWait, TimeUnit.MILLISECONDS)) { - throw new RuntimeException("Timed out waiting for Choreographer"); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static void waitForJSIdle(ReactContext reactContext) { - if (!reactContext.hasActiveCatalystInstance()) { - return; - } - final CountDownLatch latch = new CountDownLatch(1); - - reactContext.runOnJSQueueThread( - new Runnable() { - @Override - public void run() { - latch.countDown(); - } - }); - - try { - if (!latch.await(5000, TimeUnit.MILLISECONDS)) { - throw new RuntimeException("Timed out waiting for JS thread"); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static void waitInner(ReactBridgeIdleSignaler idleSignaler, long timeToWait) { - // TODO gets broken in gradle, do we need it? - Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); - long startTime = SystemClock.uptimeMillis(); - boolean bridgeWasIdle = false; - while (SystemClock.uptimeMillis() - startTime < timeToWait) { - boolean bridgeIsIdle = idleSignaler.isBridgeIdle(); - if (bridgeIsIdle && bridgeWasIdle) { - return; - } - bridgeWasIdle = bridgeIsIdle; - long newTimeToWait = Math.max(1, timeToWait - (SystemClock.uptimeMillis() - startTime)); - idleSignaler.waitForIdle(newTimeToWait); - instrumentation.waitForIdleSync(); - } - throw new RuntimeException("Timed out waiting for bridge and UI idle!"); - } -} diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK index 992351f62026..96872ba647b3 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK @@ -5,7 +5,6 @@ deps = [ react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_integration_tests_target("java/com/facebook/react/testing:testing"), - react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"), react_native_target("java/com/facebook/react:react"), react_native_target("java/com/facebook/react/bridge:bridge"), react_native_target("java/com/facebook/react/common:common"), From 5b3920567d98f4b6219b6752dd06e1a5a82f9755 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Mon, 20 Mar 2017 05:34:57 -0700 Subject: [PATCH 0003/1153] Fix indentation of polyfills/require.js Summary: Fixes the messed-up indentation of `polyfills/require.js`. Over half of the lines were indented with an odd number of spaces. Reviewed By: arcanis, bestander Differential Revision: D4737435 fbshipit-source-id: a5b9baf0a27f236a4d3d6b6c1c5a92f52859f62c --- packager/src/Resolver/polyfills/require.js | 360 ++++++++++----------- 1 file changed, 180 insertions(+), 180 deletions(-) diff --git a/packager/src/Resolver/polyfills/require.js b/packager/src/Resolver/polyfills/require.js index d532f4a90b1a..7638675a4404 100644 --- a/packager/src/Resolver/polyfills/require.js +++ b/packager/src/Resolver/polyfills/require.js @@ -10,30 +10,30 @@ * @flow */ - 'use strict'; +'use strict'; - declare var __DEV__: boolean; +declare var __DEV__: boolean; - type DependencyMap = Array; - type Exports = any; - type FactoryFn = ( +type DependencyMap = Array; +type Exports = any; +type FactoryFn = ( global: Object, require: RequireFn, moduleObject: {exports: {}}, exports: {}, dependencyMap: ?DependencyMap, ) => void; - type HotModuleReloadingAcceptFn = Function; - type HotModuleReloadingData = {| +type HotModuleReloadingAcceptFn = Function; +type HotModuleReloadingData = {| acceptCallback: ?HotModuleReloadingAcceptFn, accept: (callback: HotModuleReloadingAcceptFn) => void, |}; - type Module = { +type Module = { exports: Exports, hot?: HotModuleReloadingData, }; - type ModuleID = number; - type ModuleDefinition = {| +type ModuleID = number; +type ModuleDefinition = {| dependencyMap: ?DependencyMap, exports: Exports, factory: FactoryFn, @@ -42,247 +42,247 @@ isInitialized: boolean, verboseName?: string, |}; - type ModuleMap = +type ModuleMap = {[key: ModuleID]: (ModuleDefinition)}; - type RequireFn = (id: ModuleID | VerboseModuleNameForDev) => Exports; - type VerboseModuleNameForDev = string; +type RequireFn = (id: ModuleID | VerboseModuleNameForDev) => Exports; +type VerboseModuleNameForDev = string; - global.require = require; - global.__d = define; +global.require = require; +global.__d = define; - const modules: ModuleMap = Object.create(null); - if (__DEV__) { - var verboseNamesToModuleIds: {[key: string]: number} = Object.create(null); - } +const modules: ModuleMap = Object.create(null); +if (__DEV__) { + var verboseNamesToModuleIds: {[key: string]: number} = Object.create(null); +} - function define( +function define( factory: FactoryFn, moduleId: number, dependencyMap?: DependencyMap, ) { - if (moduleId in modules) { + if (moduleId in modules) { // prevent repeated calls to `global.nativeRequire` to overwrite modules // that are already loaded - return; - } - modules[moduleId] = { - dependencyMap, - exports: undefined, - factory, - hasError: false, - isInitialized: false, - }; - if (__DEV__) { + return; + } + modules[moduleId] = { + dependencyMap, + exports: undefined, + factory, + hasError: false, + isInitialized: false, + }; + if (__DEV__) { // HMR - modules[moduleId].hot = createHotReloadingObject(); + modules[moduleId].hot = createHotReloadingObject(); // DEBUGGABLE MODULES NAMES // we take `verboseName` from `arguments` to avoid an unused named parameter // in `define` in production. - const verboseName: string | void = arguments[3]; - if (verboseName) { - modules[moduleId].verboseName = verboseName; - verboseNamesToModuleIds[verboseName] = moduleId; - } - } - } - - function require(moduleId: ModuleID | VerboseModuleNameForDev) { - if (__DEV__ && typeof moduleId === 'string') { - const verboseName = moduleId; - moduleId = verboseNamesToModuleIds[moduleId]; - if (moduleId == null) { - throw new Error(`Unknown named module: '${verboseName}'`); - } else { - console.warn( + const verboseName: string | void = arguments[3]; + if (verboseName) { + modules[moduleId].verboseName = verboseName; + verboseNamesToModuleIds[verboseName] = moduleId; + } + } +} + +function require(moduleId: ModuleID | VerboseModuleNameForDev) { + if (__DEV__ && typeof moduleId === 'string') { + const verboseName = moduleId; + moduleId = verboseNamesToModuleIds[moduleId]; + if (moduleId == null) { + throw new Error(`Unknown named module: '${verboseName}'`); + } else { + console.warn( `Requiring module '${verboseName}' by name is only supported for ` + 'debugging purposes and will BREAK IN PRODUCTION!' ); - } - } + } + } //$FlowFixMe: at this point we know that moduleId is a number - const moduleIdReallyIsNumber: number = moduleId; - const module = modules[moduleIdReallyIsNumber]; - return module && module.isInitialized + const moduleIdReallyIsNumber: number = moduleId; + const module = modules[moduleIdReallyIsNumber]; + return module && module.isInitialized ? module.exports : guardedLoadModule(moduleIdReallyIsNumber, module); - } - - let inGuard = false; - function guardedLoadModule(moduleId: ModuleID, module) { - if (!inGuard && global.ErrorUtils) { - inGuard = true; - let returnValue; - try { - returnValue = loadModuleImplementation(moduleId, module); - } catch (e) { - global.ErrorUtils.reportFatalError(e); - } - inGuard = false; - return returnValue; - } else { - return loadModuleImplementation(moduleId, module); - } - } - - function loadModuleImplementation(moduleId, module) { - const nativeRequire = global.nativeRequire; - if (!module && nativeRequire) { - nativeRequire(moduleId); - module = modules[moduleId]; - } - - if (!module) { - throw unknownModuleError(moduleId); - } - - if (module.hasError) { - throw moduleThrewError(moduleId); - } +} + +let inGuard = false; +function guardedLoadModule(moduleId: ModuleID, module) { + if (!inGuard && global.ErrorUtils) { + inGuard = true; + let returnValue; + try { + returnValue = loadModuleImplementation(moduleId, module); + } catch (e) { + global.ErrorUtils.reportFatalError(e); + } + inGuard = false; + return returnValue; + } else { + return loadModuleImplementation(moduleId, module); + } +} + +function loadModuleImplementation(moduleId, module) { + const nativeRequire = global.nativeRequire; + if (!module && nativeRequire) { + nativeRequire(moduleId); + module = modules[moduleId]; + } + + if (!module) { + throw unknownModuleError(moduleId); + } + + if (module.hasError) { + throw moduleThrewError(moduleId); + } // `require` calls int the require polyfill itself are not analyzed and // replaced so that they use numeric module IDs. // The systrace module will expose itself on the require function so that // it can be used here. // TODO(davidaurelio) Scan polyfills for dependencies, too (t9759686) - if (__DEV__) { - var {Systrace} = require; - } + if (__DEV__) { + var {Systrace} = require; + } // We must optimistically mark module as initialized before running the // factory to keep any require cycles inside the factory from causing an // infinite require loop. - module.isInitialized = true; - const exports = module.exports = {}; - const {factory, dependencyMap} = module; - try { - if (__DEV__) { + module.isInitialized = true; + const exports = module.exports = {}; + const {factory, dependencyMap} = module; + try { + if (__DEV__) { // $FlowFixMe: we know that __DEV__ is const and `Systrace` exists - Systrace.beginEvent('JS_require_' + (module.verboseName || moduleId)); - } + Systrace.beginEvent('JS_require_' + (module.verboseName || moduleId)); + } - const moduleObject: Module = {exports}; - if (__DEV__ && module.hot) { - moduleObject.hot = module.hot; - } + const moduleObject: Module = {exports}; + if (__DEV__ && module.hot) { + moduleObject.hot = module.hot; + } // keep args in sync with with defineModuleCode in // packager/src//Resolver/index.js // and packager/src//ModuleGraph/worker.js - factory(global, require, moduleObject, exports, dependencyMap); + factory(global, require, moduleObject, exports, dependencyMap); // avoid removing factory in DEV mode as it breaks HMR - if (!__DEV__) { + if (!__DEV__) { // $FlowFixMe: This is only sound because we never access `factory` again - module.factory = undefined; - } + module.factory = undefined; + } - if (__DEV__) { + if (__DEV__) { // $FlowFixMe: we know that __DEV__ is const and `Systrace` exists - Systrace.endEvent(); - } - return (module.exports = moduleObject.exports); - } catch (e) { - module.hasError = true; - module.isInitialized = false; - module.exports = undefined; - throw e; - } - } - - function unknownModuleError(id) { - let message = 'Requiring unknown module "' + id + '".'; - if (__DEV__) { - message += + Systrace.endEvent(); + } + return (module.exports = moduleObject.exports); + } catch (e) { + module.hasError = true; + module.isInitialized = false; + module.exports = undefined; + throw e; + } +} + +function unknownModuleError(id) { + let message = 'Requiring unknown module "' + id + '".'; + if (__DEV__) { + message += 'If you are sure the module is there, try restarting the packager. ' + 'You may also want to run `npm install`, or `yarn` (depending on your environment).'; - } - return Error(message); - } + } + return Error(message); +} - function moduleThrewError(id) { - return Error('Requiring module "' + id + '", which threw an exception.'); - } +function moduleThrewError(id) { + return Error('Requiring module "' + id + '", which threw an exception.'); +} - if (__DEV__) { - require.Systrace = {beginEvent: () => {}, endEvent: () => {}}; +if (__DEV__) { + require.Systrace = {beginEvent: () => {}, endEvent: () => {}}; // HOT MODULE RELOADING - var createHotReloadingObject = function() { - const hot: HotModuleReloadingData = { - acceptCallback: null, - accept: callback => { hot.acceptCallback = callback; }, - }; - return hot; - }; - - const acceptAll = function( + var createHotReloadingObject = function() { + const hot: HotModuleReloadingData = { + acceptCallback: null, + accept: callback => { hot.acceptCallback = callback; }, + }; + return hot; + }; + + const acceptAll = function( dependentModules, inverseDependencies, ) { - if (!dependentModules || dependentModules.length === 0) { - return true; - } + if (!dependentModules || dependentModules.length === 0) { + return true; + } - const notAccepted = dependentModules.filter( + const notAccepted = dependentModules.filter( module => !accept(module, /*factory*/ undefined, inverseDependencies)); - const parents = []; - for (let i = 0; i < notAccepted.length; i++) { + const parents = []; + for (let i = 0; i < notAccepted.length; i++) { // if the module has no parents then the change cannot be hot loaded - if (inverseDependencies[notAccepted[i]].length === 0) { - return false; - } + if (inverseDependencies[notAccepted[i]].length === 0) { + return false; + } - parents.push(...inverseDependencies[notAccepted[i]]); - } + parents.push(...inverseDependencies[notAccepted[i]]); + } - return acceptAll(parents, inverseDependencies); - }; + return acceptAll(parents, inverseDependencies); + }; - const accept = function( + const accept = function( id: ModuleID, factory?: FactoryFn, inverseDependencies: {[key: ModuleID]: Array}, ) { - const mod = modules[id]; + const mod = modules[id]; - if (!mod && factory) { // new modules need a factory - define(factory, id); - return true; // new modules don't need to be accepted - } + if (!mod && factory) { // new modules need a factory + define(factory, id); + return true; // new modules don't need to be accepted + } - const {hot} = mod; - if (!hot) { - console.warn( + const {hot} = mod; + if (!hot) { + console.warn( 'Cannot accept module because Hot Module Replacement ' + 'API was not installed.' ); - return false; - } + return false; + } // replace and initialize factory - if (factory) { - mod.factory = factory; - } - mod.hasError = false; - mod.isInitialized = false; - require(id); - - if (hot.acceptCallback) { - hot.acceptCallback(); - return true; - } else { + if (factory) { + mod.factory = factory; + } + mod.hasError = false; + mod.isInitialized = false; + require(id); + + if (hot.acceptCallback) { + hot.acceptCallback(); + return true; + } else { // need to have inverseDependencies to bubble up accept - if (!inverseDependencies) { - throw new Error('Undefined `inverseDependencies`'); - } + if (!inverseDependencies) { + throw new Error('Undefined `inverseDependencies`'); + } // accept parent modules recursively up until all siblings are accepted - return acceptAll(inverseDependencies[id], inverseDependencies); - } - }; + return acceptAll(inverseDependencies[id], inverseDependencies); + } + }; - global.__accept = accept; - } + global.__accept = accept; +} From 2f92ee8a9cb95f6e67e25f2ed9061e1e255666bf Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 20 Mar 2017 05:57:48 -0700 Subject: [PATCH 0004/1153] Attempt to fix CircleCI tests Summary: Attempt to always call `mBridgeIdleListeners` on the native modules thread mBridgeIdleListeners Closes https://github.com/facebook/react-native/pull/13004 Differential Revision: D4734342 Pulled By: mkonicek fbshipit-source-id: f7054015a1d4517abab9bb8fc61402efabdd6ac1 --- .../react/cxxbridge/CatalystInstanceImpl.java | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/CatalystInstanceImpl.java b/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/CatalystInstanceImpl.java index 6133b2576765..81f2773befcb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/CatalystInstanceImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/CatalystInstanceImpl.java @@ -93,6 +93,7 @@ public PendingJSCall( private final NativeModuleRegistry mJavaRegistry; private final NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler; + private final MessageQueueThread mNativeModulesQueueThread; private boolean mInitialized = false; private volatile boolean mAcceptCalls = false; @@ -121,6 +122,7 @@ private CatalystInstanceImpl( mJSModuleRegistry = jsModuleRegistry; mJSBundleLoader = jsBundleLoader; mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler; + mNativeModulesQueueThread = mReactQueueConfiguration.getNativeModulesQueueThread(); mTraceListener = new JSProfilerTraceListener(this); FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge"); @@ -128,7 +130,7 @@ private CatalystInstanceImpl( new BridgeCallback(this), jsExecutor, mReactQueueConfiguration.getJSQueueThread(), - mReactQueueConfiguration.getNativeModulesQueueThread(), + mNativeModulesQueueThread, mJavaRegistry.getJavaModules(this), mJavaRegistry.getCxxModules()); FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge"); @@ -292,19 +294,19 @@ public void destroy() { // TODO: tell all APIs to shut down mDestroyed = true; - mReactQueueConfiguration.getNativeModulesQueueThread().runOnQueue(new Runnable() { + mNativeModulesQueueThread.runOnQueue(new Runnable() { @Override public void run() { mJavaRegistry.notifyJSInstanceDestroy(); + boolean wasIdle = (mPendingJSCalls.getAndSet(0) == 0); + if (!wasIdle && !mBridgeIdleListeners.isEmpty()) { + for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) { + listener.onTransitionToBridgeIdle(); + } + } mHybridData.resetNative(); } }); - boolean wasIdle = (mPendingJSCalls.getAndSet(0) == 0); - if (!wasIdle && !mBridgeIdleListeners.isEmpty()) { - for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) { - listener.onTransitionToBridgeIdle(); - } - } // This is a noop if the listener was not yet registered. Systrace.unregisterListener(mTraceListener); @@ -332,7 +334,7 @@ public void initialize() { mAcceptCalls, "RunJSBundle hasn't completed."); mInitialized = true; - mReactQueueConfiguration.getNativeModulesQueueThread().runOnQueue(new Runnable() { + mNativeModulesQueueThread.runOnQueue(new Runnable() { @Override public void run() { mJavaRegistry.notifyJSInstanceInitialized(); @@ -442,9 +444,14 @@ private void incrementPendingJSCalls() { mJsPendingCallsTitleForTrace, oldPendingCalls + 1); if (wasIdle && !mBridgeIdleListeners.isEmpty()) { - for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) { - listener.onTransitionToBridgeBusy(); - } + mNativeModulesQueueThread.runOnQueue(new Runnable() { + @Override + public void run() { + for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) { + listener.onTransitionToBridgeBusy(); + } + } + }); } } @@ -459,9 +466,14 @@ private void decrementPendingJSCalls() { newPendingCalls); if (isNowIdle && !mBridgeIdleListeners.isEmpty()) { - for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) { - listener.onTransitionToBridgeIdle(); - } + mNativeModulesQueueThread.runOnQueue(new Runnable() { + @Override + public void run() { + for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) { + listener.onTransitionToBridgeIdle(); + } + } + }); } } From 68c77395b182dd2d673ba60b7a9a63f585a12de7 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Mon, 20 Mar 2017 07:57:58 -0700 Subject: [PATCH 0005/1153] Allow flow-declared variables when inlining Summary: The logic of the `inline` babel transform regarded identifiers as global if no binding exists for them. We extend that logic to also accept flow-declared variables. Reviewed By: arcanis Differential Revision: D4737620 fbshipit-source-id: e71cfdf77c7b7751265cfa4412430b4f29e9e853 --- packager/package.json | 2 +- .../worker/__tests__/inline-test.js | 28 +++++++++++++++++++ packager/src/JSTransformer/worker/inline.js | 8 +++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/packager/package.json b/packager/package.json index 2ea83333e540..91de355c3be5 100644 --- a/packager/package.json +++ b/packager/package.json @@ -1,5 +1,5 @@ { - "version": "0.5.0", + "version": "0.5.1", "name": "react-native-packager", "description": "Build native apps with React!", "repository": { diff --git a/packager/src/JSTransformer/worker/__tests__/inline-test.js b/packager/src/JSTransformer/worker/__tests__/inline-test.js index d2a10f556452..a08a242f791d 100644 --- a/packager/src/JSTransformer/worker/__tests__/inline-test.js +++ b/packager/src/JSTransformer/worker/__tests__/inline-test.js @@ -306,4 +306,32 @@ describe('inline constants', () => { expect(toString(ast)).toEqual( normalize(code.replace(/require\([^)]+\)\.Platform\.OS/, '"android"'))); }); + + it('works with flow-declared variables', () => { + const stripFlow = require('babel-plugin-transform-flow-strip-types'); + const code = `declare var __DEV__; + const a: boolean = __DEV__;`; + + const transformed = transform( + code, + {...babelOptions, plugins: [stripFlow, [inline.plugin, {dev: false}]]}, + ).code; + + expect(transformed).toEqual('const a=false;'); + }); + + it('works with flow-declared variables in wrapped modules', () => { + const stripFlow = require('babel-plugin-transform-flow-strip-types'); + const code = `__d(() => { + declare var __DEV__; + const a: boolean = __DEV__; + });`; + + const transformed = transform( + code, + {...babelOptions, plugins: [stripFlow, [inline.plugin, {dev: true}]]}, + ).code; + + expect(transformed).toEqual('__d(()=>{const a=true;});'); + }); }); diff --git a/packager/src/JSTransformer/worker/inline.js b/packager/src/JSTransformer/worker/inline.js index 1b14bcdcbc89..91811a1f8644 100644 --- a/packager/src/JSTransformer/worker/inline.js +++ b/packager/src/JSTransformer/worker/inline.js @@ -34,6 +34,12 @@ const importMap = new Map([['ReactNative', 'react-native']]); const isGlobal = binding => !binding; +const isFlowDeclared = binding => + t.isDeclareVariable(binding.path); + +const isGlobalOrFlowDeclared = binding => + isGlobal(binding) || isFlowDeclared(binding); + const isToplevelBinding = (binding, isWrappedModule) => isGlobal(binding) || !binding.scope.parent || @@ -93,7 +99,7 @@ const isReactPlatformSelect = (node, scope, isWrappedModule) => const isDev = (node, parent, scope) => t.isIdentifier(node, dev) && - isGlobal(scope.getBinding(dev.name)) && + isGlobalOrFlowDeclared(scope.getBinding(dev.name)) && !(t.isMemberExpression(parent)); function findProperty(objectExpression, key, fallback) { From 14fee735a2fde73f1e505543ee40af0df66f63aa Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Mon, 20 Mar 2017 08:24:31 -0700 Subject: [PATCH 0006/1153] Use verbose module name when requiring module that errored Summary: When requiring a module that has previously errored, the implementation of `require` only used the numerical module ID. In this diff, we enable usage of the verbose module name if present. Reviewed By: bestander Differential Revision: D4737723 fbshipit-source-id: 1c2d3906435a637f3e440e57f904489d84495bd2 --- packager/src/Resolver/polyfills/require.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packager/src/Resolver/polyfills/require.js b/packager/src/Resolver/polyfills/require.js index 7638675a4404..655d762ac0a6 100644 --- a/packager/src/Resolver/polyfills/require.js +++ b/packager/src/Resolver/polyfills/require.js @@ -202,7 +202,8 @@ function unknownModuleError(id) { } function moduleThrewError(id) { - return Error('Requiring module "' + id + '", which threw an exception.'); + const displayName = __DEV__ && modules[id] && modules[id].verboseName || id; + return Error('Requiring module "' + displayName + '", which threw an exception.'); } if (__DEV__) { From c451dd6cceb526d4814993e4d0eb431375a9b01c Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 20 Mar 2017 10:37:58 -0700 Subject: [PATCH 0007/1153] Update message with instructions Summary: The middleware for automatically converting Systrace traces to HTML and popping the browser hasn't worked properly for a while, since the version on Homebrew generates some code that uses `Object.observe`, which was deleted from Chrome ages ago. People have complained about it, but fixing it properly has proven to be harder than expected, so I suggest we simply update the message with instructions for people to load it on Chrome, which is what all of us have been doing anyway (AFAIK). Closes https://github.com/facebook/react-native/pull/12445 Reviewed By: javache Differential Revision: D4700153 Pulled By: gaearon fbshipit-source-id: 0c33099babed93b3c70d36ae9dfc7d82460c8269 --- .../middleware/systraceProfileMiddleware.js | 37 ++++--------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/local-cli/server/middleware/systraceProfileMiddleware.js b/local-cli/server/middleware/systraceProfileMiddleware.js index 02b274c9e7a4..a06f0100a9dd 100644 --- a/local-cli/server/middleware/systraceProfileMiddleware.js +++ b/local-cli/server/middleware/systraceProfileMiddleware.js @@ -8,9 +8,7 @@ */ 'use strict'; -const exec = require('child_process').exec; const fs = require('fs'); -const path = require('path'); module.exports = function(req, res, next) { if (req.url !== '/systrace') { @@ -20,33 +18,12 @@ module.exports = function(req, res, next) { console.log('Dumping profile information...'); var dumpName = '/tmp/dump_' + Date.now() + '.json'; - var prefix = process.env.TRACE_VIEWER_PATH || ''; - var cmd = path.join(prefix, 'trace2html') + ' ' + dumpName; fs.writeFileSync(dumpName, req.rawBody); - exec(cmd, function(error) { - if (error) { - if (error.code === 127) { - var response = '\n** Failed executing `' + cmd + '` **\n\n' + - 'Google trace-viewer is required to visualize the data, ' + - 'You can install it with `brew install trace2html`\n\n' + - 'NOTE: Your profile data was kept at:\n' + dumpName; - console.log(response); - res.end(response); - } else { - console.error(error); - res.end('Unknown error: ' + error.message); - } - return; - } else { - exec('rm ' + dumpName); - exec('open ' + dumpName.replace(/json$/, 'html'), function(err) { - if (err) { - console.error(err); - res.end(err.message); - } else { - res.end(); - } - }); - } - }); + var response = + 'Your profile was saved at:\n' + dumpName + '\n\n' + + 'On Google Chrome navigate to chrome://tracing and then click on "load" ' + + 'to load and visualise your profile.\n\n' + + 'This message is also printed to your console by the packager so you can copy it :)'; + console.log(response); + res.end(response); }; From 439889262c9055faa3582a18441029ea063a7a6b Mon Sep 17 00:00:00 2001 From: Jeff Thomas Date: Mon, 20 Mar 2017 11:48:04 -0700 Subject: [PATCH 0008/1153] RCTLocalAssetImageLoader: Add searching shipped frameworks beyond mainBundle Reviewed By: javache Differential Revision: D4715608 fbshipit-source-id: 5cb2febf543e2ff6e30d0c6d8737de9a2cce2383 --- React/Base/RCTUtils.m | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index 80ff69ed538d..130c5b1b3589 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -637,7 +637,7 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) NSString *imageName = RCTBundlePathForURL(imageURL); - NSBundle *bundle; + NSBundle *bundle = nil; NSArray *imagePathComponents = [imageName pathComponents]; if ([imagePathComponents count] > 1 && [[[imagePathComponents firstObject] pathExtension] isEqualToString:@"bundle"]) { @@ -646,11 +646,30 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) imageName = [imageName substringFromIndex:(bundlePath.length + 1)]; } + UIImage *image = nil; if (bundle) { - return [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; + image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; } else { - return [UIImage imageNamed:imageName]; + image = [UIImage imageNamed:imageName]; + } + + if (!image && !bundle) { + // We did not find the image in the mainBundle, check in other shipped frameworks. + NSArray *possibleFrameworks = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:[[NSBundle mainBundle] privateFrameworksURL] + includingPropertiesForKeys:@[] + options:nil + error:nil]; + for (NSURL *frameworkURL in possibleFrameworks) { + bundle = [NSBundle bundleWithURL:frameworkURL]; + image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; + if (image) { + RCTLogWarn(@"Image %@ not found in mainBundle, but found in %@", imageName, bundle); + break; + } + } } + + return image; } RCT_EXTERN NSString *__nullable RCTTempFilePath(NSString *extension, NSError **error) From f352aa129a0264671d7e294a1f895eb1beddc3f1 Mon Sep 17 00:00:00 2001 From: Jhen Date: Mon, 20 Mar 2017 12:40:16 -0700 Subject: [PATCH 0009/1153] Add missing `toggleElementInspector` event send when `jsLoaded` Summary: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. The PR #11613 (0.43) removed this missing `toggleElementInspector` event send when `jsLoaded` in DevMenu (Now is DevSettings), it should open the inspector if `isElementInspectorShown` is true when we reload JS. The dev menu text `Show / Hide Inspector` is dependent on `isElementInspectorShown` bool value. ([This behavior in 0.42](https://github.com/facebook/react-native/blob/0.42-stable/React/Modules/RCTDevMenu.mm#L436-L442)) Manual testing in UIExplorer: * Open the dev menu and click `Show Inspector` * Open the dev menu and click `Reload JS` * The built-in inspector should keep open (dev menu text: `Hide Inspector`) Closes https://github.com/facebook/react-native/pull/12999 Differential Revision: D4738959 Pulled By: javache fbshipit-source-id: b3f584db51aa0e1b463c52003967b00bcd81bc99 --- React/Modules/RCTDevSettings.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/React/Modules/RCTDevSettings.mm b/React/Modules/RCTDevSettings.mm index 171b25320949..d97aa6031fee 100644 --- a/React/Modules/RCTDevSettings.mm +++ b/React/Modules/RCTDevSettings.mm @@ -454,6 +454,14 @@ - (void)jsLoaded:(NSNotification *)notification dispatch_async(dispatch_get_main_queue(), ^{ // update state again after the bridge has finished loading [self _synchronizeAllSettings]; + + // Inspector can only be shown after JS has loaded + if ([self isElementInspectorShown]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self.bridge.eventDispatcher sendDeviceEventWithName:@"toggleElementInspector" body:nil]; +#pragma clang diagnostic pop + } }); } From 08c404d2939a3c2e75a514da1a7c03151fbb30e7 Mon Sep 17 00:00:00 2001 From: Daniele Conti Date: Mon, 20 Mar 2017 12:40:45 -0700 Subject: [PATCH 0010/1153] Eagerly change the listeners count Summary: While working with `RCTEventEmitter` I noticed that if an event is emitted before `_listenerCount` is updated, it will not go through because the listeners count hasn't been updated. Moving the count update before the invokation of `startObserving` and `stopObserving` fixes the issue. Same way if you remove the last listener and an event is fired before the count is updated (while it shouldn't be fired). **Test plan (required)** An easy test to demonstrate it is to implement `startObserving` to synchronously fire an event. Without the change, a warning is thrown, with the change, the event is fired. Not very strong on Obj-C here and I didn't know how to mock out the native stuff. Would be glad to write a failing unit test tho :) Closes https://github.com/facebook/react-native/pull/11907 Differential Revision: D4738965 Pulled By: javache fbshipit-source-id: cf175051be5b9c5de761d3dcd290560e1639b05e --- React/Modules/RCTEventEmitter.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/React/Modules/RCTEventEmitter.m b/React/Modules/RCTEventEmitter.m index 4cfec65755b1..9f54f1f499dc 100644 --- a/React/Modules/RCTEventEmitter.m +++ b/React/Modules/RCTEventEmitter.m @@ -78,10 +78,10 @@ - (void)dealloc RCTLogError(@"`%@` is not a supported event type for %@. Supported events are: `%@`", eventName, [self class], [[self supportedEvents] componentsJoinedByString:@"`, `"]); } - if (_listenerCount == 0) { + _listenerCount++; + if (_listenerCount == 1) { [self startObserving]; } - _listenerCount++; } RCT_EXPORT_METHOD(removeListeners:(NSInteger)count) @@ -89,10 +89,10 @@ - (void)dealloc if (RCT_DEBUG && count > _listenerCount) { RCTLogError(@"Attempted to remove more %@ listeners than added", [self class]); } - if (count == _listenerCount) { + _listenerCount = MAX(_listenerCount - count, 0); + if (_listenerCount == 0) { [self stopObserving]; } - _listenerCount -= count; } @end From 242a58ffe08bf89ec4156ddc0bda89055f410886 Mon Sep 17 00:00:00 2001 From: Petter Hesselberg Date: Mon, 20 Mar 2017 12:44:41 -0700 Subject: [PATCH 0011/1153] Fix NullPointerException in ReactShadowNode.toString() Summary: Fix `NullPointerException` in `ReactShadowNode.toString` Simplified `ReactShadowNode.hasNewLayout` since I was already in there It seems to me unlikely that this bug impacts anything but the debugging experience, so no biggie. Closes https://github.com/facebook/react-native/pull/12953 Differential Revision: D4739215 fbshipit-source-id: 94955cc783216fdb8868fc8d08010e0d8a238052 --- .../com/facebook/react/uimanager/ReactShadowNode.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java index 2cad696e5028..d8c34346f261 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java @@ -372,7 +372,7 @@ public void calculateLayout() { } public final boolean hasNewLayout() { - return mYogaNode == null ? false : mYogaNode.hasNewLayout(); + return mYogaNode != null && mYogaNode.hasNewLayout(); } public final void markLayoutSeen() { @@ -770,7 +770,11 @@ public void setMeasureFunction(YogaMeasureFunction measureFunction) { @Override public String toString() { - return mYogaNode.toString(); + if (mYogaNode != null) { + return mYogaNode.toString(); + } + + return getClass().getSimpleName() + " (virtual node)"; } public void dispose() { From ebb55c6bcc05f60aa04f9ca08a872a73b17832be Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Mon, 20 Mar 2017 12:50:20 -0700 Subject: [PATCH 0012/1153] log difference in QPL vs PerformanceLogger Reviewed By: alexeylang Differential Revision: D4736500 fbshipit-source-id: e5f8590ae7482dbfbbe64403b0162fb496572ac6 --- Libraries/Utilities/PerformanceLogger.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/Utilities/PerformanceLogger.js b/Libraries/Utilities/PerformanceLogger.js index fd77037d890c..053abb9ae6c6 100644 --- a/Libraries/Utilities/PerformanceLogger.js +++ b/Libraries/Utilities/PerformanceLogger.js @@ -108,6 +108,10 @@ var PerformanceLogger = { extras = {}; }, + currentTimestamp() { + return performanceNow(); + }, + getTimespans() { return timespans; }, From d7314661fb4930f0c9e01ccc8de21be1f53d6f54 Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Mon, 20 Mar 2017 12:56:30 -0700 Subject: [PATCH 0013/1153] Don't swallow the error if a module require fails Reviewed By: davidaurelio Differential Revision: D4733269 fbshipit-source-id: 2cca14c023b148b62cf24f204cdb355f8d2f3590 --- packager/src/Resolver/polyfills/require.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packager/src/Resolver/polyfills/require.js b/packager/src/Resolver/polyfills/require.js index 655d762ac0a6..3c1f0b24bad4 100644 --- a/packager/src/Resolver/polyfills/require.js +++ b/packager/src/Resolver/polyfills/require.js @@ -38,6 +38,7 @@ type ModuleDefinition = {| exports: Exports, factory: FactoryFn, hasError: boolean, + error?: any, hot?: HotModuleReloadingData, isInitialized: boolean, verboseName?: string, @@ -138,7 +139,7 @@ function loadModuleImplementation(moduleId, module) { } if (module.hasError) { - throw moduleThrewError(moduleId); + throw moduleThrewError(moduleId, module.error); } // `require` calls int the require polyfill itself are not analyzed and @@ -185,6 +186,7 @@ function loadModuleImplementation(moduleId, module) { return (module.exports = moduleObject.exports); } catch (e) { module.hasError = true; + module.error = e; module.isInitialized = false; module.exports = undefined; throw e; @@ -201,9 +203,9 @@ function unknownModuleError(id) { return Error(message); } -function moduleThrewError(id) { +function moduleThrewError(id, error: any) { const displayName = __DEV__ && modules[id] && modules[id].verboseName || id; - return Error('Requiring module "' + displayName + '", which threw an exception.'); + return Error('Requiring module "' + displayName + '", which threw an exception: ' + error); } if (__DEV__) { From 9344f3a95b56833d29cd18438a94a0c22f67b0f8 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Mon, 20 Mar 2017 12:58:08 -0700 Subject: [PATCH 0014/1153] Support string return type from RN createReactNativeFiberComponentClass() Reviewed By: sebmarkbage Differential Revision: D4607283 fbshipit-source-id: 466d2373dd570f77ebcced306d2f20a3f72d79c6 --- Libraries/Components/TextInput/TextInput.js | 7 - Libraries/Components/View/View.js | 19 +- Libraries/ReactNative/UIManager.js | 23 +- .../ReactNative/requireNativeComponent.js | 2 +- .../renderers/native/NativeMethodsMixin.js | 206 +++++++++++------- .../native/NativeMethodsMixinUtils.js | 100 +++++++++ .../src/renderers/native/ReactNative.js | 2 +- .../src/renderers/native/ReactNativeFiber.js | 44 ++-- .../native/ReactNativeFiberHostComponent.js | 108 +++++++++ .../src/renderers/native/ReactNativeStack.js | 18 +- .../native/ReactNativeStackInjection.js | 4 +- .../native/createReactNativeComponentClass.js | 16 +- .../src/renderers/native/findNodeHandle.js | 5 +- 13 files changed, 424 insertions(+), 130 deletions(-) create mode 100644 Libraries/Renderer/src/renderers/native/NativeMethodsMixinUtils.js create mode 100644 Libraries/Renderer/src/renderers/native/ReactNativeFiberHostComponent.js diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index c3c9eff2b4ae..3f01022cb6c4 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -540,13 +540,6 @@ const TextInput = React.createClass({ */ mixins: [NativeMethodsMixin, TimerMixin], - viewConfig: - ((Platform.OS === 'ios' && RCTTextField ? - RCTTextField.viewConfig : - (Platform.OS === 'android' && AndroidTextInput ? - AndroidTextInput.viewConfig : - {})) : Object), - /** * Returns `true` if the input is currently focused; `false` otherwise. */ diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index a519dfbb6b1e..385ffb124a48 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -16,6 +16,7 @@ const NativeMethodsMixin = require('NativeMethodsMixin'); const NativeModules = require('NativeModules'); const Platform = require('Platform'); const React = require('React'); +const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags'); const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes'); const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); const StyleSheetPropType = require('StyleSheetPropType'); @@ -119,6 +120,9 @@ const View = React.createClass({ ...statics, }, + // TODO (bvaughn) Replace this with a deprecated getter warning. This object + // should be accessible via a separate import. It will not be available in + // production mode in the future and so should not be directly accessed. propTypes: { ...TVViewPropTypes, @@ -536,11 +540,20 @@ if (__DEV__) { } } +// TODO (bvaughn) Remove feature flags once all static View accessors are gone. +// We temporarily wrap fiber native views with the create-class View above, +// Because external code sometimes accesses static properties of this view. let ViewToExport = RCTView; -if (__DEV__) { +if ( + __DEV__ || + ReactNativeFeatureFlags.useFiber +) { ViewToExport = View; } else { - Object.assign(RCTView, statics); + // TODO (bvaughn) Remove this mixin once all static View accessors are gone. + Object.assign((RCTView : any), statics); } -module.exports = ViewToExport; +// TODO (bvaughn) Temporarily mask Flow warnings for View property accesses. +// We're wrapping the string type (Fiber) for now to avoid any actual problems. +module.exports = ((ViewToExport : any) : typeof View); diff --git a/Libraries/ReactNative/UIManager.js b/Libraries/ReactNative/UIManager.js index ee2fc4b8625c..3b131de7041c 100644 --- a/Libraries/ReactNative/UIManager.js +++ b/Libraries/ReactNative/UIManager.js @@ -26,6 +26,27 @@ invariant(UIManager, 'UIManager is undefined. The native module config is probab const _takeSnapshot = UIManager.takeSnapshot; +// findNodeHandle() returns a reference to a wrapper component with viewConfig. +// This wrapper is required for NativeMethodsMixin.setNativeProps, but most +// callers want the native tag (number) and not the wrapper. For this purpose, +// the ReactNative renderer decorates findNodeHandle() and extracts the tag. +// However UIManager can't require ReactNative without introducing a cycle, and +// deferring the require causes a significant performance regression in Wilde +// (along the lines of 17% regression in RN Bridge startup). So as a temporary +// workaround, this wrapper method mimics what the native renderer does. +// TODO (bvaughn) Remove this and use findNodeHandle directly once stack is gone +function findNodeHandleWrapper(componentOrHandle : any) : ?number { + const instance: any = findNodeHandle(componentOrHandle); + + if (instance) { + return typeof instance._nativeTag === 'number' + ? instance._nativeTag + : instance.getHostNode(); + } else { + return null; + } +} + /** * Capture an image of the screen, window or an individual view. The image * will be stored in a temporary file that will only exist for as long as the @@ -57,7 +78,7 @@ UIManager.takeSnapshot = async function( return; } if (typeof view !== 'number' && view !== 'window') { - view = findNodeHandle(view) || 'window'; + view = findNodeHandleWrapper(view) || 'window'; } return _takeSnapshot(view, options); }; diff --git a/Libraries/ReactNative/requireNativeComponent.js b/Libraries/ReactNative/requireNativeComponent.js index c404e60bf66a..682a8240c57b 100644 --- a/Libraries/ReactNative/requireNativeComponent.js +++ b/Libraries/ReactNative/requireNativeComponent.js @@ -46,7 +46,7 @@ function requireNativeComponent( viewName: string, componentInterface?: ?ComponentInterface, extraConfig?: ?{nativeOnly?: Object}, -): Function { +): ReactClass | string { const viewConfig = UIManager[viewName]; if (!viewConfig || !viewConfig.NativeProps) { warning(false, 'Native component for "%s" does not exist', viewName); diff --git a/Libraries/Renderer/src/renderers/native/NativeMethodsMixin.js b/Libraries/Renderer/src/renderers/native/NativeMethodsMixin.js index aa7af7f066a0..f3d0570a2461 100644 --- a/Libraries/Renderer/src/renderers/native/NativeMethodsMixin.js +++ b/Libraries/Renderer/src/renderers/native/NativeMethodsMixin.js @@ -13,45 +13,25 @@ var ReactNative = require('ReactNative'); var ReactNativeAttributePayload = require('ReactNativeAttributePayload'); +var ReactNativeFeatureFlags = require('ReactNativeFeatureFlags'); var TextInputState = require('TextInputState'); var UIManager = require('UIManager'); var invariant = require('fbjs/lib/invariant'); +var findNodeHandle = require('findNodeHandle'); -type MeasureOnSuccessCallback = ( - x: number, - y: number, - width: number, - height: number, - pageX: number, - pageY: number -) => void - -type MeasureInWindowOnSuccessCallback = ( - x: number, - y: number, - width: number, - height: number, -) => void - -type MeasureLayoutOnSuccessCallback = ( - left: number, - top: number, - width: number, - height: number -) => void - -function warnForStyleProps(props, validAttributes) { - for (var key in validAttributes.style) { - if (!(validAttributes[key] || props[key] === undefined)) { - console.error( - 'You are setting the style `{ ' + key + ': ... }` as a prop. You ' + - 'should nest it in a style object. ' + - 'E.g. `{ style: { ' + key + ': ... } }`' - ); - } - } -} +var { + mountSafeCallback, + throwOnStylesProp, + warnForStyleProps, +} = require('NativeMethodsMixinUtils'); + +import type { + MeasureInWindowOnSuccessCallback, + MeasureLayoutOnSuccessCallback, + MeasureOnSuccessCallback, +} from 'NativeMethodsMixinUtils'; +import type { ReactNativeBaseComponentViewConfig } from 'ReactNativeViewConfigRegistry'; /** * `NativeMethodsMixin` provides methods to access the underlying native @@ -65,6 +45,10 @@ function warnForStyleProps(props, validAttributes) { * information, see [Direct * Manipulation](docs/direct-manipulation.html). */ +// TODO (bvaughn) Figure out how to use the NativeMethodsInterface type to- +// ensure that these mixins and ReactNativeFiberHostComponent stay in sync. +// Unfortunately, using it causes Flow to complain WRT createClass mixins: +// "call of method `createClass`. Expected an exact object instead of ..." var NativeMethodsMixin = { /** * Determines the location on screen, width, and height of the given view and @@ -140,20 +124,15 @@ var NativeMethodsMixin = { * Manipulation](docs/direct-manipulation.html)). */ setNativeProps: function(nativeProps: Object) { - if (__DEV__) { - warnForStyleProps(nativeProps, this.viewConfig.validAttributes); - } + // Ensure ReactNative factory function has configured findNodeHandle. + // Requiring it won't execute the factory function until first referenced. + // It's possible for tests that use ReactTestRenderer to reach this point, + // Without having executed ReactNative. + // Defer the factory function until now to avoid a cycle with UIManager. + // TODO (bvaughn) Remove this once ReactNativeStack is dropped. + require('ReactNative'); - var updatePayload = ReactNativeAttributePayload.create( - nativeProps, - this.viewConfig.validAttributes - ); - - UIManager.updateView( - (ReactNative.findNodeHandle(this) : any), - this.viewConfig.uiViewClassName, - updatePayload - ); + injectedSetNativeProps(this, nativeProps); }, /** @@ -172,19 +151,116 @@ var NativeMethodsMixin = { }, }; -function throwOnStylesProp(component, props) { - if (props.styles !== undefined) { - var owner = component._owner || null; - var name = component.constructor.displayName; - var msg = '`styles` is not a supported property of `' + name + '`, did ' + - 'you mean `style` (singular)?'; - if (owner && owner.constructor && owner.constructor.displayName) { - msg += '\n\nCheck the `' + owner.constructor.displayName + '` parent ' + - ' component.'; +// TODO (bvaughn) Inline this once ReactNativeStack is dropped. +function setNativePropsFiber(componentOrHandle: any, nativeProps: Object) { + // Class components don't have viewConfig -> validateAttributes. + // Nor does it make sense to set native props on a non-native component. + // Instead, find the nearest host component and set props on it. + // Use findNodeHandle() rather than ReactNative.findNodeHandle() because + // We want the instance/wrapper (not the native tag). + let maybeInstance; + + // Fiber errors if findNodeHandle is called for an umounted component. + // Tests using ReactTestRenderer will trigger this case indirectly. + // Mimicking stack behavior, we should silently ignore this case. + // TODO Fix ReactTestRenderer so we can remove this try/catch. + try { + maybeInstance = findNodeHandle(componentOrHandle); + } catch (error) {} + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + const viewConfig : ReactNativeBaseComponentViewConfig = + maybeInstance.viewConfig; + + if (__DEV__) { + warnForStyleProps(nativeProps, viewConfig.validAttributes); + } + + var updatePayload = ReactNativeAttributePayload.create( + nativeProps, + viewConfig.validAttributes, + ); + + UIManager.updateView( + maybeInstance._nativeTag, + viewConfig.uiViewClassName, + updatePayload, + ); +} + +// TODO (bvaughn) Remove this once ReactNativeStack is dropped. +function setNativePropsStack(componentOrHandle: any, nativeProps: Object) { + // Class components don't have viewConfig -> validateAttributes. + // Nor does it make sense to set native props on a non-native component. + // Instead, find the nearest host component and set props on it. + // Use findNodeHandle() rather than ReactNative.findNodeHandle() because + // We want the instance/wrapper (not the native tag). + let maybeInstance = findNodeHandle(componentOrHandle); + + // If there is no host component beneath this we should fail silently. + // This is not an error; it could mean a class component rendered null. + if (maybeInstance == null) { + return; + } + + let viewConfig : ReactNativeBaseComponentViewConfig; + if (maybeInstance.viewConfig !== undefined) { + // ReactNativeBaseComponent + viewConfig = maybeInstance.viewConfig; + } else if ( + maybeInstance._instance !== undefined && + maybeInstance._instance.viewConfig !== undefined + ) { + // ReactCompositeComponentWrapper + // Some instances (eg Text) define their own viewConfig + viewConfig = maybeInstance._instance.viewConfig; + } else { + // ReactCompositeComponentWrapper + // Other instances (eg TextInput) defer to their children's viewConfig + while (maybeInstance._renderedComponent !== undefined) { + maybeInstance = maybeInstance._renderedComponent; } - throw new Error(msg); + viewConfig = maybeInstance.viewConfig; + } + + const tag : number = typeof maybeInstance.getHostNode === 'function' + ? maybeInstance.getHostNode() + : maybeInstance._rootNodeID; + + if (__DEV__) { + warnForStyleProps(nativeProps, viewConfig.validAttributes); } + + var updatePayload = ReactNativeAttributePayload.create( + nativeProps, + viewConfig.validAttributes, + ); + + UIManager.updateView( + tag, + viewConfig.uiViewClassName, + updatePayload, + ); +} + +// Switching based on fiber vs stack to avoid a lot of inline checks at runtime. +// HACK Normally this injection would be done by the renderer, but in this case +// that would result in a cycle between ReactNative and NativeMethodsMixin. +// We avoid requiring additional code for this injection so it's probably ok? +// TODO (bvaughn) Remove this once ReactNativeStack is gone. +let injectedSetNativeProps : + (componentOrHandle: any, nativeProps: Object) => void; +if (ReactNativeFeatureFlags.useFiber) { + injectedSetNativeProps = setNativePropsFiber; +} else { + injectedSetNativeProps = setNativePropsStack; } + if (__DEV__) { // hide this from Flow since we can't define these properties outside of // __DEV__ without actually implementing them (setting them to undefined @@ -203,20 +279,4 @@ if (__DEV__) { }; } -/** - * In the future, we should cleanup callbacks by cancelling them instead of - * using this. - */ -function mountSafeCallback( - context: ReactComponent, - callback: ?Function -): any { - return function() { - if (!callback || (typeof context.isMounted === 'function' && !context.isMounted())) { - return undefined; - } - return callback.apply(context, arguments); - }; -} - module.exports = NativeMethodsMixin; diff --git a/Libraries/Renderer/src/renderers/native/NativeMethodsMixinUtils.js b/Libraries/Renderer/src/renderers/native/NativeMethodsMixinUtils.js new file mode 100644 index 000000000000..b5aa4ae8d0ad --- /dev/null +++ b/Libraries/Renderer/src/renderers/native/NativeMethodsMixinUtils.js @@ -0,0 +1,100 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule NativeMethodsMixinUtils + * @flow + */ +'use strict'; + +export type MeasureOnSuccessCallback = ( + x: number, + y: number, + width: number, + height: number, + pageX: number, + pageY: number +) => void + +export type MeasureInWindowOnSuccessCallback = ( + x: number, + y: number, + width: number, + height: number, +) => void + +export type MeasureLayoutOnSuccessCallback = ( + left: number, + top: number, + width: number, + height: number +) => void + +/** + * Shared between ReactNativeFiberHostComponent and NativeMethodsMixin to keep + * API in sync. + */ +export interface NativeMethodsInterface { + blur() : void, + focus() : void, + measure(callback : MeasureOnSuccessCallback) : void, + measureInWindow(callback : MeasureInWindowOnSuccessCallback) : void, + measureLayout( + relativeToNativeNode: number, + onSuccess: MeasureLayoutOnSuccessCallback, + onFail: () => void /* currently unused */ + ) : void, + setNativeProps(nativeProps: Object) : void, +} + +/** + * In the future, we should cleanup callbacks by cancelling them instead of + * using this. + */ +function mountSafeCallback( + context: any, + callback: ?Function +): any { + return function() { + if (!callback || (typeof context.isMounted === 'function' && !context.isMounted())) { + return undefined; + } + return callback.apply(context, arguments); + }; +} + +function throwOnStylesProp(component : any, props : any) { + if (props.styles !== undefined) { + var owner = component._owner || null; + var name = component.constructor.displayName; + var msg = '`styles` is not a supported property of `' + name + '`, did ' + + 'you mean `style` (singular)?'; + if (owner && owner.constructor && owner.constructor.displayName) { + msg += '\n\nCheck the `' + owner.constructor.displayName + '` parent ' + + ' component.'; + } + throw new Error(msg); + } +} + +function warnForStyleProps(props : any, validAttributes : any) { + for (var key in validAttributes.style) { + if (!(validAttributes[key] || props[key] === undefined)) { + console.error( + 'You are setting the style `{ ' + key + ': ... }` as a prop. You ' + + 'should nest it in a style object. ' + + 'E.g. `{ style: { ' + key + ': ... } }`' + ); + } + } +} + +module.exports = { + mountSafeCallback, + throwOnStylesProp, + warnForStyleProps, +}; diff --git a/Libraries/Renderer/src/renderers/native/ReactNative.js b/Libraries/Renderer/src/renderers/native/ReactNative.js index 527a53920b74..82b12de9a1ca 100644 --- a/Libraries/Renderer/src/renderers/native/ReactNative.js +++ b/Libraries/Renderer/src/renderers/native/ReactNative.js @@ -15,4 +15,4 @@ const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags'); module.exports = ReactNativeFeatureFlags.useFiber ? require('ReactNativeFiber') - : require('ReactNativeStack') + : require('ReactNativeStack'); diff --git a/Libraries/Renderer/src/renderers/native/ReactNativeFiber.js b/Libraries/Renderer/src/renderers/native/ReactNativeFiber.js index 1d73e80b88af..e2ad6701a4c0 100644 --- a/Libraries/Renderer/src/renderers/native/ReactNativeFiber.js +++ b/Libraries/Renderer/src/renderers/native/ReactNativeFiber.js @@ -12,16 +12,11 @@ 'use strict'; -import type { Element } from 'React'; -import type { Fiber } from 'ReactFiber'; -import type { ReactNodeList } from 'ReactTypes'; -import type { ReactNativeBaseComponentViewConfig } from 'ReactNativeViewConfigRegistry'; - -const NativeMethodsMixin = require('NativeMethodsMixin'); const ReactFiberReconciler = require('ReactFiberReconciler'); const ReactGenericBatching = require('ReactGenericBatching'); const ReactNativeAttributePayload = require('ReactNativeAttributePayload'); const ReactNativeComponentTree = require('ReactNativeComponentTree'); +const ReactNativeFiberHostComponent = require('ReactNativeFiberHostComponent'); const ReactNativeInjection = require('ReactNativeInjection'); const ReactNativeTagHandles = require('ReactNativeTagHandles'); const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); @@ -34,6 +29,11 @@ const findNodeHandle = require('findNodeHandle'); const invariant = require('fbjs/lib/invariant'); const { injectInternals } = require('ReactFiberDevToolsHook'); + +import type { Element } from 'React'; +import type { Fiber } from 'ReactFiber'; +import type { ReactNativeBaseComponentViewConfig } from 'ReactNativeViewConfigRegistry'; +import type { ReactNodeList } from 'ReactTypes'; const { precacheFiberNode, uncacheFiberNode, @@ -43,7 +43,7 @@ const { ReactNativeInjection.inject(); type Container = number; -type Instance = { +export type Instance = { _children: Array, _nativeTag: number, viewConfig: ReactNativeBaseComponentViewConfig, @@ -51,13 +51,6 @@ type Instance = { type Props = Object; type TextInstance = number; -function NativeHostComponent(tag, viewConfig) { - this._nativeTag = tag; - this._children = []; - this.viewConfig = viewConfig; -} -Object.assign(NativeHostComponent.prototype, NativeMethodsMixin); - function recursivelyUncacheFiberNode(node : Instance | TextInstance) { if (typeof node === 'number') { // Leaf node (eg text) uncacheFiberNode(node); @@ -156,7 +149,7 @@ const NativeRenderer = ReactFiberReconciler({ const viewConfig = ReactNativeViewConfigRegistry.get(type); if (__DEV__) { - for (let key in viewConfig.validAttributes) { + for (const key in viewConfig.validAttributes) { if (props.hasOwnProperty(key)) { deepFreezeAndThrowOnMutationInDev(props[key]); } @@ -175,12 +168,14 @@ const NativeRenderer = ReactFiberReconciler({ updatePayload, // props ); - const component = new NativeHostComponent(tag, viewConfig); + const component = new ReactNativeFiberHostComponent(tag, viewConfig); precacheFiberNode(internalInstanceHandle, tag); updateFiberProps(tag, props); - return component; + // Not sure how to avoid this cast. Flow is okay if the component is defined + // in the same file but if it's external it can't see the types. + return ((component : any) : Instance); }, createTextInstance( @@ -367,17 +362,20 @@ ReactGenericBatching.injection.injectFiberBatchedUpdates( const roots = new Map(); findNodeHandle.injection.injectFindNode( - (fiber: Fiber) => { - const instance: any = NativeRenderer.findHostInstance(fiber); - return instance ? instance._nativeTag : null; - } + (fiber: Fiber) => NativeRenderer.findHostInstance(fiber) ); findNodeHandle.injection.injectFindRootNodeID( - (instance) => instance._nativeTag + (instance) => instance ); const ReactNative = { - findNodeHandle, + // External users of findNodeHandle() expect the host tag number return type. + // The injected findNodeHandle() strategy returns the instance wrapper though. + // See NativeMethodsMixin#setNativeProps for more info on why this is done. + findNodeHandle(componentOrHandle : any) : ?number { + const instance: any = findNodeHandle(componentOrHandle); + return instance ? instance._nativeTag : null; + }, render(element : Element, containerTag : any, callback: ?Function) { let root = roots.get(containerTag); diff --git a/Libraries/Renderer/src/renderers/native/ReactNativeFiberHostComponent.js b/Libraries/Renderer/src/renderers/native/ReactNativeFiberHostComponent.js new file mode 100644 index 000000000000..2935b199d15f --- /dev/null +++ b/Libraries/Renderer/src/renderers/native/ReactNativeFiberHostComponent.js @@ -0,0 +1,108 @@ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactNativeFiberHostComponent + * @flow + * @preventMunge + */ + +'use strict'; + +var ReactNativeAttributePayload = require('ReactNativeAttributePayload'); +var TextInputState = require('TextInputState'); +var UIManager = require('UIManager'); + +var { + mountSafeCallback, + warnForStyleProps, +} = require('NativeMethodsMixinUtils'); + +import type { + MeasureInWindowOnSuccessCallback, + MeasureLayoutOnSuccessCallback, + MeasureOnSuccessCallback, + NativeMethodsInterface, +} from 'NativeMethodsMixinUtils'; +import type { Instance } from 'ReactNativeFiber'; +import type { ReactNativeBaseComponentViewConfig } from 'ReactNativeViewConfigRegistry'; + +/** + * This component defines the same methods as NativeMethodsMixin but without the + * findNodeHandle wrapper. This wrapper is unnecessary for HostComponent views + * and would also result in a circular require.js dependency (since + * ReactNativeFiber depends on this component and NativeMethodsMixin depends on + * ReactNativeFiber). + */ +class ReactNativeFiberHostComponent implements NativeMethodsInterface { + _children: Array + _nativeTag: number + viewConfig: ReactNativeBaseComponentViewConfig + + constructor( + tag : number, + viewConfig : ReactNativeBaseComponentViewConfig + ) { + this._nativeTag = tag; + this._children = []; + this.viewConfig = viewConfig; + } + + blur() { + TextInputState.blurTextInput(this._nativeTag); + } + + focus() { + TextInputState.focusTextInput(this._nativeTag); + } + + measure(callback: MeasureOnSuccessCallback) { + UIManager.measure( + this._nativeTag, + mountSafeCallback(this, callback) + ); + } + + measureInWindow(callback: MeasureInWindowOnSuccessCallback) { + UIManager.measureInWindow( + this._nativeTag, + mountSafeCallback(this, callback) + ); + } + + measureLayout( + relativeToNativeNode: number, + onSuccess: MeasureLayoutOnSuccessCallback, + onFail: () => void /* currently unused */ + ) { + UIManager.measureLayout( + this._nativeTag, + relativeToNativeNode, + mountSafeCallback(this, onFail), + mountSafeCallback(this, onSuccess) + ); + } + + setNativeProps(nativeProps: Object) { + if (__DEV__) { + warnForStyleProps(nativeProps, this.viewConfig.validAttributes); + } + + var updatePayload = ReactNativeAttributePayload.create( + nativeProps, + this.viewConfig.validAttributes + ); + + UIManager.updateView( + this._nativeTag, + this.viewConfig.uiViewClassName, + updatePayload + ); + } +} + +module.exports = ReactNativeFiberHostComponent; diff --git a/Libraries/Renderer/src/renderers/native/ReactNativeStack.js b/Libraries/Renderer/src/renderers/native/ReactNativeStack.js index 55cf71fa1c6b..d6ae88792d9d 100644 --- a/Libraries/Renderer/src/renderers/native/ReactNativeStack.js +++ b/Libraries/Renderer/src/renderers/native/ReactNativeStack.js @@ -13,8 +13,8 @@ var ReactNativeComponentTree = require('ReactNativeComponentTree'); var ReactNativeInjection = require('ReactNativeInjection'); -var ReactNativeStackInjection = require('ReactNativeStackInjection'); var ReactNativeMount = require('ReactNativeMount'); +var ReactNativeStackInjection = require('ReactNativeStackInjection'); var ReactUpdates = require('ReactUpdates'); var findNodeHandle = require('findNodeHandle'); @@ -30,16 +30,16 @@ var render = function( return ReactNativeMount.renderComponent(element, mountInto, callback); }; -findNodeHandle.injection.injectFindNode( - (instance) => instance.getHostNode() -); -findNodeHandle.injection.injectFindRootNodeID( - (instance) => instance._rootNodeID -); - var ReactNative = { hasReactNativeInitialized: false, - findNodeHandle: findNodeHandle, + + // External users of findNodeHandle() expect the host tag number return type. + // The injected findNodeHandle() strategy returns the instance wrapper though. + // See NativeMethodsMixin#setNativeProps for more info on why this is done. + findNodeHandle(componentOrHandle : any) : ?number { + return findNodeHandle(componentOrHandle).getHostNode(); + }, + render: render, unmountComponentAtNode: ReactNativeMount.unmountComponentAtNode, diff --git a/Libraries/Renderer/src/renderers/native/ReactNativeStackInjection.js b/Libraries/Renderer/src/renderers/native/ReactNativeStackInjection.js index fe4f4cd4c035..cc1f812a65cf 100644 --- a/Libraries/Renderer/src/renderers/native/ReactNativeStackInjection.js +++ b/Libraries/Renderer/src/renderers/native/ReactNativeStackInjection.js @@ -63,10 +63,10 @@ function inject() { }; findNodeHandle.injection.injectFindNode( - (instance) => instance.getHostNode() + (instance) => instance ); findNodeHandle.injection.injectFindRootNodeID( - (instance) => instance._rootNodeID + (instance) => instance ); ReactEmptyComponent.injection.injectEmptyComponentFactory(EmptyComponent); diff --git a/Libraries/Renderer/src/renderers/native/createReactNativeComponentClass.js b/Libraries/Renderer/src/renderers/native/createReactNativeComponentClass.js index bf53cf81616e..3549c750fbee 100644 --- a/Libraries/Renderer/src/renderers/native/createReactNativeComponentClass.js +++ b/Libraries/Renderer/src/renderers/native/createReactNativeComponentClass.js @@ -13,8 +13,8 @@ 'use strict'; const ReactNativeBaseComponent = require('ReactNativeBaseComponent'); -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags'); +const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); // See also ReactNativeBaseComponent type ReactNativeBaseComponentViewConfig = { @@ -27,14 +27,12 @@ type ReactNativeBaseComponentViewConfig = { * @param {string} config iOS View configuration. * @private */ - const createReactNativeFiberComponentClass = function( - viewConfig: ReactNativeBaseComponentViewConfig - ): ReactClass { - // TODO(sema): This actually returns a string. Need to fix this before - // we deploy Fiber. - return (ReactNativeViewConfigRegistry.register(viewConfig) : any); - }; - +const createReactNativeFiberComponentClass = function( + viewConfig: ReactNativeBaseComponentViewConfig +): string { + return ReactNativeViewConfigRegistry.register(viewConfig); +}; + /** * @param {string} config iOS View configuration. * @private diff --git a/Libraries/Renderer/src/renderers/native/findNodeHandle.js b/Libraries/Renderer/src/renderers/native/findNodeHandle.js index 7edb378924d4..2230ee37b45a 100644 --- a/Libraries/Renderer/src/renderers/native/findNodeHandle.js +++ b/Libraries/Renderer/src/renderers/native/findNodeHandle.js @@ -53,7 +53,10 @@ import type { ReactInstance } from 'ReactInstanceType'; let injectedFindNode; let injectedFindRootNodeID; -function findNodeHandle(componentOrHandle: any): ?number { +// TODO (bvaughn) Rename the findNodeHandle module to something more descriptive +// eg findInternalHostInstance. This will reduce the likelihood of someone +// accidentally deep-requiring this version. +function findNodeHandle(componentOrHandle: any): any { if (__DEV__) { // TODO: fix this unsafe cast to work with Fiber. var owner = ((ReactCurrentOwner.current: any): ReactInstance | null); From 6dc3a83e88ed120decbeaed8e4e62dc2bb7107a3 Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Mon, 20 Mar 2017 13:03:04 -0700 Subject: [PATCH 0015/1153] Don't load native module support as part of the initial CS bundle Reviewed By: javache Differential Revision: D4720386 fbshipit-source-id: cd8b6137aaff2d907adf089060bf7d356cd2f437 --- ReactCommon/cxxreact/JSCExecutor.cpp | 84 ++++++++++++++++++---------- ReactCommon/cxxreact/JSCExecutor.h | 2 + ReactCommon/jschelpers/Value.h | 7 +++ 3 files changed, 63 insertions(+), 30 deletions(-) diff --git a/ReactCommon/cxxreact/JSCExecutor.cpp b/ReactCommon/cxxreact/JSCExecutor.cpp index cee2f2ece2e3..810d0ecfcf5c 100644 --- a/ReactCommon/cxxreact/JSCExecutor.cpp +++ b/ReactCommon/cxxreact/JSCExecutor.cpp @@ -361,7 +361,6 @@ void JSCExecutor::loadApplicationScript(std::unique_ptr scrip evaluateSourceCode(m_context, bcSourceCode, jsSourceURL); - bindBridge(); flush(); ReactMarker::logMarker("CREATE_REACT_CONTEXT_END"); @@ -412,7 +411,6 @@ void JSCExecutor::loadApplicationScript(std::unique_ptr scrip evaluateScript(m_context, jsScript, jsSourceURL); } - bindBridge(); flush(); ReactMarker::logMarker("CREATE_REACT_CONTEXT_END"); @@ -428,24 +426,32 @@ void JSCExecutor::setJSModulesUnbundle(std::unique_ptr unbund void JSCExecutor::bindBridge() throw(JSException) { SystraceSection s("JSCExecutor::bindBridge"); - if (!m_delegate || !m_delegate->getModuleRegistry()) { - return; - } - auto global = Object::getGlobalObject(m_context); - auto batchedBridgeValue = global.getProperty("__fbBatchedBridge"); - if (batchedBridgeValue.isUndefined()) { - throwJSExecutionException("Could not get BatchedBridge, make sure your bundle is packaged correctly"); - } + std::call_once(m_bindFlag, [this] { + auto global = Object::getGlobalObject(m_context); + auto batchedBridgeValue = global.getProperty("__fbBatchedBridge"); + if (batchedBridgeValue.isUndefined()) { + auto requireBatchedBridge = global.getProperty("__fbRequireBatchedBridge"); + if (!requireBatchedBridge.isUndefined()) { + batchedBridgeValue = requireBatchedBridge.asObject().callAsFunction({}); + } + if (batchedBridgeValue.isUndefined()) { + throwJSExecutionException("Could not get BatchedBridge, make sure your bundle is packaged correctly"); + } + } - auto batchedBridge = batchedBridgeValue.asObject(); - m_callFunctionReturnFlushedQueueJS = batchedBridge.getProperty("callFunctionReturnFlushedQueue").asObject(); - m_invokeCallbackAndReturnFlushedQueueJS = batchedBridge.getProperty("invokeCallbackAndReturnFlushedQueue").asObject(); - m_flushedQueueJS = batchedBridge.getProperty("flushedQueue").asObject(); - m_callFunctionReturnResultAndFlushedQueueJS = batchedBridge.getProperty("callFunctionReturnResultAndFlushedQueue").asObject(); + auto batchedBridge = batchedBridgeValue.asObject(); + m_callFunctionReturnFlushedQueueJS = batchedBridge.getProperty("callFunctionReturnFlushedQueue").asObject(); + m_invokeCallbackAndReturnFlushedQueueJS = batchedBridge.getProperty("invokeCallbackAndReturnFlushedQueue").asObject(); + m_flushedQueueJS = batchedBridge.getProperty("flushedQueue").asObject(); + m_callFunctionReturnResultAndFlushedQueueJS = batchedBridge.getProperty("callFunctionReturnResultAndFlushedQueue").asObject(); + }); } void JSCExecutor::callNativeModules(Value&& value) { SystraceSection s("JSCExecutor::callNativeModules"); + // If this fails, you need to pass a fully functional delegate with a + // module registry to the factory/ctor. + CHECK(m_delegate) << "Attempting to use native modules without a delegate"; try { auto calls = value.toJSONString(); m_delegate->callNativeModules(*this, folly::parseJson(calls), true); @@ -462,17 +468,31 @@ void JSCExecutor::callNativeModules(Value&& value) { void JSCExecutor::flush() { SystraceSection s("JSCExecutor::flush"); - if (!m_delegate) { - // do nothing - } else if (!m_delegate->getModuleRegistry()) { - callNativeModules(Value::makeNull(m_context)); - } else { - // If this is failing, chances are you have provided a delegate with a - // module registry, but haven't loaded the JS which enables native function - // queueing. Add BatchedBridge.js to your bundle, pass a nullptr delegate, - // or make delegate->getModuleRegistry() return nullptr. - CHECK(m_flushedQueueJS) << "Attempting to use native methods without loading BatchedBridge.js"; + + if (m_flushedQueueJS) { callNativeModules(m_flushedQueueJS->callAsFunction({})); + return; + } + + // When a native module is called from JS, BatchedBridge.enqueueNativeCall() + // is invoked. For that to work, require('BatchedBridge') has to be called, + // and when that happens, __fbBatchedBridge is set as a side effect. + auto global = Object::getGlobalObject(m_context); + auto batchedBridgeValue = global.getProperty("__fbBatchedBridge"); + // So here, if __fbBatchedBridge doesn't exist, then we know no native calls + // have happened, and we were able to determine this without forcing + // BatchedBridge to be loaded as a side effect. + if (!batchedBridgeValue.isUndefined()) { + // If calls were made, we bind to the JS bridge methods, and use them to + // get the pending queue of native calls. + bindBridge(); + callNativeModules(m_flushedQueueJS->callAsFunction({})); + } else if (m_delegate) { + // If we have a delegate, we need to call it; we pass a null list to + // callNativeModules, since we know there are no native calls, without + // calling into JS again. If no calls were made and there's no delegate, + // nothing happens, which is correct. + callNativeModules(Value::makeNull(m_context)); } } @@ -483,9 +503,9 @@ void JSCExecutor::callFunction(const std::string& moduleId, const std::string& m auto result = [&] { try { - // See flush() - CHECK(m_callFunctionReturnFlushedQueueJS) - << "Attempting to call native methods without loading BatchedBridge.js"; + if (!m_callFunctionReturnResultAndFlushedQueueJS) { + bindBridge(); + } return m_callFunctionReturnFlushedQueueJS->callAsFunction({ Value(m_context, String::createExpectingAscii(m_context, moduleId)), Value(m_context, String::createExpectingAscii(m_context, methodId)), @@ -504,6 +524,9 @@ void JSCExecutor::invokeCallback(const double callbackId, const folly::dynamic& SystraceSection s("JSCExecutor::invokeCallback"); auto result = [&] { try { + if (!m_invokeCallbackAndReturnFlushedQueueJS) { + bindBridge(); + } return m_invokeCallbackAndReturnFlushedQueueJS->callAsFunction({ Value::makeNumber(m_context, callbackId), Value::fromDynamic(m_context, std::move(arguments)) @@ -521,8 +544,9 @@ Value JSCExecutor::callFunctionSyncWithValue( const std::string& module, const std::string& method, Value args) { SystraceSection s("JSCExecutor::callFunction"); - // See flush() - CHECK(m_callFunctionReturnResultAndFlushedQueueJS); + if (!m_callFunctionReturnResultAndFlushedQueueJS) { + bindBridge(); + } Object result = m_callFunctionReturnResultAndFlushedQueueJS->callAsFunction({ Value(m_context, String::createExpectingAscii(m_context, module)), Value(m_context, String::createExpectingAscii(m_context, method)), diff --git a/ReactCommon/cxxreact/JSCExecutor.h b/ReactCommon/cxxreact/JSCExecutor.h index 3fbb03504a6f..c3a1449e0594 100644 --- a/ReactCommon/cxxreact/JSCExecutor.h +++ b/ReactCommon/cxxreact/JSCExecutor.h @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -112,6 +113,7 @@ class RN_EXPORT JSCExecutor : public JSExecutor { std::unique_ptr m_unbundle; JSCNativeModules m_nativeModules; folly::dynamic m_jscConfig; + std::once_flag m_bindFlag; folly::Optional m_invokeCallbackAndReturnFlushedQueueJS; folly::Optional m_callFunctionReturnFlushedQueueJS; diff --git a/ReactCommon/jschelpers/Value.h b/ReactCommon/jschelpers/Value.h index b5d79c53df28..ca8b86bf65f8 100644 --- a/ReactCommon/jschelpers/Value.h +++ b/ReactCommon/jschelpers/Value.h @@ -237,6 +237,13 @@ class Value : public noncopyable { Value(JSContextRef context, JSStringRef value); Value(Value&&); + Value& operator=(Value&& other) { + m_context = other.m_context; + m_value = other.m_value; + other.m_value = NULL; + return *this; + }; + operator JSValueRef() const { return m_value; } From 39544005650f886f8741e20e081fa91e4a9eb7b4 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Mon, 20 Mar 2017 16:22:24 -0700 Subject: [PATCH 0016/1153] Added MobileConfig for ReactNative use-fiber Reviewed By: yungsters Differential Revision: D4740267 fbshipit-source-id: d2cf76a22ce0f6337e1055b9f4b869c8bd82fa7d --- .../Renderer/src/renderers/native/ReactNativeFeatureFlags.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Libraries/Renderer/src/renderers/native/ReactNativeFeatureFlags.js b/Libraries/Renderer/src/renderers/native/ReactNativeFeatureFlags.js index 1686eec51aed..1224b86f7b74 100644 --- a/Libraries/Renderer/src/renderers/native/ReactNativeFeatureFlags.js +++ b/Libraries/Renderer/src/renderers/native/ReactNativeFeatureFlags.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactNativeFeatureFlags + * @flow */ 'use strict'; From a4300dab6726aa0588ab10476164846b10794f2f Mon Sep 17 00:00:00 2001 From: "Andrew Y. Chen" Date: Mon, 20 Mar 2017 17:22:50 -0700 Subject: [PATCH 0017/1153] Move idle detection classes to its own directory Reviewed By: AaaChiuuu Differential Revision: D4738755 fbshipit-source-id: df3b215991a45932283f6ba9d800aeff1c31d2e6 --- .../java/com/facebook/react/testing/BUCK | 6 +++++- .../testing/ReactAppInstrumentationTestCase.java | 2 +- .../react/testing/ReactAppTestActivity.java | 2 ++ .../react/testing/ReactIntegrationTestCase.java | 2 ++ .../react/testing/SingleTouchGestureGenerator.java | 2 ++ .../com/facebook/react/testing/idledetection/BUCK | 14 ++++++++++++++ .../testing/{ => idledetection}/IdleWaiter.java | 2 +- .../ReactBridgeIdleSignaler.java | 2 +- .../ReactIdleDetectionUtil.java | 2 +- .../androidTest/java/com/facebook/react/tests/BUCK | 1 + 10 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK rename ReactAndroid/src/androidTest/java/com/facebook/react/testing/{ => idledetection}/IdleWaiter.java (90%) rename ReactAndroid/src/androidTest/java/com/facebook/react/testing/{ => idledetection}/ReactBridgeIdleSignaler.java (97%) rename ReactAndroid/src/androidTest/java/com/facebook/react/testing/{ => idledetection}/ReactIdleDetectionUtil.java (98%) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK index 5cf6affe9a6f..6814e3aa3161 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK @@ -2,7 +2,10 @@ include_defs("//ReactAndroid/DEFS") android_library( name = "testing", - srcs = glob(["**/*.java"]), + srcs = glob( + ["**/*.java"], + excludes = ["idledetection/**/*.java"], + ), visibility = [ "PUBLIC", ], @@ -25,5 +28,6 @@ android_library( react_native_target("java/com/facebook/react/modules/debug:interfaces"), react_native_target("java/com/facebook/react/shell:shell"), react_native_target("java/com/facebook/react/uimanager:uimanager"), + react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"), ], ) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java index aaba651def94..eeb8c02e0671 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java @@ -20,6 +20,7 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.ReactContext; +import com.facebook.react.testing.idledetection.IdleWaiter; /** * Base class for instrumentation tests that runs React based react application in UI mode @@ -123,7 +124,6 @@ public void run() { } }; - getActivity().runOnUiThread(getScreenshotRunnable); try { if (!latch.await(5000, TimeUnit.MILLISECONDS)) { diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java index 022e7826c1fe..11edda17a429 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java @@ -28,6 +28,8 @@ import com.facebook.react.common.LifecycleState; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.shell.MainReactPackage; +import com.facebook.react.testing.idledetection.ReactBridgeIdleSignaler; +import com.facebook.react.testing.idledetection.ReactIdleDetectionUtil; import com.facebook.react.uimanager.UIImplementationProvider; public class ReactAppTestActivity extends FragmentActivity implements diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java index 752c89ea6181..77f5492c36ca 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java @@ -32,6 +32,8 @@ import com.facebook.react.common.futures.SimpleSettableFuture; import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.modules.core.Timing; +import com.facebook.react.testing.idledetection.ReactBridgeIdleSignaler; +import com.facebook.react.testing.idledetection.ReactIdleDetectionUtil; import com.facebook.soloader.SoLoader; import static org.mockito.Mockito.mock; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java index 278facbcb280..f0ae877a953d 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java @@ -13,6 +13,8 @@ import android.view.View; import android.view.ViewConfiguration; +import com.facebook.react.testing.idledetection.IdleWaiter; + /** * Provides methods for generating touch events and dispatching them directly to a given view. * Events scenarios are based on {@link android.test.TouchUtils} but they get gets dispatched diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK new file mode 100644 index 000000000000..f6b33535737d --- /dev/null +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK @@ -0,0 +1,14 @@ +include_defs("//ReactAndroid/DEFS") + +android_library( + name = "idledetection", + srcs = glob(["**/*.java"]), + visibility = [ + "PUBLIC", + ], + deps = [ + react_native_dep("third-party/java/testing-support-lib:runner"), + react_native_target("java/com/facebook/react/bridge:bridge"), + react_native_target("java/com/facebook/react/modules/core:core"), + ], +) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IdleWaiter.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java similarity index 90% rename from ReactAndroid/src/androidTest/java/com/facebook/react/testing/IdleWaiter.java rename to ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java index 98884c1033a3..1b94b7c1fc88 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IdleWaiter.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java @@ -6,7 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.testing; +package com.facebook.react.testing.idledetection; /** * Interface for something that knows how to wait for bridge and UI idle. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactBridgeIdleSignaler.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java similarity index 97% rename from ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactBridgeIdleSignaler.java rename to ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java index ffd941f9a228..4aaa451e43ab 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactBridgeIdleSignaler.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java @@ -6,7 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.testing; +package com.facebook.react.testing.idledetection; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIdleDetectionUtil.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java similarity index 98% rename from ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIdleDetectionUtil.java rename to ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java index 49e2219327b9..af6ca2ebb82a 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIdleDetectionUtil.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java @@ -6,7 +6,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.testing; +package com.facebook.react.testing.idledetection; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK index 96872ba647b3..992351f62026 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK @@ -5,6 +5,7 @@ deps = [ react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_integration_tests_target("java/com/facebook/react/testing:testing"), + react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"), react_native_target("java/com/facebook/react:react"), react_native_target("java/com/facebook/react/bridge:bridge"), react_native_target("java/com/facebook/react/common:common"), From b3be5743e99f01acdf628c48d3a6f9126aca2c5b Mon Sep 17 00:00:00 2001 From: Ben Roth Date: Tue, 21 Mar 2017 04:03:00 -0700 Subject: [PATCH 0018/1153] Fix property accessor warning in RCTDevSettings::websocketExecutorName Summary: Motivation: Fixes Xcode warning `Ivar '_websocketExecutorName' which backs the property is not referenced in this property's accessor` which shows up because this property has no setter (and is never set anywhere). Closes https://github.com/facebook/react-native/pull/12639 Differential Revision: D4745437 Pulled By: javache fbshipit-source-id: 3ab4b0df62f90adc2b62d891197dc783e07da4e3 --- React/Modules/RCTDevSettings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Modules/RCTDevSettings.h b/React/Modules/RCTDevSettings.h index 6fb6fb4652f9..d8ffd7c9095d 100644 --- a/React/Modules/RCTDevSettings.h +++ b/React/Modules/RCTDevSettings.h @@ -46,7 +46,7 @@ * Alternate name for the websocket executor, if not the generic term "remote". * TODO t16297016: this seems to be unused, remove? */ -@property (nonatomic, copy) NSString *websocketExecutorName; +@property (nonatomic, readonly) NSString *websocketExecutorName; /* * Whether shaking will show RCTDevMenu. The menu is enabled by default if RCT_DEV=1, but From 2f69c5f46cad550692f41000f7fa6f32efc72745 Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Tue, 21 Mar 2017 05:05:54 -0700 Subject: [PATCH 0019/1153] exit out early and continue if no annotations are found Differential Revision: D4742299 fbshipit-source-id: 8006c5c9b25c951aec12ad5c63fdaf03fe1f6e67 --- .../react/module/processing/ReactModuleSpecProcessor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java b/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java index add1ef0b6ef9..d7c419cda8a8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java @@ -80,11 +80,15 @@ public boolean process(Set annotations, RoundEnvironment ReactModuleList.class); for (Element reactModuleListElement : reactModuleListElements) { TypeElement typeElement = (TypeElement) reactModuleListElement; + ReactModuleList reactModuleList = typeElement.getAnnotation(ReactModuleList.class); + if (reactModuleList == null) { + continue; + } + ClassName className = ClassName.get(typeElement); String packageName = ClassName.get(typeElement).packageName(); String fileName = className.simpleName(); - ReactModuleList reactModuleList = typeElement.getAnnotation(ReactModuleList.class); List nativeModules = new ArrayList<>(); try { reactModuleList.nativeModules(); // throws MirroredTypesException From 80e1dbf69227af7a16932a7f443e116799811a3b Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Tue, 21 Mar 2017 05:35:57 -0700 Subject: [PATCH 0020/1153] require `fbjs/lib/invariant`, not `invariant` Summary: `invariant` is only available in open source because we install it as a transitive dependency into node_modules Reviewed By: jeanlauliac Differential Revision: D4745582 fbshipit-source-id: 27c49b576254c8d1d667dea7097d16cdd1205daf --- Libraries/Utilities/DeviceInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Utilities/DeviceInfo.js b/Libraries/Utilities/DeviceInfo.js index d398f8083124..819916b153f8 100644 --- a/Libraries/Utilities/DeviceInfo.js +++ b/Libraries/Utilities/DeviceInfo.js @@ -13,7 +13,7 @@ const DeviceInfo = require('NativeModules').DeviceInfo; -const invariant = require('invariant'); +const invariant = require('fbjs/lib/invariant'); invariant(DeviceInfo, 'DeviceInfo native module is not installed correctly'); From 5c128ad0491808b8aa22828ee14fcc1672201995 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 21 Mar 2017 05:54:03 -0700 Subject: [PATCH 0021/1153] packager: GlobalTransformCache: add unit test Summary: Finally adding some unit test to increase confidence in the correctness of that piece of code. Reviewed By: davidaurelio Differential Revision: D4721543 fbshipit-source-id: 56776290d61f2b51c69d7eeae09663e3bc892b50 --- .../__tests__/GlobalTransformCache-test.js | 91 +++++++++++++++++++ .../GlobalTransformCache-test.js.snap | 32 +++++++ 2 files changed, 123 insertions(+) create mode 100644 packager/src/lib/__tests__/GlobalTransformCache-test.js create mode 100644 packager/src/lib/__tests__/__snapshots__/GlobalTransformCache-test.js.snap diff --git a/packager/src/lib/__tests__/GlobalTransformCache-test.js b/packager/src/lib/__tests__/GlobalTransformCache-test.js new file mode 100644 index 000000000000..1900ed85f884 --- /dev/null +++ b/packager/src/lib/__tests__/GlobalTransformCache-test.js @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +jest.disableAutomock(); +jest.useRealTimers(); + +const fetchMock = jest.fn(); +jest.mock('node-fetch', () => fetchMock); + +const GlobalTransformCache = require('../GlobalTransformCache'); +const FetchError = require('node-fetch/lib/fetch-error'); + +async function fetchResultURIs(keys: Array): Promise> { + return new Map(keys.map(key => [key, `http://globalcache.com/${key}`])); +} + +async function fetchResultFromURI(uri: string): Promise { + return { + code: `/* code from ${uri} */`, + dependencies: [], + dependencyOffsets: [], + }; +} + +describe('GlobalTransformCache', () => { + + it('fetches results', async () => { + const cache = new GlobalTransformCache(fetchResultURIs, fetchResultFromURI, null, [ + {dev: true, minify: false, platform: 'ios'}, + ]); + const transformOptions = { + dev: true, + minify: false, + platform: 'ios', + transform: {projectRoots: [__dirname]}, + }; + const result = await Promise.all([cache.fetch({ + filePath: 'foo.js', + sourceCode: '/* beep */', + getTransformCacheKey: () => 'abcd', + transformOptions, + }), cache.fetch({ + filePath: 'bar.js', + sourceCode: '/* boop */', + getTransformCacheKey: () => 'abcd', + transformOptions, + })]); + expect(result).toMatchSnapshot(); + }); + + describe('fetchResultFromURI', () => { + + const defaultFetchMockImpl = async uri => ({ + status: 200, + json: async () => ({ + code: `/* code from ${uri} */`, + dependencies: [], + dependencyOffsets: [], + }), + }); + + beforeEach(() => { + fetchMock.mockReset(); + }); + + it('fetches result', async () => { + fetchMock.mockImplementation(defaultFetchMockImpl); + const result = await GlobalTransformCache.fetchResultFromURI('http://globalcache.com/foo'); + expect(result).toMatchSnapshot(); + }); + + it('retries once on timeout', async () => { + fetchMock.mockImplementation(async uri => { + fetchMock.mockImplementation(defaultFetchMockImpl); + throw new FetchError('timeout!', 'request-timeout'); + }); + const result = await GlobalTransformCache.fetchResultFromURI('http://globalcache.com/foo'); + expect(result).toMatchSnapshot(); + }); + + }); + +}); diff --git a/packager/src/lib/__tests__/__snapshots__/GlobalTransformCache-test.js.snap b/packager/src/lib/__tests__/__snapshots__/GlobalTransformCache-test.js.snap new file mode 100644 index 000000000000..c0fdf1ad5bb8 --- /dev/null +++ b/packager/src/lib/__tests__/__snapshots__/GlobalTransformCache-test.js.snap @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GlobalTransformCache fetchResultFromURI fetches result 1`] = ` +Object { + "code": "/* code from http://globalcache.com/foo */", + "dependencies": Array [], + "dependencyOffsets": Array [], +} +`; + +exports[`GlobalTransformCache fetchResultFromURI retries once on timeout 1`] = ` +Object { + "code": "/* code from http://globalcache.com/foo */", + "dependencies": Array [], + "dependencyOffsets": Array [], +} +`; + +exports[`GlobalTransformCache fetches results 1`] = ` +Array [ + Object { + "code": "/* code from http://globalcache.com/2ad175cb80ae79fd33b914bfb392fb6742982d2a-foo.js */", + "dependencies": Array [], + "dependencyOffsets": Array [], + }, + Object { + "code": "/* code from http://globalcache.com/d6c0a1a4199d572ab68b36c07d0d68607eebb131-bar.js */", + "dependencies": Array [], + "dependencyOffsets": Array [], + }, +] +`; From 4cbb64521a9a3fbbef9cf741314060ef71f07357 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 21 Mar 2017 05:54:06 -0700 Subject: [PATCH 0022/1153] packager: GlobalTransformCache: ignore errors related to fetching Reviewed By: davidaurelio Differential Revision: D4745584 fbshipit-source-id: 2c9b2451d3525c90308fb88784945462cd827d1f --- packager/src/lib/GlobalTransformCache.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packager/src/lib/GlobalTransformCache.js b/packager/src/lib/GlobalTransformCache.js index b74a1981cc23..79a169ed26c2 100644 --- a/packager/src/lib/GlobalTransformCache.js +++ b/packager/src/lib/GlobalTransformCache.js @@ -145,6 +145,13 @@ class TransformProfileSet { } } +class FetchFailedError extends Error { + constructor(message) { + super(); + this.message = message; + } +} + /** * For some reason the result stored by the server for a key might mismatch what * we expect a result to be. So we need to verify carefully the data. @@ -171,6 +178,8 @@ class GlobalTransformCache { _profileSet: TransformProfileSet; _store: ?KeyResultStore; + static FetchFailedError; + /** * For using the global cache one needs to have some kind of central key-value * store that gets prefilled using keyOf() and the transformed results. The @@ -214,12 +223,13 @@ class GlobalTransformCache { static async _fetchResultFromURI(uri: string): Promise { const response = await fetch(uri, {method: 'GET', timeout: 8000}); if (response.status !== 200) { - throw new Error(`Unexpected HTTP status: ${response.status} ${response.statusText} `); + const msg = `Unexpected HTTP status: ${response.status} ${response.statusText} `; + throw new FetchFailedError(msg); } const unvalidatedResult = await response.json(); const result = validateCachedResult(unvalidatedResult); if (result == null) { - throw new Error('Server returned invalid result.'); + throw new FetchFailedError('Server returned invalid result.'); } return result; } @@ -260,4 +270,6 @@ class GlobalTransformCache { } +GlobalTransformCache.FetchFailedError = FetchFailedError; + module.exports = GlobalTransformCache; From 439cb76a005fbffd23be6c5b6a61c7806f1b716d Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 21 Mar 2017 05:54:08 -0700 Subject: [PATCH 0023/1153] packager: GlobalTransformCache: reduce asynchronicity for non-cached bundles Reviewed By: davidaurelio Differential Revision: D4745595 fbshipit-source-id: 3126fdcc11dd1c8085316457ead0cabae633d0db --- packager/src/lib/GlobalTransformCache.js | 7 ++++--- packager/src/node-haste/Module.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packager/src/lib/GlobalTransformCache.js b/packager/src/lib/GlobalTransformCache.js index 79a169ed26c2..31d27cef2612 100644 --- a/packager/src/lib/GlobalTransformCache.js +++ b/packager/src/lib/GlobalTransformCache.js @@ -247,14 +247,15 @@ class GlobalTransformCache { }); } + shouldFetch(props: FetchProps): boolean { + return this._profileSet.has(props.transformOptions); + } + /** * This may return `null` if either the cache doesn't have a value for that * key yet, or an error happened, processed separately. */ async fetch(props: FetchProps): Promise { - if (!this._profileSet.has(props.transformOptions)) { - return null; - } const uri = await this._fetcher.fetch(GlobalTransformCache.keyOf(props)); if (uri == null) { return null; diff --git a/packager/src/node-haste/Module.js b/packager/src/node-haste/Module.js index 0f1892ca56a2..5b89683ecfa7 100644 --- a/packager/src/node-haste/Module.js +++ b/packager/src/node-haste/Module.js @@ -303,7 +303,7 @@ class Module { callback: (error: ?Error, result: ?TransformedCode) => void, ) { const {_globalCache} = this; - if (_globalCache == null) { + if (_globalCache == null || !_globalCache.shouldFetch(cacheProps)) { this._transformCodeForCallback(cacheProps, callback); return; } From a34956f2fb51a95096a519feaae12a0b9db12fb1 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Tue, 21 Mar 2017 07:49:54 -0700 Subject: [PATCH 0024/1153] Remove `copyProperties` Summary: remove `copyProperties` module, and replace the functionality with `Object.assign` Reviewed By: javache Differential Revision: D4745771 fbshipit-source-id: 2440620757e7539dbd7fd39f5920ac0b5b4183c5 --- Libraries/EventEmitter/EventValidator.js | 4 +- Libraries/EventEmitter/mixInEventEmitter.js | 7 ++- Libraries/vendor/core/copyProperties.js | 48 --------------------- 3 files changed, 4 insertions(+), 55 deletions(-) delete mode 100644 Libraries/vendor/core/copyProperties.js diff --git a/Libraries/EventEmitter/EventValidator.js b/Libraries/EventEmitter/EventValidator.js index 26fda76dfab7..5fc234b2263a 100644 --- a/Libraries/EventEmitter/EventValidator.js +++ b/Libraries/EventEmitter/EventValidator.js @@ -11,8 +11,6 @@ */ 'use strict'; -const copyProperties = require('copyProperties'); - /** * EventValidator is designed to validate event types to make it easier to catch * common mistakes. It accepts a map of all of the different types of events @@ -37,7 +35,7 @@ const EventValidator = { const eventTypes = Object.keys(types); const emitterWithValidation = Object.create(emitter); - copyProperties(emitterWithValidation, { + Object.assign(emitterWithValidation, { emit: function emit(type, a, b, c, d, e, _) { assertAllowsEventType(type, eventTypes); return emitter.emit.call(this, type, a, b, c, d, e, _); diff --git a/Libraries/EventEmitter/mixInEventEmitter.js b/Libraries/EventEmitter/mixInEventEmitter.js index 2e2f47e02548..27b6726ed6b5 100644 --- a/Libraries/EventEmitter/mixInEventEmitter.js +++ b/Libraries/EventEmitter/mixInEventEmitter.js @@ -16,7 +16,6 @@ const EventEmitterWithHolding = require('EventEmitterWithHolding'); const EventHolder = require('EventHolder'); const EventValidator = require('EventValidator'); -const copyProperties = require('copyProperties'); const invariant = require('fbjs/lib/invariant'); const keyOf = require('fbjs/lib/keyOf'); @@ -63,13 +62,13 @@ function mixInEventEmitter(cls: Function | Object, types: Object) { // Keep track of the provided types, union the types if they already exist, // which allows for prototype subclasses to provide more types. if (target.hasOwnProperty(TYPES_KEY)) { - copyProperties(target.__types, types); + Object.assign(target.__types, types); } else if (target.__types) { - target.__types = copyProperties({}, target.__types, types); + target.__types = Object.assign({}, target.__types, types); } else { target.__types = types; } - copyProperties(target, EventEmitterMixin); + Object.assign(target, EventEmitterMixin); } const EventEmitterMixin = { diff --git a/Libraries/vendor/core/copyProperties.js b/Libraries/vendor/core/copyProperties.js deleted file mode 100644 index d98ed905580b..000000000000 --- a/Libraries/vendor/core/copyProperties.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule copyProperties - */ -'use strict'; - -/** - * Copy properties from one or more objects (up to 5) into the first object. - * This is a shallow copy. It mutates the first object and also returns it. - * - * NOTE: `arguments` has a very significant performance penalty, which is why - * we don't support unlimited arguments. - */ -function copyProperties(obj, a, b, c, d, e, f) { - obj = obj || {}; - - if (__DEV__) { - if (f) { - throw new Error('Too many arguments passed to copyProperties'); - } - } - - var args = [a, b, c, d, e]; - var ii = 0, v; - while (args[ii]) { - v = args[ii++]; - for (var k in v) { - obj[k] = v[k]; - } - - // IE ignores toString in object iteration.. See: - // webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html - if (v.hasOwnProperty && v.hasOwnProperty('toString') && - (typeof v.toString !== 'undefined') && (obj.toString !== v.toString)) { - obj.toString = v.toString; - } - } - - return obj; -} - -module.exports = copyProperties; From 2b4762f18469a12f4056e18b5e6b76b2babb5579 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Tue, 21 Mar 2017 09:52:31 -0700 Subject: [PATCH 0025/1153] Only use `EventValidator` in development mode Summary: Only pulls in `EventValidator` for development mode, as warnings about invalid events are pointless in production builds. Reviewed By: javache Differential Revision: D4745852 fbshipit-source-id: dbab1026df35d54a82e1e620fac08304c58fbeae --- Libraries/EventEmitter/mixInEventEmitter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/EventEmitter/mixInEventEmitter.js b/Libraries/EventEmitter/mixInEventEmitter.js index 27b6726ed6b5..d5db027bb630 100644 --- a/Libraries/EventEmitter/mixInEventEmitter.js +++ b/Libraries/EventEmitter/mixInEventEmitter.js @@ -14,7 +14,6 @@ const EventEmitter = require('EventEmitter'); const EventEmitterWithHolding = require('EventEmitterWithHolding'); const EventHolder = require('EventHolder'); -const EventValidator = require('EventValidator'); const invariant = require('fbjs/lib/invariant'); const keyOf = require('fbjs/lib/keyOf'); @@ -119,7 +118,10 @@ const EventEmitterMixin = { __getEventEmitter: function() { if (!this.__eventEmitter) { let emitter = new EventEmitter(); - emitter = EventValidator.addValidation(emitter, this.__types); + if (__DEV__) { + const EventValidator = require('EventValidator'); + emitter = EventValidator.addValidation(emitter, this.__types); + } const holder = new EventHolder(); this.__eventEmitter = new EventEmitterWithHolding(emitter, holder); From 4797701b66a1e1b6eef4f283703b4245de52e17b Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 21 Mar 2017 11:32:14 -0700 Subject: [PATCH 0026/1153] packager: clear cache Reviewed By: davidaurelio Differential Revision: D4746429 fbshipit-source-id: 1a49a4b6db75658749346f0fd94dad68ff084203 --- packager/src/node-haste/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packager/src/node-haste/index.js b/packager/src/node-haste/index.js index fef220c58b47..0bf17a9115e1 100644 --- a/packager/src/node-haste/index.js +++ b/packager/src/node-haste/index.js @@ -71,6 +71,8 @@ type Options = { watch: boolean, }; +const JEST_HASTE_MAP_CACHE_BREAKER = 1; + class DependencyGraph extends EventEmitter { _opts: Options; @@ -104,7 +106,7 @@ class DependencyGraph extends EventEmitter { ignorePattern: {test: opts.ignoreFilePath}, maxWorkers: opts.maxWorkerCount, mocksPattern: '', - name: 'react-native-packager', + name: 'react-native-packager-' + JEST_HASTE_MAP_CACHE_BREAKER, platforms: Array.from(opts.platforms), providesModuleNodeModules: opts.providesModuleNodeModules, resetCache: opts.resetCache, From 314ec8726960e381371d2ce48728c41f5fc51f39 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 21 Mar 2017 12:37:10 -0700 Subject: [PATCH 0027/1153] Remove unused CxxMessageQueue Differential Revision: D4713064 fbshipit-source-id: 511b782279b89076228f00290e78ed155e2e723e --- React/ReactCxx.xcodeproj/project.pbxproj | 16 - ReactCommon/cxxreact/Android.mk | 1 - ReactCommon/cxxreact/BUCK | 1 - ReactCommon/cxxreact/CxxMessageQueue.cpp | 320 ------------------ ReactCommon/cxxreact/CxxMessageQueue.h | 83 ----- ReactCommon/cxxreact/Instance.cpp | 1 - ReactCommon/cxxreact/tests/BUCK | 1 - .../cxxreact/tests/CxxMessageQueueTest.cpp | 188 ---------- 8 files changed, 611 deletions(-) delete mode 100644 ReactCommon/cxxreact/CxxMessageQueue.cpp delete mode 100644 ReactCommon/cxxreact/CxxMessageQueue.h delete mode 100644 ReactCommon/cxxreact/tests/CxxMessageQueueTest.cpp diff --git a/React/ReactCxx.xcodeproj/project.pbxproj b/React/ReactCxx.xcodeproj/project.pbxproj index cef7f0d506bb..c375179209e0 100644 --- a/React/ReactCxx.xcodeproj/project.pbxproj +++ b/React/ReactCxx.xcodeproj/project.pbxproj @@ -172,7 +172,6 @@ 13F887581E2971D400C3C7A1 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887521E2971C500C3C7A1 /* Demangle.cpp */; }; 13F887591E2971D400C3C7A1 /* StringBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887531E2971C500C3C7A1 /* StringBase.cpp */; }; 13F8875A1E2971D400C3C7A1 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887541E2971C500C3C7A1 /* Unicode.cpp */; }; - 13F8876D1E29726200C3C7A1 /* CxxMessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A51E03699D0018521A /* CxxMessageQueue.cpp */; }; 13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; 13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; @@ -191,7 +190,6 @@ 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */; }; 13F8877F1E29726200C3C7A1 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D11E03699D0018521A /* Platform.cpp */; }; 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */; }; - 13F887811E29726300C3C7A1 /* CxxMessageQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A51E03699D0018521A /* CxxMessageQueue.cpp */; }; 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; 13F887841E29726300C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; 13F887851E29726300C3C7A1 /* JSCExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0B21E03699D0018521A /* JSCExecutor.cpp */; }; @@ -229,7 +227,6 @@ 191E3EBE1C29D9AF00C180A6 /* RCTRefreshControlManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 191E3EBD1C29D9AF00C180A6 /* RCTRefreshControlManager.m */; }; 191E3EC11C29DC3800C180A6 /* RCTRefreshControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 191E3EC01C29DC3800C180A6 /* RCTRefreshControl.m */; }; 19DED2291E77E29200F089BB /* systemJSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */; }; - 27595AA31E575C7800CCE2B1 /* CxxMessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A61E03699D0018521A /* CxxMessageQueue.h */; }; 27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; 27595AA51E575C7800CCE2B1 /* CxxNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; 27595AA61E575C7800CCE2B1 /* Executor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; }; @@ -256,7 +253,6 @@ 27595ABB1E575C7800CCE2B1 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D21E03699D0018521A /* Platform.h */; }; 27595ABC1E575C7800CCE2B1 /* SampleCxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; 27595ABD1E575C7800CCE2B1 /* SystraceSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; - 27595ABE1E575C7800CCE2B1 /* CxxMessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A61E03699D0018521A /* CxxMessageQueue.h */; }; 27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; 27595AC01E575C7800CCE2B1 /* CxxNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; 27595AC11E575C7800CCE2B1 /* Executor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; }; @@ -744,7 +740,6 @@ 3D8ED92C1E5B120100D83D20 /* libcxxreact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */; }; 3D8ED92D1E5B120100D83D20 /* libyoga.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3C06751DE3340C00C268FA /* libyoga.a */; }; 3DA9819E1E5B0DBB004F2374 /* NSDataBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454B31E54786200E74ADD /* NSDataBigString.h */; }; - 3DA9819F1E5B0E34004F2374 /* CxxMessageQueue.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A61E03699D0018521A /* CxxMessageQueue.h */; }; 3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; 3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; 3DA981A21E5B0E34004F2374 /* Executor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; }; @@ -891,7 +886,6 @@ 3DA982361E5B0F7F004F2374 /* RCTWrapperViewController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */; }; 3DA982381E5B0F7F004F2374 /* UIView+React.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; 3DA982391E5B0F8A004F2374 /* UIView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F15A171B7CC46900F10295 /* UIView+Private.h */; }; - 3DA9823A1E5B1053004F2374 /* CxxMessageQueue.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A61E03699D0018521A /* CxxMessageQueue.h */; }; 3DA9823B1E5B1053004F2374 /* CxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; 3DA9823C1E5B1053004F2374 /* CxxNativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; 3DA9823D1E5B1053004F2374 /* Executor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; }; @@ -1201,7 +1195,6 @@ dstPath = include/cxxreact; dstSubfolderSpec = 16; files = ( - 3DA9823A1E5B1053004F2374 /* CxxMessageQueue.h in Copy Headers */, 3DA9823B1E5B1053004F2374 /* CxxModule.h in Copy Headers */, 3DA9823C1E5B1053004F2374 /* CxxNativeModule.h in Copy Headers */, 3DA9823D1E5B1053004F2374 /* Executor.h in Copy Headers */, @@ -1400,7 +1393,6 @@ dstPath = include/cxxreact; dstSubfolderSpec = 16; files = ( - 3DA9819F1E5B0E34004F2374 /* CxxMessageQueue.h in Copy Headers */, 3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */, 3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */, 3DA981A21E5B0E34004F2374 /* Executor.h in Copy Headers */, @@ -1720,8 +1712,6 @@ 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCWrapper.h; sourceTree = ""; }; 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCErrorHandling.mm; sourceTree = ""; }; 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NSDataBigString.mm; sourceTree = ""; }; - 3D92B0A51E03699D0018521A /* CxxMessageQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CxxMessageQueue.cpp; sourceTree = ""; }; - 3D92B0A61E03699D0018521A /* CxxMessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxMessageQueue.h; sourceTree = ""; }; 3D92B0A71E03699D0018521A /* CxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxModule.h; sourceTree = ""; }; 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CxxNativeModule.cpp; sourceTree = ""; }; 3D92B0A91E03699D0018521A /* CxxNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxNativeModule.h; sourceTree = ""; }; @@ -2416,8 +2406,6 @@ AC70D2EA1DE489FC002E6351 /* cxxreact */ = { isa = PBXGroup; children = ( - 3D92B0A51E03699D0018521A /* CxxMessageQueue.cpp */, - 3D92B0A61E03699D0018521A /* CxxMessageQueue.h */, 3D92B0A71E03699D0018521A /* CxxModule.h */, 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */, 3D92B0A91E03699D0018521A /* CxxNativeModule.h */, @@ -2660,7 +2648,6 @@ 3D3030221DF8294C00D6DDAE /* JSBundleType.h in Headers */, 27595ACA1E575C7800CCE2B1 /* JSCMemory.h in Headers */, 3D74547D1E54758900E74ADD /* JSBigString.h in Headers */, - 27595ABE1E575C7800CCE2B1 /* CxxMessageQueue.h in Headers */, 27595AC71E575C7800CCE2B1 /* JSCExecutor.h in Headers */, 27595ACD1E575C7800CCE2B1 /* JSCSamplingProfiler.h in Headers */, 27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */, @@ -2732,7 +2719,6 @@ 3D3CD9471DE5FC7800167DC4 /* oss-compat-util.h in Headers */, 27595AAF1E575C7800CCE2B1 /* JSCMemory.h in Headers */, 3D74547C1E54758900E74ADD /* JSBigString.h in Headers */, - 27595AA31E575C7800CCE2B1 /* CxxMessageQueue.h in Headers */, 27595AAC1E575C7800CCE2B1 /* JSCExecutor.h in Headers */, 27595AB21E575C7800CCE2B1 /* JSCSamplingProfiler.h in Headers */, 27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */, @@ -3436,7 +3422,6 @@ 13F8877F1E29726200C3C7A1 /* Platform.cpp in Sources */, 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */, 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */, - 13F8876D1E29726200C3C7A1 /* CxxMessageQueue.cpp in Sources */, 13F887761E29726200C3C7A1 /* JSCNativeModules.cpp in Sources */, 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */, ); @@ -3460,7 +3445,6 @@ 3D80D9181DF6F7A80028D040 /* JSBundleType.cpp in Sources */, 13F8878F1E29726300C3C7A1 /* MethodCall.cpp in Sources */, 13F887921E29726300C3C7A1 /* Platform.cpp in Sources */, - 13F887811E29726300C3C7A1 /* CxxMessageQueue.cpp in Sources */, 13F887911E29726300C3C7A1 /* NativeToJsBridge.cpp in Sources */, 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */, 13F887891E29726300C3C7A1 /* JSCNativeModules.cpp in Sources */, diff --git a/ReactCommon/cxxreact/Android.mk b/ReactCommon/cxxreact/Android.mk index 6f33a13ef738..f9cdb1976ab8 100644 --- a/ReactCommon/cxxreact/Android.mk +++ b/ReactCommon/cxxreact/Android.mk @@ -5,7 +5,6 @@ include $(CLEAR_VARS) LOCAL_MODULE := libreactnativefb LOCAL_SRC_FILES := \ - CxxMessageQueue.cpp \ CxxNativeModule.cpp \ Instance.cpp \ JSCExecutor.cpp \ diff --git a/ReactCommon/cxxreact/BUCK b/ReactCommon/cxxreact/BUCK index 8e94880e2546..49b2b54e5eca 100644 --- a/ReactCommon/cxxreact/BUCK +++ b/ReactCommon/cxxreact/BUCK @@ -127,7 +127,6 @@ cxx_library( ) CXXREACT_PUBLIC_HEADERS = [ - "CxxMessageQueue.h", "CxxNativeModule.h", "Executor.h", "ExecutorToken.h", diff --git a/ReactCommon/cxxreact/CxxMessageQueue.cpp b/ReactCommon/cxxreact/CxxMessageQueue.cpp deleted file mode 100644 index e83a3c90a42a..000000000000 --- a/ReactCommon/cxxreact/CxxMessageQueue.cpp +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#include "CxxMessageQueue.h" - -#include - -#include -#include -#include - -#include - -namespace facebook { -namespace react { - -using detail::BinarySemaphore; -using detail::EventFlag; - -using clock = std::chrono::steady_clock; -using time_point = clock::time_point; -static_assert(std::is_same::value, ""); - -namespace { -time_point now() { - return clock::now(); -} - -class Task { - public: - static Task* create(std::function&& func) { - return new Task{std::move(func), false, time_point()}; - } - - static Task* createSync(std::function&& func) { - return new Task{std::move(func), true, time_point()}; - } - - static Task* createDelayed(std::function&& func, time_point startTime) { - return new Task{std::move(func), false, startTime}; - } - - std::function func; - // This flag is just to mark that the task is expected to be synchronous. If - // a synchronous task races with stopping the queue, the thread waiting on - // the synchronous task might never resume. We use this flag to detect this - // case and throw an error. - bool sync; - time_point startTime; - - folly::AtomicIntrusiveLinkedListHook hook; - - // Should this sort consider id also? - struct Compare { - bool operator()(const Task* a, const Task* b) { - return a->startTime > b->startTime; - } - }; -}; - -class DelayedTaskQueue { - public: - ~DelayedTaskQueue() { - while (!queue_.empty()) { - delete queue_.top(); - queue_.pop(); - } - } - - void process() { - while (!queue_.empty()) { - Task* d = queue_.top(); - if (now() < d->startTime) { - break; - } - auto owned = std::unique_ptr(queue_.top()); - queue_.pop(); - owned->func(); - } - } - - void push(Task* t) { - queue_.push(t); - } - - bool empty() { - return queue_.empty(); - } - - time_point nextTime() { - return queue_.top()->startTime; - } - private: - std::priority_queue, Task::Compare> queue_; -}; - -} - -class CxxMessageQueue::QueueRunner { - public: - ~QueueRunner() { - queue_.sweep([] (Task* t) { - delete t; - }); - } - - void enqueue(std::function&& func) { - enqueueTask(Task::create(std::move(func))); - } - - void enqueueDelayed(std::function&& func, uint64_t delayMs) { - if (delayMs) { - enqueueTask(Task::createDelayed(std::move(func), now() + std::chrono::milliseconds(delayMs))); - } else { - enqueue(std::move(func)); - } - } - - void enqueueSync(std::function&& func) { - EventFlag done; - enqueueTask(Task::createSync([&] () mutable { - func(); - done.set(); - })); - if (stopped_) { - // If this queue is stopped_, the sync task might never actually run. - throw std::runtime_error("Stopped within enqueueSync."); - } - done.wait(); - } - - void stop() { - stopped_ = true; - pending_.set(); - } - - bool isStopped() { - return stopped_; - } - - void quitSynchronous() { - stop(); - finished_.wait(); - } - - void run() { - // If another thread stops this one, then the acquire-release on pending_ - // ensures that we read stopped some time after it was set (and other - // threads just have to deal with the fact that we might run a task "after" - // they stop us). - // - // If we are stopped on this thread, then memory order doesn't really - // matter reading stopped_. - while (!stopped_.load(std::memory_order_relaxed)) { - sweep(); - if (delayed_.empty()) { - pending_.wait(); - } else { - pending_.wait_until(delayed_.nextTime()); - } - } - // This sweep is just to catch erroneous enqueueSync. That is, there could - // be a task marked sync that another thread is waiting for, but we'll - // never actually run it. - sweep(); - finished_.set(); - } - - // We are processing two queues, the posted tasks (queue_) and the delayed - // tasks (delayed_). Delayed tasks first go into posted tasks, and then are - // moved to the delayed queue if we pop them before the time they are - // scheduled for. - // As we pop things from queue_, before dealing with that thing, we run any - // delayed tasks whose scheduled time has arrived. - void sweep() { - queue_.sweep([this] (Task* t) { - std::unique_ptr owned(t); - if (stopped_.load(std::memory_order_relaxed)) { - if (t->sync) { - throw std::runtime_error("Sync task posted while stopped."); - } - return; - } - - delayed_.process(); - if (t->startTime != time_point() && now() <= t->startTime) { - delayed_.push(owned.release()); - } else { - t->func(); - } - }); - delayed_.process(); - } - - void bindToThisThread() { - // TODO: handle nested runloops (either allow them or throw an exception). - if (tid_ != std::thread::id{}) { - throw std::runtime_error("Message queue already bound to thread."); - } - tid_ = std::this_thread::get_id(); - } - - bool isOnQueue() { - return std::this_thread::get_id() == tid_; - } - - private: - void enqueueTask(Task* task) { - if (queue_.insertHead(task)) { - pending_.set(); - } - } - - std::thread::id tid_; - - folly::AtomicIntrusiveLinkedList queue_; - - std::atomic_bool stopped_{false}; - DelayedTaskQueue delayed_; - - BinarySemaphore pending_; - EventFlag finished_; -}; - - -CxxMessageQueue::CxxMessageQueue() : qr_(new QueueRunner()) { - -} - -CxxMessageQueue::~CxxMessageQueue() { - // TODO(cjhopman): Add detach() so that the queue doesn't have to be - // explicitly stopped. - if (!qr_->isStopped()) { - LOG(FATAL) << "Queue not stopped."; - } -} - -void CxxMessageQueue::runOnQueue(std::function&& func) { - qr_->enqueue(std::move(func)); -} - -void CxxMessageQueue::runOnQueueDelayed(std::function&& func, uint64_t delayMs) { - qr_->enqueueDelayed(std::move(func), delayMs); -} - -void CxxMessageQueue::runOnQueueSync(std::function&& func) { - if (isOnQueue()) { - func(); - return; - } - qr_->enqueueSync(std::move(func)); -} - -void CxxMessageQueue::quitSynchronous() { - if (isOnQueue()) { - qr_->stop(); - } else { - qr_->quitSynchronous(); - } -} - -bool CxxMessageQueue::isOnQueue() { - return qr_->isOnQueue(); -} - -namespace { -struct MQRegistry { - std::weak_ptr find(std::thread::id tid) { - std::lock_guard g(lock_); - auto iter = registry_.find(tid); - if (iter == registry_.end()) return std::weak_ptr(); - return iter->second; - } - - void registerQueue(std::thread::id tid, std::weak_ptr mq) { - std::lock_guard g(lock_); - registry_[tid] = mq; - } - - void unregister(std::thread::id tid) { - std::lock_guard g(lock_); - registry_.erase(tid); - } - private: - std::mutex lock_; - std::unordered_map> registry_; -}; - -MQRegistry& getMQRegistry() { - static MQRegistry* mq_registry = new MQRegistry(); - return *mq_registry; -} -} - -std::shared_ptr CxxMessageQueue::current() { - auto tid = std::this_thread::get_id(); - return getMQRegistry().find(tid).lock(); -} - -std::function CxxMessageQueue::getUnregisteredRunLoop() { - return [capture=qr_] { - capture->bindToThisThread(); - capture->run(); - }; -} - -std::function CxxMessageQueue::getRunLoop(std::shared_ptr mq) { - return [capture=mq->qr_, weakMq=std::weak_ptr(mq)] { - capture->bindToThisThread(); - auto tid = std::this_thread::get_id(); - - getMQRegistry().registerQueue(tid, weakMq); - capture->run(); - getMQRegistry().unregister(tid); - }; -} - - - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/cxxreact/CxxMessageQueue.h b/ReactCommon/cxxreact/CxxMessageQueue.h deleted file mode 100644 index 626d058993a8..000000000000 --- a/ReactCommon/cxxreact/CxxMessageQueue.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include - -namespace facebook { -namespace react { - -namespace detail { -template -class CVFlag { - public: - using time_point = std::chrono::steady_clock::time_point; - void set() { - std::lock_guard lk(mtx_); - flag_ = true; - cv_.notify_one(); - } - - void wait() { - std::unique_lock lk(mtx_); - cv_.wait(lk, [this] { return flag_; }); - if (clearOnWait) flag_ = false; - } - - bool wait_until(time_point d) { - std::unique_lock lk(mtx_); - bool res = cv_.wait_until(lk, d, [this] { return flag_; }); - if (clearOnWait && res) flag_ = false; - return res; - } - - private: - bool flag_{false}; - std::condition_variable cv_; - std::mutex mtx_; -}; - -using BinarySemaphore = CVFlag; -using EventFlag = CVFlag; -} - -class CxxMessageQueue : public MessageQueueThread { - public: - CxxMessageQueue(); - virtual ~CxxMessageQueue() override; - virtual void runOnQueue(std::function&&) override; - void runOnQueueDelayed(std::function&&, uint64_t delayMs); - // runOnQueueSync and quitSynchronous are dangerous. They should only be - // used for initialization and cleanup. - virtual void runOnQueueSync(std::function&&) override; - // Once quitSynchronous() returns, no further work should run on the queue. - virtual void quitSynchronous() override; - - bool isOnQueue(); - - // If this getRunLoop is used, current() will not work. - std::function getUnregisteredRunLoop(); - - // This returns a function that will actually run the runloop. - // This runloop will return some time after quitSynchronous (or after this is destroyed). - // - // When running the runloop, it is important to ensure that no frames in the - // current stack have a strong reference to the queue. - // - // Only one thread should run the runloop. - static std::function getRunLoop(std::shared_ptr mq); - - static std::shared_ptr current(); - private: - class QueueRunner; - std::shared_ptr qr_; -}; - -}} diff --git a/ReactCommon/cxxreact/Instance.cpp b/ReactCommon/cxxreact/Instance.cpp index 4188fe5720ea..5b80fa5df901 100644 --- a/ReactCommon/cxxreact/Instance.cpp +++ b/ReactCommon/cxxreact/Instance.cpp @@ -2,7 +2,6 @@ #include "Instance.h" -#include "CxxMessageQueue.h" #include "Executor.h" #include "MethodCall.h" #include "RecoverableError.h" diff --git a/ReactCommon/cxxreact/tests/BUCK b/ReactCommon/cxxreact/tests/BUCK index f181d7474a91..f8f29de42473 100644 --- a/ReactCommon/cxxreact/tests/BUCK +++ b/ReactCommon/cxxreact/tests/BUCK @@ -1,5 +1,4 @@ TEST_SRCS = [ - "CxxMessageQueueTest.cpp", "RecoverableErrorTest.cpp", "jsarg_helpers.cpp", "jsbigstring.cpp", diff --git a/ReactCommon/cxxreact/tests/CxxMessageQueueTest.cpp b/ReactCommon/cxxreact/tests/CxxMessageQueueTest.cpp deleted file mode 100644 index f0949cb4043c..000000000000 --- a/ReactCommon/cxxreact/tests/CxxMessageQueueTest.cpp +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -#include - -#include - -#include -#include - -using namespace facebook::react; -using detail::EventFlag; -using time_point = EventFlag::time_point; - -using std::chrono::milliseconds; - -namespace { -time_point now() { - return std::chrono::steady_clock::now(); -} - -std::shared_ptr createAndStartQueue(EventFlag& finishedFlag) { - auto q = std::make_shared(); - std::thread t([q, &finishedFlag] () mutable { - auto loop = CxxMessageQueue::getRunLoop(q); - // Note: make sure that no stack frames above loop() have a strong reference to q. - q.reset(); - loop(); - finishedFlag.set(); - }); - t.detach(); - return q; -} - -std::unique_ptr createAndStartUnregisteredQueue( - EventFlag& finishedFlag) { - auto q = std::make_unique(); - std::thread t([loop=q->getUnregisteredRunLoop(), &finishedFlag] { - loop(); - finishedFlag.set(); - }); - t.detach(); - return q; -} - -// This is just used to start up a queue for a test and make sure that it is -// actually shut down after the test. -struct QueueWithThread { - QueueWithThread() { - queue = createAndStartQueue(done); - } - - ~QueueWithThread() { - queue->quitSynchronous(); - queue.reset(); - EXPECT_TRUE(done.wait_until(now() + milliseconds(300))) << "Queue did not exit"; - } - - EventFlag done; - std::shared_ptr queue; -}; -} - -TEST(CxxMessageQueue, TestQuit) { - EventFlag done; - auto q = createAndStartQueue(done); - q->quitSynchronous(); - EXPECT_TRUE(done.wait_until(now() + milliseconds(300))) - << "Queue did not exit runloop after quitSynchronous"; -} - -TEST(CxxMessageQueue, TestPostTask) { - QueueWithThread qt; - auto q = qt.queue; - - EventFlag flag; - q->runOnQueue([&] { - flag.set(); - }); - flag.wait(); -} - -TEST(CxxMessageQueue, TestPostUnregistered) { - EventFlag qdone; - auto q = createAndStartUnregisteredQueue(qdone); - - EventFlag tflag; - q->runOnQueue([&] { - tflag.set(); - }); - tflag.wait(); - - q->quitSynchronous(); - q.reset(); - EXPECT_TRUE(qdone.wait_until(now() + milliseconds(300))) << "Queue did not exit"; -} - -TEST(CxxMessageQueue, TestPostCurrent) { - QueueWithThread qt; - auto q = qt.queue; - - EventFlag flag; - q->runOnQueue([&] { - CxxMessageQueue::current()->runOnQueue([&] { - flag.set(); - }); - }); - flag.wait(); -} - -TEST(CxxMessageQueue, TestPostTaskMultiple) { - QueueWithThread qt; - auto q = qt.queue; - - std::vector vec(10); - for (int i = 0; i < 10; i++) { - q->runOnQueue([&, i] { - vec[i].set(); - }); - } - for (int i = 0; i < 10; i++) { - vec[i].wait(); - } -} - -TEST(CxxMessageQueue, TestQueuedTaskOrdering) { - QueueWithThread qt; - auto q = qt.queue; - - // Block the runloop so we can get some queued tasks. - EventFlag wait; - q->runOnQueue([&] { - wait.wait(); - }); - - // These tasks should run in order. - int failed = -1; - int i = 0; - for (int j = 0; j < 10; j++) { - q->runOnQueue([&, j] { - if (i != j) { - failed = j; - } - i++; - }); - } - wait.set(); - - // Flush the queue. - q->runOnQueueSync([&] {}); - - ASSERT_EQ(failed, -1); - ASSERT_EQ(i, 10); -} - -TEST(CxxMessageQueue, TestDelayedTaskOrdering) { - QueueWithThread qt; - auto q = qt.queue; - - // Block the runloop so we can get some queued tasks. - EventFlag wait; - q->runOnQueue([&] { - wait.wait(); - }); - - int ids[] = {8, 4, 6, 1, 3, 2, 9, 5, 0, 7}; - - int failed = -1; - int i = 0; - EventFlag done; - // If this loop actually takes longer than the difference between delays, the - // ordering could get screwed up :/ - for (int j = 0; j < 10; j++) { - q->runOnQueueDelayed([&, j] { - if (i != ids[j]) { - failed = j; - } - i++; - if (ids[j] == 9) { - done.set(); - } - }, 50 + 10 * ids[j]); - } - wait.set(); - done.wait(); - - ASSERT_EQ(failed, -1); - ASSERT_EQ(i, 10); -} From 1433185a092f70047cc8ef3f90a953a32d756326 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Tue, 21 Mar 2017 12:53:48 -0700 Subject: [PATCH 0028/1153] Improved implementation of placeholer feature in RCTUITextView Reviewed By: fkgozali Differential Revision: D4746177 fbshipit-source-id: a8c27ec052b046d4732b14ed081dcaebb44bdaa7 --- Libraries/Text/RCTUITextView.m | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/Libraries/Text/RCTUITextView.m b/Libraries/Text/RCTUITextView.m index 24302f823ed8..67ae7e5798ba 100644 --- a/Libraries/Text/RCTUITextView.m +++ b/Libraries/Text/RCTUITextView.m @@ -36,7 +36,6 @@ - (instancetype)initWithFrame:(CGRect)frame object:self]; _placeholderView = [[UILabel alloc] initWithFrame:self.bounds]; - _placeholderView.hidden = YES; _placeholderView.isAccessibilityElement = NO; _placeholderView.numberOfLines = 0; [self addSubview:_placeholderView]; @@ -55,20 +54,19 @@ - (void)dealloc - (void)setPlaceholderText:(NSString *)placeholderText { _placeholderText = placeholderText; - [self invalidatePlaceholder]; + _placeholderView.text = _placeholderText; } - (void)setPlaceholderTextColor:(UIColor *)placeholderTextColor { _placeholderTextColor = placeholderTextColor; - [self invalidatePlaceholder]; + _placeholderView.textColor = _placeholderTextColor ?: defaultPlaceholderTextColor(); } - - (void)textDidChange { _textWasPasted = NO; - [self invalidatePlaceholder]; + [self invalidatePlaceholderVisibility]; } #pragma mark - UIResponder @@ -101,7 +99,13 @@ - (void)didMoveToWindow - (void)setFont:(UIFont *)font { [super setFont:font]; - [self invalidatePlaceholder]; + _placeholderView.font = font ?: defaultPlaceholderFont(); +} + +- (void)setTextAlignment:(NSTextAlignment)textAlignment +{ + [super setTextAlignment:textAlignment]; + _placeholderView.textAlignment = textAlignment; } - (void)setText:(NSString *)text @@ -168,22 +172,10 @@ - (CGSize)sizeThatFits:(CGSize)size #pragma mark - Placeholder -- (void)invalidatePlaceholder +- (void)invalidatePlaceholderVisibility { - BOOL wasVisible = !_placeholderView.isHidden; BOOL isVisible = _placeholderText.length != 0 && self.text.length == 0; - - if (wasVisible != isVisible) { - _placeholderView.hidden = !isVisible; - } - - if (isVisible) { - _placeholderView.font = self.font ?: defaultPlaceholderFont(); - _placeholderView.textColor = _placeholderTextColor ?: defaultPlaceholderTextColor(); - _placeholderView.textAlignment = self.textAlignment; - _placeholderView.text = _placeholderText; - [self setNeedsLayout]; - } + _placeholderView.hidden = !isVisible; } @end From ee245b9be8e05b6e2a37b2771bd1b2d9e00ad16d Mon Sep 17 00:00:00 2001 From: "Andrew Y. Chen" Date: Tue, 21 Mar 2017 14:45:37 -0700 Subject: [PATCH 0029/1153] Fix instrumentation tests for api 22 Summary: Bug in Android https://code.google.com/p/android/issues/detail?id=33868 causes the RN catalyst instrumentation test to fail with ``` java.lang.ArrayIndexOutOfBoundsException: length=253; index=-1 at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:667) at android.text.StaticLayout.out(StaticLayout.java:631) at android.text.StaticLayout.generate(StaticLayout.java:423) ... ``` The fix is to set singleLine to true when there is only one line of text Reviewed By: AaaChiuuu Differential Revision: D4562000 fbshipit-source-id: 84248e3982063b767e8b0465effe2321b54a7fa2 --- .../main/java/com/facebook/react/views/text/ReactTextView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java index 3d5d9668bd81..fa8f87710b1b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java @@ -231,6 +231,7 @@ public void setBackgroundColor(int color) { public void setNumberOfLines(int numberOfLines) { mNumberOfLines = numberOfLines == 0 ? ViewDefaults.NUMBER_OF_LINES : numberOfLines; + setSingleLine(mNumberOfLines == 1); setMaxLines(mNumberOfLines); } From a0304327a9c1989b49ac4c106d824e2b31a6cc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Tue, 21 Mar 2017 15:13:04 -0700 Subject: [PATCH 0030/1153] Remove Navigator recommendation Summary: We recommend using `react-navigation` over `Navigator`. Adds a link to the new `native-navigation` component as well. Did not test website generation, this is a comments only edit that should work fine. Closes https://github.com/facebook/react-native/pull/12963 Differential Revision: D4749072 Pulled By: hramos fbshipit-source-id: 4506630306c44b24b95c4f5d5a42c1caa9e2cd4e --- Libraries/Components/Navigation/NavigatorIOS.ios.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/Components/Navigation/NavigatorIOS.ios.js b/Libraries/Components/Navigation/NavigatorIOS.ios.js index 90a6c37e9820..10c18e0c5077 100644 --- a/Libraries/Components/Navigation/NavigatorIOS.ios.js +++ b/Libraries/Components/Navigation/NavigatorIOS.ios.js @@ -133,10 +133,10 @@ type Event = Object; * animations and behavior from UIKIt. * * As the name implies, it is only available on iOS. Take a look at - * [`Navigator`](docs/navigator.html) for a similar solution for your - * cross-platform needs, or check out - * [react-native-navigation](https://github.com/wix/react-native-navigation), a - * component that aims to provide native navigation on both iOS and Android. + * [`React Navigation`](https://reactnavigation.org/) for a cross-platform + * solution in JavaScript, or check out either of these components for native + * solutions: [native-navigation](http://airbnb.io/native-navigation/), + * [react-native-navigation](https://github.com/wix/react-native-navigation). * * To set up the navigator, provide the `initialRoute` prop with a route * object. A route object is used to describe each scene that your app From 68c655a2fdabcd053f7dbf92dcbe70d1f45a40c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Tue, 21 Mar 2017 15:40:04 -0700 Subject: [PATCH 0031/1153] Update ISSUE_TEMPLATE.md Summary: Some quick copy changes. Closes https://github.com/facebook/react-native/pull/13061 Differential Revision: D4749511 Pulled By: hramos fbshipit-source-id: 5b6f67be40ed071367507ac3c87f7ac67a0584e7 --- .github/ISSUE_TEMPLATE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 7acc05e46e16..dcb01c326bed 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -15,7 +15,7 @@ Your issue may be closed without explanation if it does not provide the informat ### Reproduction -[FILL THIS OUT: Try to reproduce your bug on https://sketch.expo.io/ and provide a link. If you can't reproduce the bug on Sketch, provide a sample project.] +[FILL THIS OUT: Try to reproduce your bug on https://sketch.expo.io/ and provide a link. If you can't reproduce the bug on Sketch, provide a sample project. At the very least, provide an example of your code.] ### Solution @@ -23,7 +23,7 @@ Your issue may be closed without explanation if it does not provide the informat ### Additional Information -* React Native version: [FILL THIS OUT: Does the bug reproduce on the latest RN release?] +* React Native version: [FILL THIS OUT: Be specific, filling out "latest" here is not enough.] * Platform: [FILL THIS OUT: iOS, Android, or both?] -* Operating System: [FILL THIS OUT: 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] From ba75d9903368e90b5c7a9b61e222609b5ac9acb7 Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Tue, 21 Mar 2017 16:01:44 -0700 Subject: [PATCH 0032/1153] don't call clearFrameCallback() if we don't have a ReactChoreographer to clear the frame callback on Reviewed By: achen1 Differential Revision: D4741906 fbshipit-source-id: 2d5fabab6e04c08252513f77149c04e3b8314d2c --- .../facebook/react/animated/NativeAnimatedModule.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index c16e2acd0bcb..d4fd0680ff51 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -13,6 +13,7 @@ import java.util.ArrayList; +import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Callback; @@ -70,10 +71,12 @@ * isolates us from the problems that may be caused by concurrent updates of animated graph while UI * thread is "executing" the animation loop. */ -@ReactModule(name = "NativeAnimatedModule") +@ReactModule(name = NativeAnimatedModule.NAME) public class NativeAnimatedModule extends ReactContextBaseJavaModule implements OnBatchCompleteListener, LifecycleEventListener { + protected static final String NAME = "NativeAnimatedModule"; + private interface UIThreadOperation { void execute(NativeAnimatedNodesManager animatedNodesManager); } @@ -159,6 +162,10 @@ public void onBatchComplete() { @Override public void onHostPause() { + if (mReactChoreographer == null) { + FLog.e(NAME, "Called NativeAnimated.onHostPause() with a null ReactChoreographer."); + return; + } clearFrameCallback(); } @@ -169,7 +176,7 @@ public void onHostDestroy() { @Override public String getName() { - return "NativeAnimatedModule"; + return NAME; } private void clearFrameCallback() { From c41b29d6de8241e5b9269034ece30d5c8803c938 Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Tue, 21 Mar 2017 16:21:46 -0700 Subject: [PATCH 0033/1153] Fixes missleading comment on getInitialURL Summary: The returned value from Linking.getInitialURL is a promise that returns an url. Can be seen here: https://github.com/facebook/react-native/blob/f126540519bd276c0048aa77b543dc863412de46/Libraries/Linking/Linking.js#L175 Closes https://github.com/facebook/react-native/pull/12851 Differential Revision: D4716084 Pulled By: hramos fbshipit-source-id: 309881cfb423a5c9a3f9010ae7ca226b63c91599 --- Libraries/Linking/Linking.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index 1902bfb2a793..0f50b15bd5ee 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -33,7 +33,7 @@ const LinkingManager = Platform.OS === 'android' ? * * ``` * componentDidMount() { - * var url = Linking.getInitialURL().then((url) => { + * Linking.getInitialURL().then((url) => { * if (url) { * console.log('Initial url is: ' + url); * } From d9ac00735c7670eb41e46c6effdb3ae4a91e5ec0 Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Tue, 21 Mar 2017 18:24:58 -0700 Subject: [PATCH 0034/1153] Make the choice of bridge based on an optional delegate method Reviewed By: javache Differential Revision: D4679644 fbshipit-source-id: f53e554e283fdb0b59c41623e690fd1a21e03a57 --- React/Base/RCTBridge.m | 26 ++++++++++++++++- React/Base/RCTBridgeDelegate.h | 14 ++++++++++ React/CxxBridge/RCTCxxBridge.h | 17 ------------ React/CxxBridge/RCTCxxBridge.mm | 49 ++------------------------------- 4 files changed, 42 insertions(+), 64 deletions(-) delete mode 100644 React/CxxBridge/RCTCxxBridge.h diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 5fa260caf6fd..0fe05ca8bb4a 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -302,7 +302,31 @@ - (void)setUp - (void)createBatchedBridge { - self.batchedBridge = [[RCTBatchedBridge alloc] initWithParentBridge:self]; + // In order to facilitate switching between bridges with only build + // file changes, this uses reflection to check which bridges are + // available. This is a short-term hack until RCTBatchedBridge is + // removed. + + Class batchedBridgeClass = objc_lookUpClass("RCTBatchedBridge"); + Class cxxBridgeClass = objc_lookUpClass("RCTCxxBridge"); + + Class implClass = nil; + + if ([self.delegate respondsToSelector:@selector(shouldBridgeUseCxxBridge:)]) { + if ([self.delegate shouldBridgeUseCxxBridge:self]) { + implClass = cxxBridgeClass; + } else { + implClass = batchedBridgeClass; + } + } else if (batchedBridgeClass != nil) { + implClass = batchedBridgeClass; + } else if (cxxBridgeClass != nil) { + implClass = cxxBridgeClass; + } + + RCTAssert(implClass != nil, @"No bridge implementation is available, giving up."); + + self.batchedBridge = [[implClass alloc] initWithParentBridge:self]; } - (BOOL)isLoading diff --git a/React/Base/RCTBridgeDelegate.h b/React/Base/RCTBridgeDelegate.h index 343a2275dcf0..7639339858ca 100644 --- a/React/Base/RCTBridgeDelegate.h +++ b/React/Base/RCTBridgeDelegate.h @@ -91,6 +91,20 @@ */ - (BOOL)shouldBridgeUseCustomJSC:(RCTBridge *)bridge; +/** + * Configure whether the legacy RCTBatchedBridge or new RCTCxxBridge + * should be used. If this method is implemented and the specified + * bridge is not linked in, startup will fail. If this method is not + * implemented, the implementation will default to RCTBatchedBridge, + * but if it is not linked in, will try RCTCxxBridge instead. If + * neither bridge is linked in, startup will fail. This order will be + * reversed in the near future, as the legacy bridge is closer to + * being removed. + * + * @experimental + */ +- (BOOL)shouldBridgeUseCxxBridge:(RCTBridge *)bridge; + /** * The bridge will automatically attempt to load the JS source code from the * location specified by the `sourceURLForBridge:` method, however, if you want diff --git a/React/CxxBridge/RCTCxxBridge.h b/React/CxxBridge/RCTCxxBridge.h deleted file mode 100644 index 89ac4d01e0ce..000000000000 --- a/React/CxxBridge/RCTCxxBridge.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -@interface RCTCxxBridge : RCTBridge - -+ (void)enable; -+ (void)disable; - -@end diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index e48906af72e4..ee84db6be1ad 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -9,8 +9,6 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -#include "RCTCxxBridge.h" - #include #include #include @@ -48,6 +46,9 @@ #import #endif +@interface RCTCxxBridge : RCTBridge +@end + #define RCTAssertJSThread() \ RCTAssert(self.executorClass || self->_jsThread == [NSThread currentThread], \ @"This method must be called on JS thread") @@ -92,8 +93,6 @@ static bool isRAMBundle(NSData *script) { return parseTypeFromHeader(header) == ScriptTag::RAMBundle; } -static std::atomic_bool cxxBridgeEnabled(false); - @interface RCTCxxBridge () @property (nonatomic, weak, readonly) RCTBridge *parentBridge; @@ -121,19 +120,6 @@ ExecutorToken createExecutorToken() override { void onExecutorStopped(ExecutorToken) override {} }; -@implementation RCTBridge (CxxBridge) - -- (void)CXX_createBatchedBridge -{ - if (cxxBridgeEnabled) { - self.batchedBridge = [[RCTCxxBridge alloc] initWithParentBridge:self]; - } else { - self.batchedBridge = [[RCTBatchedBridge alloc] initWithParentBridge:self]; - } -} - -@end - @implementation RCTCxxBridge { BOOL _wasBatchActive; @@ -172,35 +158,6 @@ + (void)initialize } } -+ (void)swizzleBridge -{ - // Swizzle RCTBridge to use this, instead of RCTBatchedBridge - static dispatch_once_t once; - dispatch_once(&once, ^{ - RCTSwapInstanceMethods([RCTBridge class], - NSSelectorFromString(@"createBatchedBridge"), - @selector(CXX_createBatchedBridge)); - }); -} - -+ (void)enable -{ - [RCTCxxBridge swizzleBridge]; -#ifdef WITH_FBSYSTRACE - [RCTFBSystrace registerCallbacks]; -#endif - cxxBridgeEnabled = true; -} - -+ (void)disable -{ - [RCTCxxBridge swizzleBridge]; -#ifdef WITH_FBSYSTRACE - [RCTFBSystrace unregisterCallbacks]; -#endif - cxxBridgeEnabled = false; -} - - (JSContext *)jsContext { return contextForGlobalContextRef((JSGlobalContextRef) self->_reactInstance->getJavaScriptContext()); From ba149d72772111758b12b76db56c60dea5b1ef26 Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Tue, 21 Mar 2017 18:25:00 -0700 Subject: [PATCH 0035/1153] Tease apart React and RCTBatchedBridge targets Reviewed By: javache Differential Revision: D4679655 fbshipit-source-id: 8123488c2d50dd7cc2329b5131e99998fe1f1e2f --- Examples/UIExplorer/UIExplorer/maincxx.m | 28 --- .../UIExplorerCxx.xcodeproj/project.pbxproj | 202 +++++++++--------- .../xcschemes/UIExplorer.xcscheme | 31 +++ Libraries/RCTTest/RCTTestRunner.m | 18 -- React/Base/RCTBatchedBridge.m | 5 +- React/Base/RCTBridge.m | 62 +++--- .../{Executors => Base}/RCTJSCErrorHandling.h | 0 .../RCTJSCErrorHandling.mm | 0 React/CxxBridge/RCTCxxBridge.mm | 26 +-- React/CxxBridge/RCTJSCHelpers.h | 19 ++ React/CxxBridge/RCTJSCHelpers.mm | 52 +++++ React/Executors/RCTJSCExecutor.mm | 22 +- React/Profiler/RCTJSCProfiler.m | 2 +- React/Profiler/RCTPerfMonitor.m | 1 - React/Profiler/RCTProfile.m | 4 +- React/React.xcodeproj/project.pbxproj | 24 +-- React/ReactCxx.xcodeproj/project.pbxproj | 127 ++++------- 17 files changed, 309 insertions(+), 314 deletions(-) delete mode 100644 Examples/UIExplorer/UIExplorer/maincxx.m rename React/{Executors => Base}/RCTJSCErrorHandling.h (100%) rename React/{Executors => Base}/RCTJSCErrorHandling.mm (100%) create mode 100644 React/CxxBridge/RCTJSCHelpers.h create mode 100644 React/CxxBridge/RCTJSCHelpers.mm diff --git a/Examples/UIExplorer/UIExplorer/maincxx.m b/Examples/UIExplorer/UIExplorer/maincxx.m deleted file mode 100644 index 8a294046c659..000000000000 --- a/Examples/UIExplorer/UIExplorer/maincxx.m +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - -/** - * The examples provided by Facebook are for non-commercial testing and - * evaluation purposes only. - * - * Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - [RCTCxxBridge enable]; - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/Examples/UIExplorer/UIExplorerCxx.xcodeproj/project.pbxproj b/Examples/UIExplorer/UIExplorerCxx.xcodeproj/project.pbxproj index ad832206603f..b56552e8c733 100644 --- a/Examples/UIExplorer/UIExplorerCxx.xcodeproj/project.pbxproj +++ b/Examples/UIExplorer/UIExplorerCxx.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1344545A1AAFCAAE003F0779 /* libRCTAdSupport.a */; }; 134A8A2A1AACED7A00945AAE /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 134A8A251AACED6A00945AAE /* libRCTGeolocation.a */; }; 134CB92A1C85A38800265FA6 /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */; }; + 1380DCD41E70C44800E7C47D /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1380DC991E70C0DD00E7C47D /* libReact.a */; }; 138D6A181B53CD440074A87E /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */; }; 138DEE241B9EDFB6007F4EA5 /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */; }; 1393D0381B68CD1300E1B601 /* RCTModuleMethodTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.m */; }; @@ -23,10 +24,9 @@ 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13B6C1A31C34225900D3FAF5 /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */; }; 13BCE84F1C9C209600DD7AAD /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BCE84E1C9C209600DD7AAD /* RCTComponentPropsTests.m */; }; - 13CF8FD11E2966FF0005310D /* maincxx.m in Sources */ = {isa = PBXBuildFile; fileRef = 13CF8FD01E2966FF0005310D /* maincxx.m */; }; - 13CF8FF31E2967D10005310D /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13CF8FE01E2967C40005310D /* libReact.a */; }; 13DB03481B5D2ED500C27245 /* RCTJSONTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DB03471B5D2ED500C27245 /* RCTJSONTests.m */; }; 13DF61B61B67A45000EDB188 /* RCTMethodArgumentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13DF61B51B67A45000EDB188 /* RCTMethodArgumentTests.m */; }; 13E501F11D07A84A005F35D8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13E501A31D07A502005F35D8 /* libRCTAnimation.a */; }; @@ -90,6 +90,7 @@ 2DD323DD1DA2DDBF000FE1B8 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; 2DD323DE1DA2DDBF000FE1B8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 2DD323DF1DA2DDBF000FE1B8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 2DD323E01DA2DDBF000FE1B8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 2DD323E11DA2DDBF000FE1B8 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; 2DD323E21DA2DDBF000FE1B8 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB61A68108700A75B9A /* Info.plist */; }; 2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation-tvOS.a */; }; @@ -154,89 +155,89 @@ remoteGlobalIDString = 134814201AA4EA6300B7C361; remoteInfo = RCTGeolocation; }; - 138DEE081B9EDDDB007F4EA5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */ = { + 1380DC981E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 13CF8FDF1E2967C40005310D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = ReactCxx; + remoteInfo = React; }; - 13CF8FE11E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DC9A1E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 2D2A28131D9B038B00D4039D; - remoteInfo = "ReactCxx-tvOS"; + remoteInfo = "React-tvOS"; }; - 13CF8FE31E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DC9C1E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3D3C059A1DE3340900C268FA; remoteInfo = yoga; }; - 13CF8FE51E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DC9E1E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3D3C06751DE3340C00C268FA; remoteInfo = "yoga-tvOS"; }; - 13CF8FE71E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DCA01E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; remoteInfo = cxxreact; }; - 13CF8FE91E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DCA21E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; remoteInfo = "cxxreact-tvOS"; }; - 13CF8FEB1E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DCA41E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4; remoteInfo = jschelpers; }; - 13CF8FED1E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DCA61E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; remoteInfo = "jschelpers-tvOS"; }; - 13CF8FEF1E2967C40005310D /* PBXContainerItemProxy */ = { + 1380DCA81E70C0DD00E7C47D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7; + remoteInfo = "third-party"; + }; + 1380DCAA1E70C0DD00E7C47D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; proxyType = 2; remoteGlobalIDString = 139D7E881E25C6D100323FB7; remoteInfo = "double-conversion"; }; - 13CF8FF11E2967C40005310D /* PBXContainerItemProxy */ = { + 138DEE081B9EDDDB007F4EA5 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + containerPortal = 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */; proxyType = 2; - remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7; - remoteInfo = "third-party"; + remoteGlobalIDString = 58B5115D1A9E6B3D00147676; + remoteInfo = RCTImage; + }; + 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3C86DF461ADF2C930047B81A; + remoteInfo = RCTWebSocket; }; 13E501A21D07A502005F35D8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -391,6 +392,7 @@ 134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = ../../Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = ""; }; 134A8A201AACED6A00945AAE /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../../Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleInitTests.m; sourceTree = ""; }; + 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactCxx.xcodeproj; path = ../../React/ReactCxx.xcodeproj; sourceTree = ""; }; 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTShadowViewTests.m; sourceTree = ""; }; 138DEE021B9EDDDB007F4EA5 /* RCTCameraRoll.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTCameraRoll.xcodeproj; path = ../../Libraries/CameraRoll/RCTCameraRoll.xcodeproj; sourceTree = ""; }; 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTModuleMethodTests.m; sourceTree = ""; }; @@ -401,11 +403,10 @@ 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = UIExplorer/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = UIExplorer/Info.plist; sourceTree = ""; }; + 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = UIExplorer/main.m; sourceTree = ""; }; 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTURLUtilsTests.m; sourceTree = ""; }; 13BCE84E1C9C209600DD7AAD /* RCTComponentPropsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTComponentPropsTests.m; sourceTree = ""; }; 13CC9D481AEED2B90020D1C2 /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../../Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; - 13CF8FD01E2966FF0005310D /* maincxx.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = maincxx.m; path = UIExplorer/maincxx.m; sourceTree = ""; }; - 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactCxx.xcodeproj; path = ../../React/ReactCxx.xcodeproj; sourceTree = ""; }; 13DB03471B5D2ED500C27245 /* RCTJSONTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSONTests.m; sourceTree = ""; }; 13DF61B51B67A45000EDB188 /* RCTMethodArgumentTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMethodArgumentTests.m; sourceTree = ""; }; 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = ../../Libraries/NativeAnimation/RCTAnimation.xcodeproj; sourceTree = ""; }; @@ -486,7 +487,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 13CF8FF31E2967D10005310D /* libReact.a in Frameworks */, + 1380DCD41E70C44800E7C47D /* libReact.a in Frameworks */, 147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */, 134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */, 13E501F11D07A84A005F35D8 /* libRCTAnimation.a in Frameworks */, @@ -555,7 +556,7 @@ 1316A21D1AA397F400C0188E /* Libraries */ = { isa = PBXGroup; children = ( - 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */, + 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */, 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */, 134454551AAFCAAE003F0779 /* RCTAdSupport.xcodeproj */, 13E5019C1D07A502005F35D8 /* RCTAnimation.xcodeproj */, @@ -626,6 +627,23 @@ name = Products; sourceTree = ""; }; + 1380DC8C1E70C0DC00E7C47D /* Products */ = { + isa = PBXGroup; + children = ( + 1380DC991E70C0DD00E7C47D /* libReact.a */, + 1380DC9B1E70C0DD00E7C47D /* libReact.a */, + 1380DC9D1E70C0DD00E7C47D /* libyoga.a */, + 1380DC9F1E70C0DD00E7C47D /* libyoga.a */, + 1380DCA11E70C0DD00E7C47D /* libcxxreact.a */, + 1380DCA31E70C0DD00E7C47D /* libcxxreact.a */, + 1380DCA51E70C0DD00E7C47D /* libjschelpers.a */, + 1380DCA71E70C0DD00E7C47D /* libjschelpers.a */, + 1380DCA91E70C0DD00E7C47D /* libthird-party.a */, + 1380DCAB1E70C0DD00E7C47D /* libdouble-conversion.a */, + ); + name = Products; + sourceTree = ""; + }; 138DEE031B9EDDDB007F4EA5 /* Products */ = { isa = PBXGroup; children = ( @@ -651,29 +669,12 @@ 13B07FB01A68108700A75B9A /* AppDelegate.m */, 13B07FB51A68108700A75B9A /* Images.xcassets */, 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13CF8FD01E2966FF0005310D /* maincxx.m */, + 13B07FB71A68108700A75B9A /* main.m */, 1323F18D1C04ABAC0091BED0 /* Supporting Files */, ); name = UIExplorer; sourceTree = ""; }; - 13CF8FD31E2967C40005310D /* Products */ = { - isa = PBXGroup; - children = ( - 13CF8FE01E2967C40005310D /* libReact.a */, - 13CF8FE21E2967C40005310D /* libReact.a */, - 13CF8FE41E2967C40005310D /* libyoga.a */, - 13CF8FE61E2967C40005310D /* libyoga.a */, - 13CF8FE81E2967C40005310D /* libcxxreact.a */, - 13CF8FEA1E2967C40005310D /* libcxxreact.a */, - 13CF8FEC1E2967C40005310D /* libjschelpers.a */, - 13CF8FEE1E2967C40005310D /* libjschelpers.a */, - 13CF8FF21E2967C40005310D /* libthird-party.a */, - 13CF8FF01E2967C40005310D /* libdouble-conversion.a */, - ); - name = Products; - sourceTree = ""; - }; 13E5019D1D07A502005F35D8 /* Products */ = { isa = PBXGroup; children = ( @@ -1101,8 +1102,8 @@ ProjectRef = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; }, { - ProductGroup = 13CF8FD31E2967C40005310D /* Products */; - ProjectRef = 13CF8FD21E2967C40005310D /* ReactCxx.xcodeproj */; + ProductGroup = 1380DC8C1E70C0DC00E7C47D /* Products */; + ProjectRef = 1380DC8B1E70C0DC00E7C47D /* ReactCxx.xcodeproj */; }, ); projectRoot = ""; @@ -1154,88 +1155,88 @@ remoteRef = 134A8A241AACED6A00945AAE /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTCameraRoll.a; - remoteRef = 138DEE081B9EDDDB007F4EA5 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 13CF8FE01E2967C40005310D /* libReact.a */ = { + 1380DC991E70C0DD00E7C47D /* libReact.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libReact.a; - remoteRef = 13CF8FDF1E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DC981E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FE21E2967C40005310D /* libReact.a */ = { + 1380DC9B1E70C0DD00E7C47D /* libReact.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libReact.a; - remoteRef = 13CF8FE11E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DC9A1E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FE41E2967C40005310D /* libyoga.a */ = { + 1380DC9D1E70C0DD00E7C47D /* libyoga.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libyoga.a; - remoteRef = 13CF8FE31E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DC9C1E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FE61E2967C40005310D /* libyoga.a */ = { + 1380DC9F1E70C0DD00E7C47D /* libyoga.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libyoga.a; - remoteRef = 13CF8FE51E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DC9E1E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FE81E2967C40005310D /* libcxxreact.a */ = { + 1380DCA11E70C0DD00E7C47D /* libcxxreact.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libcxxreact.a; - remoteRef = 13CF8FE71E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DCA01E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FEA1E2967C40005310D /* libcxxreact.a */ = { + 1380DCA31E70C0DD00E7C47D /* libcxxreact.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libcxxreact.a; - remoteRef = 13CF8FE91E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DCA21E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FEC1E2967C40005310D /* libjschelpers.a */ = { + 1380DCA51E70C0DD00E7C47D /* libjschelpers.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libjschelpers.a; - remoteRef = 13CF8FEB1E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DCA41E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FEE1E2967C40005310D /* libjschelpers.a */ = { + 1380DCA71E70C0DD00E7C47D /* libjschelpers.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libjschelpers.a; - remoteRef = 13CF8FED1E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DCA61E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FF01E2967C40005310D /* libdouble-conversion.a */ = { + 1380DCA91E70C0DD00E7C47D /* libthird-party.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libthird-party.a"; + remoteRef = 1380DCA81E70C0DD00E7C47D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1380DCAB1E70C0DD00E7C47D /* libdouble-conversion.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = "libdouble-conversion.a"; - remoteRef = 13CF8FEF1E2967C40005310D /* PBXContainerItemProxy */; + remoteRef = 1380DCAA1E70C0DD00E7C47D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 13CF8FF21E2967C40005310D /* libthird-party.a */ = { + 138DEE091B9EDDDB007F4EA5 /* libRCTCameraRoll.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libthird-party.a"; - remoteRef = 13CF8FF11E2967C40005310D /* PBXContainerItemProxy */; + path = libRCTCameraRoll.a; + remoteRef = 138DEE081B9EDDDB007F4EA5 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTWebSocket.a; + remoteRef = 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 13E501A31D07A502005F35D8 /* libRCTAnimation.a */ = { @@ -1480,10 +1481,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 13CF8FD11E2966FF0005310D /* maincxx.m in Sources */, 272E6B3F1BEA849E001FCF37 /* UpdatePropertiesExampleView.m in Sources */, 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 27F441EC1BEBE5030039B79C /* FlexibleSizeExampleView.m in Sources */, + 13B07FC11A68108700A75B9A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1517,6 +1518,7 @@ files = ( 2DD323DC1DA2DDBF000FE1B8 /* FlexibleSizeExampleView.m in Sources */, 2DD323DD1DA2DDBF000FE1B8 /* UpdatePropertiesExampleView.m in Sources */, + 2DD323E01DA2DDBF000FE1B8 /* main.m in Sources */, 2DD323DE1DA2DDBF000FE1B8 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Examples/UIExplorer/UIExplorerCxx.xcodeproj/xcshareddata/xcschemes/UIExplorer.xcscheme b/Examples/UIExplorer/UIExplorerCxx.xcodeproj/xcshareddata/xcschemes/UIExplorer.xcscheme index aa4516c99154..f5551bb93067 100644 --- a/Examples/UIExplorer/UIExplorerCxx.xcodeproj/xcshareddata/xcschemes/UIExplorer.xcscheme +++ b/Examples/UIExplorer/UIExplorerCxx.xcodeproj/xcshareddata/xcschemes/UIExplorer.xcscheme @@ -62,6 +62,20 @@ ReferencedContainer = "container:UIExplorerCxx.xcodeproj"> + + + + + + + + + + + + diff --git a/Libraries/RCTTest/RCTTestRunner.m b/Libraries/RCTTest/RCTTestRunner.m index df74872f348b..ff90ac2ea0e7 100644 --- a/Libraries/RCTTest/RCTTestRunner.m +++ b/Libraries/RCTTest/RCTTestRunner.m @@ -11,7 +11,6 @@ #import #import -#import #import #import #import @@ -20,7 +19,6 @@ #import "RCTTestModule.h" static const NSTimeInterval kTestTimeoutSeconds = 120; -static const NSTimeInterval kTestTeardownTimeoutSeconds = 30; @implementation RCTTestRunner { @@ -97,8 +95,6 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName configurationBlock:(void(^)(RCTRootView *rootView))configurationBlock expectErrorBlock:(BOOL(^)(NSString *error))expectErrorBlock { - __weak id weakJSContext; - @autoreleasepool { __block NSString *error = nil; RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { @@ -139,12 +135,6 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; } - // Take a weak reference to the JS context, so we track its deallocation later - // (we can only do this now, since it's been lazily initialized) - id jsExecutor = [bridge.batchedBridge valueForKey:@"javaScriptExecutor"]; - if ([jsExecutor isKindOfClass:[RCTJSCExecutor class]]) { - weakJSContext = [jsExecutor valueForKey:@"_context"]; - } [rootView removeFromSuperview]; RCTSetLogFunction(RCTDefaultLogFunction); @@ -163,14 +153,6 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName } [bridge invalidate]; } - - // Wait for the executor to have shut down completely before returning - NSDate *teardownTimeout = [NSDate dateWithTimeIntervalSinceNow:kTestTeardownTimeoutSeconds]; - while (teardownTimeout.timeIntervalSinceNow > 0 && weakJSContext) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - } - RCTAssert(!weakJSContext, @"JS context was not deallocated after being invalidated"); } @end diff --git a/React/Base/RCTBatchedBridge.m b/React/Base/RCTBatchedBridge.m index 480df01a9535..56c5a6db05e3 100644 --- a/React/Base/RCTBatchedBridge.m +++ b/React/Base/RCTBatchedBridge.m @@ -21,10 +21,11 @@ #import "RCTLog.h" #import "RCTModuleData.h" #import "RCTPerformanceLogger.h" -#import "RCTProfile.h" -#import "RCTRedBox.h" #import "RCTUtils.h" +#import +#import + #if RCT_DEV && __has_include("RCTDevLoadingView.h") #import "RCTDevLoadingView.h" #endif diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 0fe05ca8bb4a..51074272337c 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -276,31 +276,7 @@ - (void)requestReload [self reload]; } -- (void)setUp -{ - RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTBridge setUp]", nil); - - _performanceLogger = [RCTPerformanceLogger new]; - [_performanceLogger markStartForTag:RCTPLBridgeStartup]; - [_performanceLogger markStartForTag:RCTPLTTI]; - - // Only update bundleURL from delegate if delegate bundleURL has changed - NSURL *previousDelegateURL = _delegateBundleURL; - _delegateBundleURL = [self.delegate sourceURLForBridge:self]; - if (_delegateBundleURL && ![_delegateBundleURL isEqual:previousDelegateURL]) { - _bundleURL = _delegateBundleURL; - } - - // Sanitize the bundle URL - _bundleURL = [RCTConvert NSURL:_bundleURL.absoluteString]; - - [self createBatchedBridge]; - [self.batchedBridge start]; - - RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); -} - -- (void)createBatchedBridge +- (Class)bridgeClass { // In order to facilitate switching between bridges with only build // file changes, this uses reflection to check which bridges are @@ -326,7 +302,41 @@ - (void)createBatchedBridge RCTAssert(implClass != nil, @"No bridge implementation is available, giving up."); - self.batchedBridge = [[implClass alloc] initWithParentBridge:self]; +#ifdef WITH_FBSYSTRACE + if (implClass == cxxBridgeClass) { + [RCTFBSystrace registerCallbacks]; + } else { + [RCTFBSystrace unregisterCallbacks]; + } +#endif + + return implClass; +} + +- (void)setUp +{ + Class bridgeClass = self.bridgeClass; + + RCT_PROFILE_BEGIN_EVENT(0, @"-[RCTBridge setUp]", nil); + + _performanceLogger = [RCTPerformanceLogger new]; + [_performanceLogger markStartForTag:RCTPLBridgeStartup]; + [_performanceLogger markStartForTag:RCTPLTTI]; + + // Only update bundleURL from delegate if delegate bundleURL has changed + NSURL *previousDelegateURL = _delegateBundleURL; + _delegateBundleURL = [self.delegate sourceURLForBridge:self]; + if (_delegateBundleURL && ![_delegateBundleURL isEqual:previousDelegateURL]) { + _bundleURL = _delegateBundleURL; + } + + // Sanitize the bundle URL + _bundleURL = [RCTConvert NSURL:_bundleURL.absoluteString]; + + self.batchedBridge = [[bridgeClass alloc] initWithParentBridge:self]; + [self.batchedBridge start]; + + RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); } - (BOOL)isLoading diff --git a/React/Executors/RCTJSCErrorHandling.h b/React/Base/RCTJSCErrorHandling.h similarity index 100% rename from React/Executors/RCTJSCErrorHandling.h rename to React/Base/RCTJSCErrorHandling.h diff --git a/React/Executors/RCTJSCErrorHandling.mm b/React/Base/RCTJSCErrorHandling.mm similarity index 100% rename from React/Executors/RCTJSCErrorHandling.mm rename to React/Base/RCTJSCErrorHandling.mm diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index ee84db6be1ad..461b01d8f39f 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -39,6 +39,7 @@ #import #import "NSDataBigString.h" +#import "RCTJSCHelpers.h" #import "RCTMessageThread.h" #import "RCTObjcExecutor.h" @@ -67,26 +68,6 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) { RCTBridgeFieldCallID, }; -static JSValueRef nativeLoggingHook( - JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, - const JSValueRef arguments[], JSValueRef *exception) { - RCTLogLevel level = RCTLogLevelInfo; - if (argumentCount > 1) { - level = MAX(level, (RCTLogLevel)Value(ctx, arguments[1]).asNumber()); - } - if (argumentCount > 0) { - String message = Value(ctx, arguments[0]).toString(); - _RCTLogJavaScriptInternal(level, @(message.str().c_str())); - } - return Value::makeUndefined(ctx); -} - -static JSValueRef nativePerformanceNow( - JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, - const JSValueRef arguments[], JSValueRef *exception) { - return Value::makeNumber(ctx, CACurrentMediaTime() * 1000); -} - static bool isRAMBundle(NSData *script) { BundleHeader header; [script getBytes:&header length:sizeof(header)]; @@ -151,10 +132,7 @@ @implementation RCTCxxBridge + (void)initialize { if (self == [RCTCxxBridge class]) { - ReactMarker::logMarker = [](const std::string&) {}; - PerfLogging::installNativeHooks = RCTFBQuickPerformanceLoggerConfigureHooks; - JSNativeHooks::loggingHook = nativeLoggingHook; - JSNativeHooks::nowHook = nativePerformanceNow; + RCTPrepareJSCExecutor(); } } diff --git a/React/CxxBridge/RCTJSCHelpers.h b/React/CxxBridge/RCTJSCHelpers.h new file mode 100644 index 000000000000..3c3775b31c8a --- /dev/null +++ b/React/CxxBridge/RCTJSCHelpers.h @@ -0,0 +1,19 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#pragma once + +/** + * This must be invoked on iOS to set up platform dependencies before + * creating an instance of JSCExecutor. + */ + +void RCTPrepareJSCExecutor(); diff --git a/React/CxxBridge/RCTJSCHelpers.mm b/React/CxxBridge/RCTJSCHelpers.mm new file mode 100644 index 000000000000..41651c1c7607 --- /dev/null +++ b/React/CxxBridge/RCTJSCHelpers.mm @@ -0,0 +1,52 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#include "RCTJSCHelpers.h" + +#import + +#import +#import +#import +#import + +using namespace facebook::react; + +namespace { + +JSValueRef nativeLoggingHook( + JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, + const JSValueRef arguments[], JSValueRef *exception) { + RCTLogLevel level = RCTLogLevelInfo; + if (argumentCount > 1) { + level = MAX(level, (RCTLogLevel)Value(ctx, arguments[1]).asNumber()); + } + if (argumentCount > 0) { + String message = Value(ctx, arguments[0]).toString(); + _RCTLogJavaScriptInternal(level, @(message.str().c_str())); + } + return Value::makeUndefined(ctx); +} + +JSValueRef nativePerformanceNow( + JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, + const JSValueRef arguments[], JSValueRef *exception) { + return Value::makeNumber(ctx, CACurrentMediaTime() * 1000); +} + +} + +void RCTPrepareJSCExecutor() { + ReactMarker::logMarker = [](const std::string&) {}; + PerfLogging::installNativeHooks = RCTFBQuickPerformanceLoggerConfigureHooks; + JSNativeHooks::loggingHook = nativeLoggingHook; + JSNativeHooks::nowHook = nativePerformanceNow; +} diff --git a/React/Executors/RCTJSCExecutor.mm b/React/Executors/RCTJSCExecutor.mm index 18a645a56a53..75be11f54b6f 100644 --- a/React/Executors/RCTJSCExecutor.mm +++ b/React/Executors/RCTJSCExecutor.mm @@ -19,19 +19,19 @@ #import #import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import -#import "JSCSamplingProfiler.h" -#import "RCTAssert.h" -#import "RCTBridge+Private.h" -#import "RCTDefines.h" -#import "RCTDevSettings.h" -#import "RCTJSCErrorHandling.h" #import "RCTJSCProfiler.h" -#import "RCTJavaScriptLoader.h" -#import "RCTLog.h" -#import "RCTPerformanceLogger.h" -#import "RCTProfile.h" -#import "RCTUtils.h" #if (RCT_PROFILE || RCT_DEV) && __has_include("RCTDevMenu.h") #import "RCTDevMenu.h" diff --git a/React/Profiler/RCTJSCProfiler.m b/React/Profiler/RCTJSCProfiler.m index 7ae2a2b2f5f0..4d5333b77761 100644 --- a/React/Profiler/RCTJSCProfiler.m +++ b/React/Profiler/RCTJSCProfiler.m @@ -11,7 +11,7 @@ #import -#import "RCTLog.h" +#import #ifndef RCT_JSC_PROFILER #define RCT_JSC_PROFILER RCT_PROFILE diff --git a/React/Profiler/RCTPerfMonitor.m b/React/Profiler/RCTPerfMonitor.m index 4d6b6e1cfcc4..52efbcf267f6 100644 --- a/React/Profiler/RCTPerfMonitor.m +++ b/React/Profiler/RCTPerfMonitor.m @@ -20,7 +20,6 @@ #import "RCTFPSGraph.h" #import "RCTInvalidating.h" #import "RCTJavaScriptExecutor.h" -#import "RCTJSCExecutor.h" #import "RCTPerformanceLogger.h" #import "RCTRootView.h" #import "RCTUIManager.h" diff --git a/React/Profiler/RCTProfile.m b/React/Profiler/RCTProfile.m index d2b0f479d136..47f5eb87431f 100644 --- a/React/Profiler/RCTProfile.m +++ b/React/Profiler/RCTProfile.m @@ -22,7 +22,6 @@ #import "RCTBridge.h" #import "RCTComponentData.h" #import "RCTDefines.h" -#import "RCTJSCExecutor.h" #import "RCTLog.h" #import "RCTModuleData.h" #import "RCTUIManager.h" @@ -473,7 +472,8 @@ void RCTProfileInit(RCTBridge *bridge) // Set up thread ordering dispatch_async(RCTProfileGetQueue(), ^{ - NSArray *orderedThreads = @[@"JS async", @"RCTPerformanceLogger", RCTJSCThreadName, @(RCTUIManagerQueueName), @"main"]; + NSArray *orderedThreads = @[@"JS async", @"RCTPerformanceLogger", @"com.facebook.react.JavaScript", + @(RCTUIManagerQueueName), @"main"]; [orderedThreads enumerateObjectsUsingBlock:^(NSString *thread, NSUInteger idx, __unused BOOL *stop) { RCTProfileAddEvent(RCTProfileTraceEvents, @"ph": @"M", // metadata event diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index a79946fbfa4b..b807434e77b8 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -27,6 +27,8 @@ 137327E81AA5CF210034F82E /* RCTTabBarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E21AA5CF210034F82E /* RCTTabBarItem.m */; }; 137327E91AA5CF210034F82E /* RCTTabBarItemManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E41AA5CF210034F82E /* RCTTabBarItemManager.m */; }; 137327EA1AA5CF210034F82E /* RCTTabBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E61AA5CF210034F82E /* RCTTabBarManager.m */; }; + 139324FE1E70B069009FD7E0 /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 139324FC1E70B069009FD7E0 /* RCTJSCErrorHandling.h */; }; + 139324FF1E70B069009FD7E0 /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 139324FD1E70B069009FD7E0 /* RCTJSCErrorHandling.mm */; }; 13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */; }; 13A1F71E1A75392D00D3D453 /* RCTKeyCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */; }; 13A6E20E1C19AA0C00845B82 /* RCTParserUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A6E20D1C19AA0C00845B82 /* RCTParserUtils.m */; }; @@ -211,7 +213,6 @@ 3D302F4E1DF828F800D6DDAE /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3D302F501DF828F800D6DDAE /* RCTWebSocketObserverProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3D302F521DF828F800D6DDAE /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; 3D302F531DF828F800D6DDAE /* RCTJSCExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3D302F541DF828F800D6DDAE /* JSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; @@ -322,7 +323,6 @@ 3D302FCA1DF8290600D6DDAE /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D302FCB1DF8290600D6DDAE /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3D302FCC1DF8290600D6DDAE /* RCTWebSocketObserverProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3D302FCE1DF8290600D6DDAE /* RCTJSCErrorHandling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; 3D302FCF1DF8290600D6DDAE /* RCTJSCExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3D302FD01DF8290600D6DDAE /* JSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3D302FD11DF8290600D6DDAE /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; @@ -414,8 +414,6 @@ 3D5AC7221E005763000F9153 /* RCTTVRemoteHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5AC71E1E005750000F9153 /* RCTTVRemoteHandler.h */; }; 3D5AC7231E005766000F9153 /* RCTTVRemoteHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D5AC71F1E005750000F9153 /* RCTTVRemoteHandler.m */; }; 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */; }; - 3D7A27E21DE325B7002E3F95 /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */; }; - 3D7A27E31DE325DA002E3F95 /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */; }; 3D80D9171DF6F7A80028D040 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; 3D80D9181DF6F7A80028D040 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; 3D80D9191DF6F7CF0028D040 /* JSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D7A27DD1DE32541002E3F95 /* JSCWrapper.cpp */; }; @@ -465,7 +463,6 @@ 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3D80D94B1DF6FA890028D040 /* RCTWebSocketObserverProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3D80D94D1DF6FA890028D040 /* RCTJSCErrorHandling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; 3D80D94E1DF6FA890028D040 /* RCTJSCExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3D80D94F1DF6FA890028D040 /* JSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; @@ -583,7 +580,6 @@ 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3D80DA451DF820620028D040 /* RCTWebSocketObserverProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3D80DA471DF820620028D040 /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; 3D80DA481DF820620028D040 /* RCTJSCExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3D80DA491DF820620028D040 /* JSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; @@ -853,7 +849,6 @@ 3D302FCA1DF8290600D6DDAE /* RCTURLRequestHandler.h in Copy Headers */, 3D302FCB1DF8290600D6DDAE /* RCTUtils.h in Copy Headers */, 3D302FCC1DF8290600D6DDAE /* RCTWebSocketObserverProtocol.h in Copy Headers */, - 3D302FCE1DF8290600D6DDAE /* RCTJSCErrorHandling.h in Copy Headers */, 3D302FCF1DF8290600D6DDAE /* RCTJSCExecutor.h in Copy Headers */, 3D302FD01DF8290600D6DDAE /* JSCSamplingProfiler.h in Copy Headers */, 3D302FD11DF8290600D6DDAE /* RCTAccessibilityManager.h in Copy Headers */, @@ -1012,7 +1007,6 @@ 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */, 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */, 3D80D94B1DF6FA890028D040 /* RCTWebSocketObserverProtocol.h in Copy Headers */, - 3D80D94D1DF6FA890028D040 /* RCTJSCErrorHandling.h in Copy Headers */, 3D80D94E1DF6FA890028D040 /* RCTJSCExecutor.h in Copy Headers */, 3D80D94F1DF6FA890028D040 /* JSCSamplingProfiler.h in Copy Headers */, 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */, @@ -1171,6 +1165,8 @@ 137327E41AA5CF210034F82E /* RCTTabBarItemManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTabBarItemManager.m; sourceTree = ""; }; 137327E51AA5CF210034F82E /* RCTTabBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTabBarManager.h; sourceTree = ""; }; 137327E61AA5CF210034F82E /* RCTTabBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTabBarManager.m; sourceTree = ""; }; + 139324FC1E70B069009FD7E0 /* RCTJSCErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCErrorHandling.h; sourceTree = ""; }; + 139324FD1E70B069009FD7E0 /* RCTJSCErrorHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCErrorHandling.mm; sourceTree = ""; }; 13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDevLoadingView.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevLoadingView.m; sourceTree = ""; }; 13A0C2871B74F71200B29F6F /* RCTDevMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDevMenu.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -1309,9 +1305,7 @@ 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCore.h; sourceTree = ""; }; 3D7A27DD1DE32541002E3F95 /* JSCWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCWrapper.cpp; sourceTree = ""; }; 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCWrapper.h; sourceTree = ""; }; - 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCErrorHandling.mm; sourceTree = ""; }; 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketObserverProtocol.h; sourceTree = ""; }; - 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCErrorHandling.h; sourceTree = ""; }; 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorCustomizer.h; sourceTree = ""; }; 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorInfo.h; sourceTree = ""; }; 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTErrorInfo.m; sourceTree = ""; }; @@ -1433,8 +1427,6 @@ 134FCB381A6E7F0800051CC8 /* Executors */ = { isa = PBXGroup; children = ( - 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */, - 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */, 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */, 134FCB3A1A6E7F0800051CC8 /* RCTJSCExecutor.mm */, ); @@ -1726,6 +1718,8 @@ 83CBBA491A601E3B00E9B192 /* Base */ = { isa = PBXGroup; children = ( + 139324FC1E70B069009FD7E0 /* RCTJSCErrorHandling.h */, + 139324FD1E70B069009FD7E0 /* RCTJSCErrorHandling.mm */, 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */, 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */, 14C2CA771B3ACB0400E6CBB2 /* RCTBatchedBridge.m */, @@ -1894,7 +1888,6 @@ 3D302F4E1DF828F800D6DDAE /* RCTURLRequestHandler.h in Headers */, 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */, 3D302F501DF828F800D6DDAE /* RCTWebSocketObserverProtocol.h in Headers */, - 3D302F521DF828F800D6DDAE /* RCTJSCErrorHandling.h in Headers */, 3D302F531DF828F800D6DDAE /* RCTJSCExecutor.h in Headers */, 3D302F541DF828F800D6DDAE /* JSCSamplingProfiler.h in Headers */, 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */, @@ -2084,7 +2077,6 @@ 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */, 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */, 3D80DA451DF820620028D040 /* RCTWebSocketObserverProtocol.h in Headers */, - 3D80DA471DF820620028D040 /* RCTJSCErrorHandling.h in Headers */, 3D80DA481DF820620028D040 /* RCTJSCExecutor.h in Headers */, 3D80DA491DF820620028D040 /* JSCSamplingProfiler.h in Headers */, 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */, @@ -2152,6 +2144,7 @@ 3D80DA881DF820620028D040 /* RCTTabBar.h in Headers */, 3D80DA891DF820620028D040 /* RCTTabBarItem.h in Headers */, 3D80DA8A1DF820620028D040 /* RCTTabBarItemManager.h in Headers */, + 139324FE1E70B069009FD7E0 /* RCTJSCErrorHandling.h in Headers */, 3D80DA8B1DF820620028D040 /* RCTTabBarManager.h in Headers */, 3D80DA8C1DF820620028D040 /* RCTTextDecorationLineType.h in Headers */, 3D80DA8D1DF820620028D040 /* RCTView.h in Headers */, @@ -2495,7 +2488,6 @@ 594AD5D41E46D87500B07237 /* RCTScrollContentViewManager.m in Sources */, A12E9E5D1E5DF8720029001B /* RCTReloadPackagerMethod.m in Sources */, 3D5AC71A1E0056E0000F9153 /* RCTTVNavigationEventEmitter.m in Sources */, - 3D7A27E31DE325DA002E3F95 /* RCTJSCErrorHandling.mm in Sources */, 2D3B5EA61D9B08CA00451313 /* RCTTouchEvent.m in Sources */, 2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */, 2D3B5EF01D9B09E300451313 /* RCTWrapperViewController.m in Sources */, @@ -2631,8 +2623,8 @@ 13B080051A6947C200A75B9A /* RCTScrollView.m in Sources */, A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */, E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */, - 3D7A27E21DE325B7002E3F95 /* RCTJSCErrorHandling.mm in Sources */, 13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */, + 139324FF1E70B069009FD7E0 /* RCTJSCErrorHandling.mm in Sources */, 13B07FF21A69327A00A75B9A /* RCTTiming.m in Sources */, 1372B70A1AB030C200659ED6 /* RCTAppState.m in Sources */, 134FCB3D1A6E7F0800051CC8 /* RCTJSCExecutor.mm in Sources */, diff --git a/React/ReactCxx.xcodeproj/project.pbxproj b/React/ReactCxx.xcodeproj/project.pbxproj index c375179209e0..b1f0b1ccccc6 100644 --- a/React/ReactCxx.xcodeproj/project.pbxproj +++ b/React/ReactCxx.xcodeproj/project.pbxproj @@ -25,18 +25,12 @@ 130E3D891E6A082100ACE484 /* RCTDevSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 130E3D871E6A082100ACE484 /* RCTDevSettings.mm */; }; 130E3D8A1E6A083600ACE484 /* RCTDevSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 130E3D861E6A082100ACE484 /* RCTDevSettings.h */; }; 130E3D8B1E6A083900ACE484 /* RCTDevSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 130E3D871E6A082100ACE484 /* RCTDevSettings.mm */; }; - 13134C841E296B2A00B9F3CB /* RCTCxxBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C731E296B2A00B9F3CB /* RCTCxxBridge.h */; }; - 13134C851E296B2A00B9F3CB /* RCTCxxBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C731E296B2A00B9F3CB /* RCTCxxBridge.h */; }; 13134C861E296B2A00B9F3CB /* RCTCxxBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */; }; 13134C871E296B2A00B9F3CB /* RCTCxxBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */; }; 13134C8C1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */; }; 13134C8D1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */; }; 13134C8E1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */; }; 13134C8F1E296B2A00B9F3CB /* RCTMessageThread.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */; }; - 13134C901E296B2A00B9F3CB /* RCTNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C791E296B2A00B9F3CB /* RCTNativeModule.h */; }; - 13134C911E296B2A00B9F3CB /* RCTNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C791E296B2A00B9F3CB /* RCTNativeModule.h */; }; - 13134C921E296B2A00B9F3CB /* RCTNativeModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C7A1E296B2A00B9F3CB /* RCTNativeModule.mm */; }; - 13134C931E296B2A00B9F3CB /* RCTNativeModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C7A1E296B2A00B9F3CB /* RCTNativeModule.mm */; }; 13134C941E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */; }; 13134C951E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */; }; 13134C961E296B2A00B9F3CB /* RCTObjcExecutor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13134C7C1E296B2A00B9F3CB /* RCTObjcExecutor.mm */; }; @@ -61,14 +55,27 @@ 1339578B1DF76D3500EC27BE /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; }; 133CAE8E1B8E5CFD00F6AD92 /* RCTDatePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 133CAE8D1B8E5CFD00F6AD92 /* RCTDatePicker.m */; }; 13456E931ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 13456E921ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m */; }; - 134FCB3D1A6E7F0800051CC8 /* RCTJSCExecutor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3A1A6E7F0800051CC8 /* RCTJSCExecutor.mm */; }; 13513F3C1B1F43F400FCE529 /* RCTProgressViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */; }; + 135A9BFB1E7B0EAE00587AEB /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */; }; + 135A9BFC1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */; }; + 135A9BFF1E7B0EE600587AEB /* RCTJSCHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */; }; + 135A9C001E7B0EE600587AEB /* RCTJSCHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */; }; + 135A9C011E7B0F4700587AEB /* systemJSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */; }; + 135A9C021E7B0F4800587AEB /* systemJSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */; }; + 135A9C031E7B0F6100587AEB /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */; }; + 135A9C041E7B0F6400587AEB /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */; }; + 135A9C051E7B0F7500587AEB /* RCTJSCHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */; }; + 135A9C061E7B0F7800587AEB /* RCTJSCHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */; }; 13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; }; 1372B70A1AB030C200659ED6 /* RCTAppState.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7091AB030C200659ED6 /* RCTAppState.m */; }; 137327E71AA5CF210034F82E /* RCTTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E01AA5CF210034F82E /* RCTTabBar.m */; }; 137327E81AA5CF210034F82E /* RCTTabBarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E21AA5CF210034F82E /* RCTTabBarItem.m */; }; 137327E91AA5CF210034F82E /* RCTTabBarItemManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E41AA5CF210034F82E /* RCTTabBarItemManager.m */; }; 137327EA1AA5CF210034F82E /* RCTTabBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E61AA5CF210034F82E /* RCTTabBarManager.m */; }; + 1384E2081E806D4E00545659 /* RCTNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1384E2061E806D4E00545659 /* RCTNativeModule.h */; }; + 1384E2091E806D4E00545659 /* RCTNativeModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1384E2071E806D4E00545659 /* RCTNativeModule.mm */; }; + 1384E20A1E806D5700545659 /* RCTNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 1384E2061E806D4E00545659 /* RCTNativeModule.h */; }; + 1384E20B1E806D5B00545659 /* RCTNativeModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1384E2071E806D4E00545659 /* RCTNativeModule.mm */; }; 139D7E4C1E25C5A300323FB7 /* bignum-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */; }; 139D7E4E1E25C5A300323FB7 /* bignum.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3C1E25C5A300323FB7 /* bignum.h */; }; 139D7E501E25C5A300323FB7 /* cached-powers.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E3E1E25C5A300323FB7 /* cached-powers.h */; }; @@ -167,7 +174,6 @@ 13F880391E296D2800C3C7A1 /* noncopyable.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1091E0369AD0018521A /* noncopyable.h */; }; 13F8803A1E296D2800C3C7A1 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10B1E0369AD0018521A /* Unicode.h */; }; 13F8803B1E296D2800C3C7A1 /* Value.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10D1E0369AD0018521A /* Value.h */; }; - 13F8803C1E296DF600C3C7A1 /* RCTCxxBridge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13134C731E296B2A00B9F3CB /* RCTCxxBridge.h */; }; 13F880411E29709F00C3C7A1 /* libdouble-conversion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139D7E881E25C6D100323FB7 /* libdouble-conversion.a */; }; 13F887581E2971D400C3C7A1 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887521E2971C500C3C7A1 /* Demangle.cpp */; }; 13F887591E2971D400C3C7A1 /* StringBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887531E2971C500C3C7A1 /* StringBase.cpp */; }; @@ -214,11 +220,9 @@ 1450FF871BCFF28A00208362 /* RCTProfileTrampoline-arm.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF821BCFF28A00208362 /* RCTProfileTrampoline-arm.S */; }; 1450FF881BCFF28A00208362 /* RCTProfileTrampoline-arm64.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF831BCFF28A00208362 /* RCTProfileTrampoline-arm64.S */; }; 1450FF8A1BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF851BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S */; }; - 14A43DF31C20B1C900794BC8 /* RCTJSCProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A43DF21C20B1C900794BC8 /* RCTJSCProfiler.m */; }; 14C2CA711B3AC63800E6CBB2 /* RCTModuleMethod.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA701B3AC63800E6CBB2 /* RCTModuleMethod.m */; }; 14C2CA741B3AC64300E6CBB2 /* RCTModuleData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA731B3AC64300E6CBB2 /* RCTModuleData.mm */; }; 14C2CA761B3AC64F00E6CBB2 /* RCTFrameUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */; }; - 14C2CA781B3ACB0400E6CBB2 /* RCTBatchedBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA771B3ACB0400E6CBB2 /* RCTBatchedBridge.m */; }; 14F3620D1AABD06A001CE568 /* RCTSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F362081AABD06A001CE568 /* RCTSwitch.m */; }; 14F3620E1AABD06A001CE568 /* RCTSwitchManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F3620A1AABD06A001CE568 /* RCTSwitchManager.m */; }; 14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F484551AABFCE100FDF6B9 /* RCTSliderManager.m */; }; @@ -283,7 +287,6 @@ 2D3B5E931D9B087300451313 /* RCTErrorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */; }; 2D3B5E941D9B087900451313 /* RCTBundleURLProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */; }; 2D3B5E951D9B087C00451313 /* RCTAssert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */; }; - 2D3B5E961D9B088500451313 /* RCTBatchedBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C2CA771B3ACB0400E6CBB2 /* RCTBatchedBridge.m */; }; 2D3B5E971D9B089000451313 /* RCTBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA5F1A601EAA00E9B192 /* RCTBridge.m */; }; 2D3B5E981D9B089500451313 /* RCTConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBACB1A6023D300E9B192 /* RCTConvert.m */; }; 2D3B5E991D9B089A00451313 /* RCTDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */; }; @@ -301,7 +304,6 @@ 2D3B5EA61D9B08CA00451313 /* RCTTouchEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 391E86A21C623EC800009732 /* RCTTouchEvent.m */; }; 2D3B5EA71D9B08CE00451313 /* RCTTouchHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA971A6020BB00E9B192 /* RCTTouchHandler.m */; }; 2D3B5EA81D9B08D300451313 /* RCTUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA501A601E3B00E9B192 /* RCTUtils.m */; }; - 2D3B5EAC1D9B08EF00451313 /* RCTJSCExecutor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 134FCB3A1A6E7F0800051CC8 /* RCTJSCExecutor.mm */; }; 2D3B5EAE1D9B08F800451313 /* RCTEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */; }; 2D3B5EAF1D9B08FB00451313 /* RCTAccessibilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */; }; 2D3B5EB01D9B08FE00451313 /* RCTAlertManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FE81A69327A00A75B9A /* RCTAlertManager.m */; }; @@ -317,7 +319,6 @@ 2D3B5EBC1D9B092600451313 /* RCTKeyboardObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */; }; 2D3B5EBD1D9B092A00451313 /* RCTTiming.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FEE1A69327A00A75B9A /* RCTTiming.m */; }; 2D3B5EBE1D9B092D00451313 /* RCTUIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067491A70F434002CDEE1 /* RCTUIManager.m */; }; - 2D3B5EBF1D9B093300451313 /* RCTJSCProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A43DF21C20B1C900794BC8 /* RCTJSCProfiler.m */; }; 2D3B5EC01D9B093600451313 /* RCTPerfMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F7A0EB1BDA3B3C003C6C10 /* RCTPerfMonitor.m */; }; 2D3B5EC11D9B093900451313 /* RCTFPSGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F7A0EF1BDA714B003C6C10 /* RCTFPSGraph.m */; }; 2D3B5EC21D9B093B00451313 /* RCTProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 1450FF811BCFF28A00208362 /* RCTProfile.m */; }; @@ -408,8 +409,6 @@ 3D302F4E1DF828F800D6DDAE /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3D302F501DF828F800D6DDAE /* RCTWebSocketObserverProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3D302F521DF828F800D6DDAE /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; - 3D302F531DF828F800D6DDAE /* RCTJSCExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3D302F541DF828F800D6DDAE /* JSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3D302F561DF828F800D6DDAE /* RCTAlertManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; @@ -429,7 +428,6 @@ 3D302F641DF828F800D6DDAE /* RCTTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; 3D302F651DF828F800D6DDAE /* RCTUIManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; 3D302F661DF828F800D6DDAE /* RCTFPSGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3D302F671DF828F800D6DDAE /* RCTJSCProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A43DF11C20B1C900794BC8 /* RCTJSCProfiler.h */; }; 3D302F681DF828F800D6DDAE /* RCTMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; 3D302F691DF828F800D6DDAE /* RCTProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; 3D302F6A1DF828F800D6DDAE /* RCTActivityIndicatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; @@ -492,8 +490,6 @@ 3D7454801E5475AF00E74ADD /* RecoverableError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; 3D7454811E5475AF00E74ADD /* RecoverableError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */; }; - 3D7A27E21DE325B7002E3F95 /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */; }; - 3D7A27E31DE325DA002E3F95 /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */; }; 3D7AA9C41E548CD5001955CF /* NSDataBigString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */; }; 3D7AA9C51E548CDB001955CF /* NSDataBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454B31E54786200E74ADD /* NSDataBigString.h */; }; 3D7AA9C61E548CDD001955CF /* NSDataBigString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */; }; @@ -543,8 +539,6 @@ 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3D80D94B1DF6FA890028D040 /* RCTWebSocketObserverProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3D80D94D1DF6FA890028D040 /* RCTJSCErrorHandling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; - 3D80D94E1DF6FA890028D040 /* RCTJSCExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3D80D94F1DF6FA890028D040 /* JSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3D80D9511DF6FA890028D040 /* RCTAlertManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; @@ -564,7 +558,6 @@ 3D80D95F1DF6FA890028D040 /* RCTTiming.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; 3D80D9601DF6FA890028D040 /* RCTUIManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; 3D80D9611DF6FA890028D040 /* RCTFPSGraph.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3D80D9621DF6FA890028D040 /* RCTJSCProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DF11C20B1C900794BC8 /* RCTJSCProfiler.h */; }; 3D80D9631DF6FA890028D040 /* RCTMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; 3D80D9641DF6FA890028D040 /* RCTProfile.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; 3D80D9651DF6FA890028D040 /* RCTActivityIndicatorView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; @@ -661,8 +654,6 @@ 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3D80DA451DF820620028D040 /* RCTWebSocketObserverProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3D80DA471DF820620028D040 /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; - 3D80DA481DF820620028D040 /* RCTJSCExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3D80DA491DF820620028D040 /* JSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3D80DA4B1DF820620028D040 /* RCTAlertManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; @@ -682,7 +673,6 @@ 3D80DA591DF820620028D040 /* RCTTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; 3D80DA5A1DF820620028D040 /* RCTUIManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; 3D80DA5B1DF820620028D040 /* RCTFPSGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3D80DA5C1DF820620028D040 /* RCTJSCProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A43DF11C20B1C900794BC8 /* RCTJSCProfiler.h */; }; 3D80DA5D1DF820620028D040 /* RCTMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; 3D80DA5E1DF820620028D040 /* RCTProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; 3D80DA5F1DF820620028D040 /* RCTActivityIndicatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; @@ -809,8 +799,6 @@ 3DA981E41E5B0F29004F2374 /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3DA981E51E5B0F29004F2374 /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; 3DA981E61E5B0F29004F2374 /* RCTWebSocketObserverProtocol.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */; }; - 3DA981E71E5B0F7F004F2374 /* RCTJSCErrorHandling.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */; }; - 3DA981E81E5B0F7F004F2374 /* RCTJSCExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */; }; 3DA981E91E5B0F7F004F2374 /* JSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* JSCSamplingProfiler.h */; }; 3DA981EA1E5B0F7F004F2374 /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3DA981EB1E5B0F7F004F2374 /* RCTAlertManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; @@ -830,7 +818,6 @@ 3DA981F91E5B0F7F004F2374 /* RCTTiming.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FED1A69327A00A75B9A /* RCTTiming.h */; }; 3DA981FA1E5B0F7F004F2374 /* RCTUIManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13E067481A70F434002CDEE1 /* RCTUIManager.h */; }; 3DA981FB1E5B0F7F004F2374 /* RCTFPSGraph.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */; }; - 3DA981FC1E5B0F7F004F2374 /* RCTJSCProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DF11C20B1C900794BC8 /* RCTJSCProfiler.h */; }; 3DA981FD1E5B0F7F004F2374 /* RCTMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14BF71811C04795500C97D0C /* RCTMacros.h */; }; 3DA981FE1E5B0F7F004F2374 /* RCTProfile.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1450FF801BCFF28A00208362 /* RCTProfile.h */; }; 3DA981FF1E5B0F7F004F2374 /* RCTActivityIndicatorView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B95154301D1B34B200FE7B80 /* RCTActivityIndicatorView.h */; }; @@ -1058,8 +1045,6 @@ dstPath = include/React; dstSubfolderSpec = 16; files = ( - 3DA981E71E5B0F7F004F2374 /* RCTJSCErrorHandling.h in Copy Headers */, - 3DA981E81E5B0F7F004F2374 /* RCTJSCExecutor.h in Copy Headers */, 3DA981E91E5B0F7F004F2374 /* JSCSamplingProfiler.h in Copy Headers */, 3DA981EA1E5B0F7F004F2374 /* RCTAccessibilityManager.h in Copy Headers */, 3DA981EB1E5B0F7F004F2374 /* RCTAlertManager.h in Copy Headers */, @@ -1079,7 +1064,6 @@ 3DA981F91E5B0F7F004F2374 /* RCTTiming.h in Copy Headers */, 3DA981FA1E5B0F7F004F2374 /* RCTUIManager.h in Copy Headers */, 3DA981FB1E5B0F7F004F2374 /* RCTFPSGraph.h in Copy Headers */, - 3DA981FC1E5B0F7F004F2374 /* RCTJSCProfiler.h in Copy Headers */, 3DA981FD1E5B0F7F004F2374 /* RCTMacros.h in Copy Headers */, 3DA981FE1E5B0F7F004F2374 /* RCTProfile.h in Copy Headers */, 3DA981FF1E5B0F7F004F2374 /* RCTActivityIndicatorView.h in Copy Headers */, @@ -1252,7 +1236,6 @@ dstPath = include/React; dstSubfolderSpec = 16; files = ( - 13F8803C1E296DF600C3C7A1 /* RCTCxxBridge.h in Copy Headers */, 3D80D91F1DF6FA890028D040 /* RCTImageLoader.h in Copy Headers */, 3D80D9201DF6FA890028D040 /* RCTImageStoreManager.h in Copy Headers */, 3D80D9211DF6FA890028D040 /* RCTResizeMode.h in Copy Headers */, @@ -1297,8 +1280,6 @@ 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */, 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */, 3D80D94B1DF6FA890028D040 /* RCTWebSocketObserverProtocol.h in Copy Headers */, - 3D80D94D1DF6FA890028D040 /* RCTJSCErrorHandling.h in Copy Headers */, - 3D80D94E1DF6FA890028D040 /* RCTJSCExecutor.h in Copy Headers */, 3D80D94F1DF6FA890028D040 /* JSCSamplingProfiler.h in Copy Headers */, 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */, 3D80D9511DF6FA890028D040 /* RCTAlertManager.h in Copy Headers */, @@ -1318,7 +1299,6 @@ 3D80D95F1DF6FA890028D040 /* RCTTiming.h in Copy Headers */, 3D80D9601DF6FA890028D040 /* RCTUIManager.h in Copy Headers */, 3D80D9611DF6FA890028D040 /* RCTFPSGraph.h in Copy Headers */, - 3D80D9621DF6FA890028D040 /* RCTJSCProfiler.h in Copy Headers */, 3D80D9631DF6FA890028D040 /* RCTMacros.h in Copy Headers */, 3D80D9641DF6FA890028D040 /* RCTProfile.h in Copy Headers */, 3D80D9651DF6FA890028D040 /* RCTActivityIndicatorView.h in Copy Headers */, @@ -1469,12 +1449,9 @@ 130A77081DF767AF001F9587 /* Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = ""; }; 130E3D861E6A082100ACE484 /* RCTDevSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDevSettings.h; sourceTree = ""; }; 130E3D871E6A082100ACE484 /* RCTDevSettings.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTDevSettings.mm; sourceTree = ""; }; - 13134C731E296B2A00B9F3CB /* RCTCxxBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxBridge.h; sourceTree = ""; }; 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTCxxBridge.mm; sourceTree = ""; }; 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMessageThread.h; sourceTree = ""; }; 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTMessageThread.mm; sourceTree = ""; }; - 13134C791E296B2A00B9F3CB /* RCTNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNativeModule.h; sourceTree = ""; }; - 13134C7A1E296B2A00B9F3CB /* RCTNativeModule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNativeModule.mm; sourceTree = ""; }; 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTObjcExecutor.h; sourceTree = ""; }; 13134C7C1E296B2A00B9F3CB /* RCTObjcExecutor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTObjcExecutor.mm; sourceTree = ""; }; 13134C7E1E296B2A00B9F3CB /* RCTCxxMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxMethod.h; sourceTree = ""; }; @@ -1497,10 +1474,12 @@ 13456E921ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+CoreLocation.m"; sourceTree = ""; }; 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTURLRequestDelegate.h; sourceTree = ""; }; 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTURLRequestHandler.h; sourceTree = ""; }; - 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTJSCExecutor.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 134FCB3A1A6E7F0800051CC8 /* RCTJSCExecutor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCExecutor.mm; sourceTree = ""; }; 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTProgressViewManager.h; sourceTree = ""; }; 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTProgressViewManager.m; sourceTree = ""; }; + 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCErrorHandling.h; sourceTree = ""; }; + 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCErrorHandling.mm; sourceTree = ""; }; + 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCHelpers.h; sourceTree = ""; }; + 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCHelpers.mm; sourceTree = ""; }; 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTStatusBarManager.h; sourceTree = ""; }; 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTStatusBarManager.m; sourceTree = ""; }; 1372B7081AB030C200659ED6 /* RCTAppState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAppState.h; sourceTree = ""; }; @@ -1513,6 +1492,8 @@ 137327E41AA5CF210034F82E /* RCTTabBarItemManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTabBarItemManager.m; sourceTree = ""; }; 137327E51AA5CF210034F82E /* RCTTabBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTabBarManager.h; sourceTree = ""; }; 137327E61AA5CF210034F82E /* RCTTabBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTabBarManager.m; sourceTree = ""; }; + 1384E2061E806D4E00545659 /* RCTNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNativeModule.h; sourceTree = ""; }; + 1384E2071E806D4E00545659 /* RCTNativeModule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTNativeModule.mm; sourceTree = ""; }; 139D7E391E25C5A300323FB7 /* bignum-dtoa.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "bignum-dtoa.cc"; path = "double-conversion-1.1.5/src/bignum-dtoa.cc"; sourceTree = ""; }; 139D7E3A1E25C5A300323FB7 /* bignum-dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "bignum-dtoa.h"; path = "double-conversion-1.1.5/src/bignum-dtoa.h"; sourceTree = ""; }; 139D7E3B1E25C5A300323FB7 /* bignum.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bignum.cc; path = "double-conversion-1.1.5/src/bignum.cc"; sourceTree = ""; }; @@ -1652,8 +1633,6 @@ 1450FF851BCFF28A00208362 /* RCTProfileTrampoline-x86_64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "RCTProfileTrampoline-x86_64.S"; sourceTree = ""; }; 1482F9E61B55B927000ADFF3 /* RCTBridgeDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeDelegate.h; sourceTree = ""; }; 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RCTBridge+Private.h"; sourceTree = ""; }; - 14A43DF11C20B1C900794BC8 /* RCTJSCProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCProfiler.h; sourceTree = ""; }; - 14A43DF21C20B1C900794BC8 /* RCTJSCProfiler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSCProfiler.m; sourceTree = ""; }; 14BF717F1C04793D00C97D0C /* RCTProfileTrampoline-i386.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = "RCTProfileTrampoline-i386.S"; sourceTree = ""; }; 14BF71811C04795500C97D0C /* RCTMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMacros.h; sourceTree = ""; }; 14C2CA6F1B3AC63800E6CBB2 /* RCTModuleMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTModuleMethod.h; sourceTree = ""; }; @@ -1661,7 +1640,6 @@ 14C2CA721B3AC64300E6CBB2 /* RCTModuleData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTModuleData.h; sourceTree = ""; }; 14C2CA731B3AC64300E6CBB2 /* RCTModuleData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleData.mm; sourceTree = ""; }; 14C2CA751B3AC64F00E6CBB2 /* RCTFrameUpdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFrameUpdate.m; sourceTree = ""; }; - 14C2CA771B3ACB0400E6CBB2 /* RCTBatchedBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBatchedBridge.m; sourceTree = ""; }; 14F362071AABD06A001CE568 /* RCTSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSwitch.h; sourceTree = ""; }; 14F362081AABD06A001CE568 /* RCTSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSwitch.m; sourceTree = ""; }; 14F362091AABD06A001CE568 /* RCTSwitchManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSwitchManager.h; sourceTree = ""; }; @@ -1675,7 +1653,7 @@ 191E3EBD1C29D9AF00C180A6 /* RCTRefreshControlManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRefreshControlManager.m; sourceTree = ""; }; 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRefreshControl.h; sourceTree = ""; }; 191E3EC01C29DC3800C180A6 /* RCTRefreshControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRefreshControl.m; sourceTree = ""; }; - 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = systemJSCWrapper.cpp; path = ../jschelpers/systemJSCWrapper.cpp; sourceTree = ""; }; + 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = systemJSCWrapper.cpp; sourceTree = ""; }; 27B958731E57587D0096647A /* JSBigString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBigString.cpp; sourceTree = ""; }; 2D2A28131D9B038B00D4039D /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTI18nUtil.h; sourceTree = ""; }; @@ -1710,7 +1688,6 @@ 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCore.h; sourceTree = ""; }; 3D7A27DD1DE32541002E3F95 /* JSCWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCWrapper.cpp; sourceTree = ""; }; 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCWrapper.h; sourceTree = ""; }; - 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCErrorHandling.mm; sourceTree = ""; }; 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NSDataBigString.mm; sourceTree = ""; }; 3D92B0A71E03699D0018521A /* CxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxModule.h; sourceTree = ""; }; 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CxxNativeModule.cpp; sourceTree = ""; }; @@ -1764,7 +1741,6 @@ 3D92B10C1E0369AD0018521A /* Value.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Value.cpp; sourceTree = ""; }; 3D92B10D1E0369AD0018521A /* Value.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Value.h; sourceTree = ""; }; 3DB910701C74B21600838BBE /* RCTWebSocketObserverProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketObserverProtocol.h; sourceTree = ""; }; - 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCErrorHandling.h; sourceTree = ""; }; 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorCustomizer.h; sourceTree = ""; }; 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorInfo.h; sourceTree = ""; }; 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTErrorInfo.m; sourceTree = ""; }; @@ -1904,12 +1880,11 @@ children = ( 3D7454B31E54786200E74ADD /* NSDataBigString.h */, 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */, - 13134C731E296B2A00B9F3CB /* RCTCxxBridge.h */, 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */, + 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */, + 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */, 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */, 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */, - 13134C791E296B2A00B9F3CB /* RCTNativeModule.h */, - 13134C7A1E296B2A00B9F3CB /* RCTNativeModule.mm */, 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */, 13134C7C1E296B2A00B9F3CB /* RCTObjcExecutor.mm */, ); @@ -1919,6 +1894,8 @@ 13134C7D1E296B2A00B9F3CB /* CxxModule */ = { isa = PBXGroup; children = ( + 1384E2061E806D4E00545659 /* RCTNativeModule.h */, + 1384E2071E806D4E00545659 /* RCTNativeModule.mm */, 13134C7E1E296B2A00B9F3CB /* RCTCxxMethod.h */, 13134C7F1E296B2A00B9F3CB /* RCTCxxMethod.mm */, 13134C801E296B2A00B9F3CB /* RCTCxxModule.h */, @@ -1929,17 +1906,6 @@ path = CxxModule; sourceTree = ""; }; - 134FCB381A6E7F0800051CC8 /* Executors */ = { - isa = PBXGroup; - children = ( - 3DC724301D8BF99A00808C32 /* RCTJSCErrorHandling.h */, - 3D7A27E11DE325B7002E3F95 /* RCTJSCErrorHandling.mm */, - 134FCB391A6E7F0800051CC8 /* RCTJSCExecutor.h */, - 134FCB3A1A6E7F0800051CC8 /* RCTJSCExecutor.mm */, - ); - path = Executors; - sourceTree = ""; - }; 139D7E381E25C55B00323FB7 /* double-conversion */ = { isa = PBXGroup; children = ( @@ -2183,8 +2149,6 @@ children = ( 14F7A0EE1BDA714B003C6C10 /* RCTFPSGraph.h */, 14F7A0EF1BDA714B003C6C10 /* RCTFPSGraph.m */, - 14A43DF11C20B1C900794BC8 /* RCTJSCProfiler.h */, - 14A43DF21C20B1C900794BC8 /* RCTJSCProfiler.m */, 14BF71811C04795500C97D0C /* RCTMacros.h */, 14F7A0EB1BDA3B3C003C6C10 /* RCTPerfMonitor.m */, 1450FF801BCFF28A00208362 /* RCTProfile.h */, @@ -2258,6 +2222,7 @@ 3D4A621D1DDD3985001F41B4 /* jschelpers */ = { isa = PBXGroup; children = ( + 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */, 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */, 3D92B1071E0369AD0018521A /* JSCHelpers.cpp */, 3D92B1081E0369AD0018521A /* JSCHelpers.h */, @@ -2321,7 +2286,6 @@ 13134C721E296B2A00B9F3CB /* CxxBridge */, 13134C7D1E296B2A00B9F3CB /* CxxModule */, 83CBBA491A601E3B00E9B192 /* Base */, - 134FCB381A6E7F0800051CC8 /* Executors */, 13B07FE01A69315300A75B9A /* Modules */, 1450FF7F1BCFF28A00208362 /* Profiler */, 13B07FF31A6947C200A75B9A /* Views */, @@ -2332,9 +2296,10 @@ 83CBBA491A601E3B00E9B192 /* Base */ = { isa = PBXGroup; children = ( + 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */, + 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */, 83CBBA4A1A601E3B00E9B192 /* RCTAssert.h */, 83CBBA4B1A601E3B00E9B192 /* RCTAssert.m */, - 14C2CA771B3ACB0400E6CBB2 /* RCTBatchedBridge.m */, 83CBBA5E1A601EAA00E9B192 /* RCTBridge.h */, 83CBBA5F1A601EAA00E9B192 /* RCTBridge.m */, 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */, @@ -2455,7 +2420,6 @@ 3D7454791E54757500E74ADD /* RecoverableError.h */, 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */, 3D92B0D41E03699D0018521A /* SampleCxxModule.h */, - 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */, 3D92B0D51E03699D0018521A /* SystraceSection.h */, ); path = cxxreact; @@ -2524,6 +2488,7 @@ 3D302F3C1DF828F800D6DDAE /* RCTJavaScriptLoader.h in Headers */, 3D302F3D1DF828F800D6DDAE /* RCTJSStackFrame.h in Headers */, 3D302F3E1DF828F800D6DDAE /* RCTKeyCommands.h in Headers */, + 135A9C031E7B0F6100587AEB /* RCTJSCErrorHandling.h in Headers */, 3D302F3F1DF828F800D6DDAE /* RCTLog.h in Headers */, 3D302F401DF828F800D6DDAE /* RCTModuleData.h in Headers */, 3D302F411DF828F800D6DDAE /* RCTModuleMethod.h in Headers */, @@ -2541,8 +2506,6 @@ 3D302F4E1DF828F800D6DDAE /* RCTURLRequestHandler.h in Headers */, 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */, 3D302F501DF828F800D6DDAE /* RCTWebSocketObserverProtocol.h in Headers */, - 3D302F521DF828F800D6DDAE /* RCTJSCErrorHandling.h in Headers */, - 3D302F531DF828F800D6DDAE /* RCTJSCExecutor.h in Headers */, 3D302F541DF828F800D6DDAE /* JSCSamplingProfiler.h in Headers */, 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */, 3D302F561DF828F800D6DDAE /* RCTAlertManager.h in Headers */, @@ -2562,7 +2525,6 @@ 3D302F641DF828F800D6DDAE /* RCTTiming.h in Headers */, 3D302F651DF828F800D6DDAE /* RCTUIManager.h in Headers */, 3D302F661DF828F800D6DDAE /* RCTFPSGraph.h in Headers */, - 3D302F671DF828F800D6DDAE /* RCTJSCProfiler.h in Headers */, 3D302F681DF828F800D6DDAE /* RCTMacros.h in Headers */, 3D302F691DF828F800D6DDAE /* RCTProfile.h in Headers */, 3D302F6A1DF828F800D6DDAE /* RCTActivityIndicatorView.h in Headers */, @@ -2576,6 +2538,7 @@ 3D302F721DF828F800D6DDAE /* RCTConvert+CoreLocation.h in Headers */, 3D302F761DF828F800D6DDAE /* RCTFont.h in Headers */, 3D302F7B1DF828F800D6DDAE /* RCTModalHostView.h in Headers */, + 1384E20A1E806D5700545659 /* RCTNativeModule.h in Headers */, 3D302F7C1DF828F800D6DDAE /* RCTModalHostViewController.h in Headers */, 3D302F7D1DF828F800D6DDAE /* RCTModalHostViewManager.h in Headers */, 3D302F7E1DF828F800D6DDAE /* RCTNavigator.h in Headers */, @@ -2583,6 +2546,7 @@ 130443DD1E401AF500D93A67 /* RCTConvert+Transform.h in Headers */, 3D302F801DF828F800D6DDAE /* RCTNavItem.h in Headers */, 3D302F811DF828F800D6DDAE /* RCTNavItemManager.h in Headers */, + 135A9C061E7B0F7800587AEB /* RCTJSCHelpers.h in Headers */, 3D302F841DF828F800D6DDAE /* RCTPointerEvents.h in Headers */, 3D302F851DF828F800D6DDAE /* RCTProgressViewManager.h in Headers */, 3D302F861DF828F800D6DDAE /* RCTRefreshControl.h in Headers */, @@ -2610,9 +2574,7 @@ 3D302F9A1DF828F800D6DDAE /* RCTViewManager.h in Headers */, 3D302F9D1DF828F800D6DDAE /* RCTWrapperViewController.h in Headers */, 3D302F9F1DF828F800D6DDAE /* UIView+React.h in Headers */, - 13134C911E296B2A00B9F3CB /* RCTNativeModule.h in Headers */, 13134CA11E296B2A00B9F3CB /* RCTCxxUtils.h in Headers */, - 13134C851E296B2A00B9F3CB /* RCTCxxBridge.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2743,7 +2705,6 @@ 3D80DA191DF820620028D040 /* RCTImageLoader.h in Headers */, 13134C941E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */, 3D80DA1A1DF820620028D040 /* RCTImageStoreManager.h in Headers */, - 13134C841E296B2A00B9F3CB /* RCTCxxBridge.h in Headers */, 130443A11E3FEAA900D93A67 /* RCTFollyConvert.h in Headers */, 59FBEFB41E46D91C0095D885 /* RCTScrollContentViewManager.h in Headers */, 3D80DA1B1DF820620028D040 /* RCTResizeMode.h in Headers */, @@ -2767,6 +2728,7 @@ 139D7E541E25C5A300323FB7 /* double-conversion.h in Headers */, 3D80DA2A1DF820620028D040 /* RCTErrorCustomizer.h in Headers */, 3D80DA2B1DF820620028D040 /* RCTErrorInfo.h in Headers */, + 1384E2081E806D4E00545659 /* RCTNativeModule.h in Headers */, 3D80DA2C1DF820620028D040 /* RCTEventDispatcher.h in Headers */, 3D80DA2D1DF820620028D040 /* RCTFrameUpdate.h in Headers */, 3D80DA2E1DF820620028D040 /* RCTImageSource.h in Headers */, @@ -2774,6 +2736,7 @@ 3D80DA2F1DF820620028D040 /* RCTInvalidating.h in Headers */, 139D7E5C1E25C5A300323FB7 /* utils.h in Headers */, 3D80DA301DF820620028D040 /* RCTJavaScriptExecutor.h in Headers */, + 135A9BFF1E7B0EE600587AEB /* RCTJSCHelpers.h in Headers */, 3D80DA311DF820620028D040 /* RCTJavaScriptLoader.h in Headers */, 130E3D881E6A082100ACE484 /* RCTDevSettings.h in Headers */, 3D80DA321DF820620028D040 /* RCTJSStackFrame.h in Headers */, @@ -2791,6 +2754,7 @@ 3D80DA3B1DF820620028D040 /* RCTPerformanceLogger.h in Headers */, 3D80DA3C1DF820620028D040 /* RCTPlatform.h in Headers */, 3D80DA3D1DF820620028D040 /* RCTRootView.h in Headers */, + 135A9BFB1E7B0EAE00587AEB /* RCTJSCErrorHandling.h in Headers */, 3D80DA3E1DF820620028D040 /* RCTRootViewDelegate.h in Headers */, 3D80DA3F1DF820620028D040 /* RCTRootViewInternal.h in Headers */, 3D80DA401DF820620028D040 /* RCTTouchEvent.h in Headers */, @@ -2798,13 +2762,10 @@ 13F880391E296D2800C3C7A1 /* noncopyable.h in Headers */, 13134C8C1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */, 3D80DA421DF820620028D040 /* RCTURLRequestDelegate.h in Headers */, - 13134C901E296B2A00B9F3CB /* RCTNativeModule.h in Headers */, 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */, 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */, 3D80DA451DF820620028D040 /* RCTWebSocketObserverProtocol.h in Headers */, 139D7EEA1E25DBDC00323FB7 /* symbolize.h in Headers */, - 3D80DA471DF820620028D040 /* RCTJSCErrorHandling.h in Headers */, - 3D80DA481DF820620028D040 /* RCTJSCExecutor.h in Headers */, 13134C981E296B2A00B9F3CB /* RCTCxxMethod.h in Headers */, 3D80DA491DF820620028D040 /* JSCSamplingProfiler.h in Headers */, 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */, @@ -2827,7 +2788,6 @@ 3D80DA591DF820620028D040 /* RCTTiming.h in Headers */, 3D80DA5A1DF820620028D040 /* RCTUIManager.h in Headers */, 3D80DA5B1DF820620028D040 /* RCTFPSGraph.h in Headers */, - 3D80DA5C1DF820620028D040 /* RCTJSCProfiler.h in Headers */, 3D80DA5D1DF820620028D040 /* RCTMacros.h in Headers */, 3D80DA5E1DF820620028D040 /* RCTProfile.h in Headers */, 3D80DA5F1DF820620028D040 /* RCTActivityIndicatorView.h in Headers */, @@ -3267,7 +3227,6 @@ 2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */, 2D3B5EC91D9B095C00451313 /* RCTBorderDrawing.m in Sources */, 2D3B5E991D9B089A00451313 /* RCTDisplayLink.m in Sources */, - 2D3B5EBF1D9B093300451313 /* RCTJSCProfiler.m in Sources */, 2D3B5EA11D9B08B600451313 /* RCTModuleData.mm in Sources */, 2D3B5EEA1D9B09CD00451313 /* RCTTabBar.m in Sources */, 2D3B5EAE1D9B08F800451313 /* RCTEventEmitter.m in Sources */, @@ -3304,16 +3263,14 @@ 2D3B5E951D9B087C00451313 /* RCTAssert.m in Sources */, 2D3B5EB61D9B091400451313 /* RCTExceptionsManager.m in Sources */, 2D3B5EEB1D9B09D000451313 /* RCTTabBarItem.m in Sources */, - 2D3B5E961D9B088500451313 /* RCTBatchedBridge.m in Sources */, 2D3B5ED41D9B097D00451313 /* RCTModalHostView.m in Sources */, 2D3B5E9F1D9B08AF00451313 /* RCTKeyCommands.m in Sources */, 2D3B5EA51D9B08C700451313 /* RCTRootView.m in Sources */, - 2D3B5EAC1D9B08EF00451313 /* RCTJSCExecutor.mm in Sources */, 13134C871E296B2A00B9F3CB /* RCTCxxBridge.mm in Sources */, CF2731C31E7B8DF30044CA4F /* RCTDeviceInfo.m in Sources */, 2D3B5EB11D9B090100451313 /* RCTAppState.m in Sources */, + 1384E20B1E806D5B00545659 /* RCTNativeModule.mm in Sources */, 2D3B5EC21D9B093B00451313 /* RCTProfile.m in Sources */, - 13134C931E296B2A00B9F3CB /* RCTNativeModule.mm in Sources */, 2D3B5ECB1D9B096200451313 /* RCTConvert+CoreLocation.m in Sources */, 2D3B5EEE1D9B09DA00451313 /* RCTView.m in Sources */, 2D3B5E981D9B089500451313 /* RCTConvert.m in Sources */, @@ -3327,12 +3284,12 @@ 2D3B5EB81D9B091B00451313 /* RCTSourceCode.m in Sources */, 2D3B5EB51D9B091100451313 /* RCTDevMenu.m in Sources */, 2D3B5EBD1D9B092A00451313 /* RCTTiming.m in Sources */, + 135A9C041E7B0F6400587AEB /* RCTJSCErrorHandling.mm in Sources */, 2D3B5EA81D9B08D300451313 /* RCTUtils.m in Sources */, 2D3B5EC81D9B095800451313 /* RCTActivityIndicatorViewManager.m in Sources */, 3DCD185D1DF978E7007FE5A1 /* RCTReloadCommand.m in Sources */, 130443DB1E401ADD00D93A67 /* RCTConvert+Transform.m in Sources */, 2D3B5EC61D9B095000451313 /* RCTProfileTrampoline-x86_64.S in Sources */, - 3D7A27E31DE325DA002E3F95 /* RCTJSCErrorHandling.mm in Sources */, 2D3B5EA61D9B08CA00451313 /* RCTTouchEvent.m in Sources */, 2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */, 2D3B5EF01D9B09E300451313 /* RCTWrapperViewController.m in Sources */, @@ -3356,6 +3313,7 @@ 2D3B5E9A1D9B089D00451313 /* RCTEventDispatcher.m in Sources */, 2D3B5ED61D9B098400451313 /* RCTModalHostViewManager.m in Sources */, 2D3B5EE51D9B09BE00451313 /* RCTShadowView.m in Sources */, + 135A9C051E7B0F7500587AEB /* RCTJSCHelpers.mm in Sources */, 2D3B5EC71D9B095600451313 /* RCTActivityIndicatorView.m in Sources */, 2D3B5EB21D9B090300451313 /* RCTAsyncLocalStorage.m in Sources */, 2D3B5EC01D9B093600451313 /* RCTPerfMonitor.m in Sources */, @@ -3387,6 +3345,7 @@ 13EBC6711E2870DE00880AC5 /* JSCWrapper.cpp in Sources */, 13EBC6731E2870DE00880AC5 /* Value.cpp in Sources */, 13EBC67D1E28725900880AC5 /* JSCHelpers.cpp in Sources */, + 135A9C021E7B0F4800587AEB /* systemJSCWrapper.cpp in Sources */, 13EBC67B1E28723000880AC5 /* Unicode.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3398,6 +3357,7 @@ 13EBC6791E2870E400880AC5 /* Unicode.cpp in Sources */, 13EBC6781E2870E400880AC5 /* JSCWrapper.cpp in Sources */, 13EBC6771E2870E400880AC5 /* JSCHelpers.cpp in Sources */, + 135A9C011E7B0F4700587AEB /* systemJSCWrapper.cpp in Sources */, 13EBC67A1E2870E400880AC5 /* Value.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3460,7 +3420,6 @@ 59FBEFB61E46D91C0095D885 /* RCTScrollContentViewManager.m in Sources */, 13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */, 000E6CEB1AB0E980000CDF4D /* RCTSourceCode.m in Sources */, - 14A43DF31C20B1C900794BC8 /* RCTJSCProfiler.m in Sources */, 001BFCD01D8381DE008E587E /* RCTMultipartStreamReader.m in Sources */, 133CAE8E1B8E5CFD00F6AD92 /* RCTDatePicker.m in Sources */, 14C2CA761B3AC64F00E6CBB2 /* RCTFrameUpdate.m in Sources */, @@ -3510,13 +3469,10 @@ 13B080051A6947C200A75B9A /* RCTScrollView.m in Sources */, A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */, E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */, - 3D7A27E21DE325B7002E3F95 /* RCTJSCErrorHandling.mm in Sources */, 13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */, 13B07FF21A69327A00A75B9A /* RCTTiming.m in Sources */, 1372B70A1AB030C200659ED6 /* RCTAppState.m in Sources */, 59A7B9FE1E577DBF0068EDBF /* RCTRootContentView.m in Sources */, - 134FCB3D1A6E7F0800051CC8 /* RCTJSCExecutor.mm in Sources */, - 14C2CA781B3ACB0400E6CBB2 /* RCTBatchedBridge.m in Sources */, 13E067591A70F44B002CDEE1 /* UIView+React.m in Sources */, 14F484561AABFCE100FDF6B9 /* RCTSliderManager.m in Sources */, CF2731C11E7B8DE40044CA4F /* RCTDeviceInfo.m in Sources */, @@ -3532,6 +3488,7 @@ 13E067571A70F44B002CDEE1 /* RCTView.m in Sources */, 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */, 13D9FEEE1CDCD93000158BD7 /* RCTKeyboardObserver.m in Sources */, + 135A9C001E7B0EE600587AEB /* RCTJSCHelpers.mm in Sources */, B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */, 13456E931ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m in Sources */, 137327E91AA5CF210034F82E /* RCTTabBarItemManager.m in Sources */, @@ -3543,7 +3500,6 @@ 83CBBA601A601EAA00E9B192 /* RCTBridge.m in Sources */, 13C156061AB1A2840079392D /* RCTWebViewManager.m in Sources */, 139D7EE71E25DBDC00323FB7 /* signalhandler.cc in Sources */, - 13134C921E296B2A00B9F3CB /* RCTNativeModule.mm in Sources */, 58114A161AAE854800E7D092 /* RCTPicker.m in Sources */, 137327E81AA5CF210034F82E /* RCTTabBarItem.m in Sources */, 83A1FE8C1B62640A00BE0E65 /* RCTModalHostView.m in Sources */, @@ -3558,12 +3514,13 @@ 13B0801A1A69489C00A75B9A /* RCTNavigator.m in Sources */, 137327E71AA5CF210034F82E /* RCTTabBar.m in Sources */, 13F17A851B8493E5007D4C75 /* RCTRedBox.m in Sources */, + 135A9BFC1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm in Sources */, 83392EB31B6634E10013B15F /* RCTModalHostViewController.m in Sources */, 13B0801C1A69489C00A75B9A /* RCTNavItem.m in Sources */, - 19DED2291E77E29200F089BB /* systemJSCWrapper.cpp in Sources */, 83CBBA691A601EF300E9B192 /* RCTEventDispatcher.m in Sources */, 83A1FE8F1B62643A00BE0E65 /* RCTModalHostViewManager.m in Sources */, 13E0674A1A70F434002CDEE1 /* RCTUIManager.m in Sources */, + 1384E2091E806D4E00545659 /* RCTNativeModule.mm in Sources */, 391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */, 1450FF861BCFF28A00208362 /* RCTProfile.m in Sources */, 13AB90C11B6FA36700713B4F /* RCTComponentData.m in Sources */, From 462352e609102d137df1ce45220cd5b54d9b3bd4 Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Tue, 21 Mar 2017 22:18:57 -0700 Subject: [PATCH 0036/1153] add jest snapshot tests Reviewed By: yungsters Differential Revision: D4726519 fbshipit-source-id: 1ae98743cdb89acb2708d84073527015dbeee906 --- .../Lists/__tests__/FlatList-test.js | 64 ++++ .../Lists/__tests__/SectionList-test.js | 67 +++++ .../__snapshots__/FlatList-test.js.snap | 247 +++++++++++++++ .../__snapshots__/SectionList-test.js.snap | 281 ++++++++++++++++++ 4 files changed, 659 insertions(+) create mode 100644 Libraries/CustomComponents/Lists/__tests__/FlatList-test.js create mode 100644 Libraries/CustomComponents/Lists/__tests__/SectionList-test.js create mode 100644 Libraries/CustomComponents/Lists/__tests__/__snapshots__/FlatList-test.js.snap create mode 100644 Libraries/CustomComponents/Lists/__tests__/__snapshots__/SectionList-test.js.snap diff --git a/Libraries/CustomComponents/Lists/__tests__/FlatList-test.js b/Libraries/CustomComponents/Lists/__tests__/FlatList-test.js new file mode 100644 index 000000000000..945e5f64e643 --- /dev/null +++ b/Libraries/CustomComponents/Lists/__tests__/FlatList-test.js @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +'use strict'; + +jest.disableAutomock(); + +const React = require('React'); +const ReactTestRenderer = require('react-test-renderer'); + +const FlatList = require('FlatList'); + +describe('FlatList', () => { + it('renders simple list', () => { + const component = ReactTestRenderer.create( + } + /> + ); + expect(component).toMatchSnapshot(); + }); + it('renders empty list', () => { + const component = ReactTestRenderer.create( + } + /> + ); + expect(component).toMatchSnapshot(); + }); + it('renders null list', () => { + const component = ReactTestRenderer.create( + } + /> + ); + expect(component).toMatchSnapshot(); + }); + it('renders all the bells and whistles', () => { + const component = ReactTestRenderer.create( + } + ListFooterComponent={() =>