diff --git a/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj b/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj index adaa6f58b9b8bd..70bc4f6a68010a 100644 --- a/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj +++ b/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 00E356F31AD99517003FC87E /* SampleAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* SampleAppTests.m */; }; 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; + 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 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 */; }; @@ -82,6 +83,13 @@ remoteGlobalIDString = 134814201AA4EA6300B7C361; remoteInfo = RCTSettings; }; + 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3C86DF461ADF2C930047B81A; + remoteInfo = RCTWebSocket; + }; 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; @@ -117,6 +125,7 @@ 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* SampleAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SampleAppTests.m; sourceTree = ""; }; 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../../Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; + 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../../Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; 13B07F961A680F5B00A75B9A /* SampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = ""; }; 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = ""; }; @@ -151,6 +160,7 @@ 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, + 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -230,6 +240,14 @@ name = Products; sourceTree = ""; }; + 139FDEE71B06529A00C62182 /* Products */ = { + isa = PBXGroup; + children = ( + 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, + ); + name = Products; + sourceTree = ""; + }; 13B07FAE1A68108700A75B9A /* SampleApp */ = { isa = PBXGroup; children = ( @@ -273,6 +291,7 @@ 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, + 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -407,6 +426,10 @@ ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; }, + { + ProductGroup = 139FDEE71B06529A00C62182 /* Products */; + ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; + }, { ProductGroup = 146834001AC3E56700842450 /* Products */; ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; @@ -470,6 +493,13 @@ remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTWebSocket.a; + remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 146834041AC3E56700842450 /* libReact.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj b/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj index 8b94a27cf75086..c7e038c9c2d8db 100644 --- a/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj +++ b/Examples/UIExplorer/UIExplorer.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; }; 134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1344545A1AAFCAAE003F0779 /* libRCTAdSupport.a */; }; 134A8A2A1AACED7A00945AAE /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 134A8A251AACED6A00945AAE /* libRCTGeolocation.a */; }; + 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; }; 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 */; }; @@ -68,6 +69,13 @@ remoteGlobalIDString = 134814201AA4EA6300B7C361; remoteInfo = RCTGeolocation; }; + 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3C86DF461ADF2C930047B81A; + remoteInfo = RCTWebSocket; + }; 147CED4A1AB34F8C00DA3E4C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 14E0EEC81AB118F7000DECC3 /* RCTActionSheet.xcodeproj */; @@ -121,6 +129,7 @@ 134180261AA91779003F314A /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; 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 = ""; }; + 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../../Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; 13B07F961A680F5B00A75B9A /* UIExplorer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIExplorer.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = UIExplorer/AppDelegate.h; sourceTree = ""; }; 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = UIExplorer/AppDelegate.m; sourceTree = ""; }; @@ -148,17 +157,18 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 834C36EC1AF8DED70019C93C /* libRCTSettings.a in Frameworks */, 14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */, - 58005BF21ABA80A60062E044 /* libRCTTest.a in Frameworks */, - D85B829E1AB6D5D7003F4FE2 /* libRCTVibration.a in Frameworks */, - 14DC67F41AB71881001358AB /* libRCTPushNotification.a in Frameworks */, 147CED4C1AB3532B00DA3E4C /* libRCTActionSheet.a in Frameworks */, 134454601AAFCABD003F0779 /* libRCTAdSupport.a in Frameworks */, 134A8A2A1AACED7A00945AAE /* libRCTGeolocation.a in Frameworks */, + 13417FE91AA91432003F314A /* libRCTImage.a in Frameworks */, 1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */, + 14DC67F41AB71881001358AB /* libRCTPushNotification.a in Frameworks */, + 834C36EC1AF8DED70019C93C /* libRCTSettings.a in Frameworks */, + 58005BF21ABA80A60062E044 /* libRCTTest.a in Frameworks */, 134180011AA9153C003F314A /* libRCTText.a in Frameworks */, - 13417FE91AA91432003F314A /* libRCTImage.a in Frameworks */, + D85B829E1AB6D5D7003F4FE2 /* libRCTVibration.a in Frameworks */, + 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -196,6 +206,7 @@ 58005BE41ABA80530062E044 /* RCTTest.xcodeproj */, 13417FEA1AA914B8003F314A /* RCTText.xcodeproj */, D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */, + 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -240,6 +251,14 @@ name = Products; sourceTree = ""; }; + 139FDECB1B0651EA00C62182 /* Products */ = { + isa = PBXGroup; + children = ( + 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */, + ); + name = Products; + sourceTree = ""; + }; 13B07FAE1A68108700A75B9A /* UIExplorer */ = { isa = PBXGroup; children = ( @@ -427,6 +446,10 @@ ProductGroup = D85B82921AB6D5CE003F4FE2 /* Products */; ProjectRef = D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */; }, + { + ProductGroup = 139FDECB1B0651EA00C62182 /* Products */; + ProjectRef = 139FDECA1B0651EA00C62182 /* RCTWebSocket.xcodeproj */; + }, { ProductGroup = 14AADF001AC3DB95002390C9 /* Products */; ProjectRef = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; @@ -476,6 +499,13 @@ remoteRef = 134A8A241AACED6A00945AAE /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTWebSocket.a; + remoteRef = 139FDED81B0651EA00C62182 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 147CED4B1AB34F8C00DA3E4C /* libRCTActionSheet.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 7d44754f341623..5b3ffe1c1e15bf 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -232,6 +232,10 @@ var TextInput = React.createClass({ * Callback that is called when the text input's submit button is pressed. */ onSubmitEditing: PropTypes.func, + /** + * Invoked on mount and layout changes with {x, y, width, height}. + */ + onLayout: PropTypes.func, /** * If true, the text input obscures the text entered so that sensitive text * like passwords stay secure. Default value is false. @@ -446,6 +450,7 @@ var TextInput = React.createClass({ onEndEditing={this.props.onEndEditing} onSubmitEditing={this.props.onSubmitEditing} onSelectionChangeShouldSetResponder={() => true} + onLayout={this.props.onLayout} placeholder={this.props.placeholder} placeholderTextColor={this.props.placeholderTextColor} text={this.state.bufferedValue} @@ -495,6 +500,7 @@ var TextInput = React.createClass({ onSelectionChange={this._onSelectionChange} onTextInput={this._onTextInput} onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue} + onLayout={this.props.onLayout} placeholder={this.props.placeholder} placeholderTextColor={this.props.placeholderTextColor} text={this.state.bufferedValue} @@ -530,6 +536,7 @@ var TextInput = React.createClass({ onChange={this._onChange} onEndEditing={this.props.onEndEditing} onSubmitEditing={this.props.onSubmitEditing} + onLayout={this.props.onLayout} password={this.props.password || this.props.secureTextEntry} placeholder={this.props.placeholder} text={this.state.bufferedValue} diff --git a/Libraries/CustomComponents/ListView/ListViewDataSource.js b/Libraries/CustomComponents/ListView/ListViewDataSource.js index 8e8000781c96c3..18838bd72539bb 100644 --- a/Libraries/CustomComponents/ListView/ListViewDataSource.js +++ b/Libraries/CustomComponents/ListView/ListViewDataSource.js @@ -103,6 +103,10 @@ class ListViewDataSource { * * or * + * { sectionID_1: [ , , ... ], ... } + * + * or + * * [ [ , , ... ], ... ] * * The constructor takes in a params argument that can contain any of the diff --git a/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js b/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js index ec12a99e67d416..29d64152e5a2a0 100644 --- a/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js +++ b/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js @@ -119,6 +119,11 @@ function setUpWebSockets() { GLOBAL.WebSocket = require('WebSocket'); } +function setupProfile() { + console.profile = console.profile || GLOBAL.consoleProfile || function () {}; + console.profileEnd = console.profileEnd || GLOBAL.consoleProfileEnd || function () {}; +} + setUpRedBoxErrorHandler(); setUpTimers(); setUpAlert(); @@ -127,3 +132,4 @@ setUpXHR(); setUpRedBoxConsoleErrorHandler(); setUpGeolocation(); setUpWebSockets(); +setupProfile(); diff --git a/Libraries/ReactIOS/NativeMethodsMixin.js b/Libraries/ReactIOS/NativeMethodsMixin.js index 4bc99f56b224ce..e31b0e43a85a18 100644 --- a/Libraries/ReactIOS/NativeMethodsMixin.js +++ b/Libraries/ReactIOS/NativeMethodsMixin.js @@ -20,7 +20,6 @@ var findNodeHandle = require('findNodeHandle'); var flattenStyle = require('flattenStyle'); var invariant = require('invariant'); var mergeFast = require('mergeFast'); -var mountSafeCallback = require('mountSafeCallback'); var precomputeStyle = require('precomputeStyle'); type MeasureOnSuccessCallback = ( @@ -161,4 +160,17 @@ if (__DEV__) { }; } +/** + * In the future, we should cleanup callbacks by cancelling them instead of + * using this. + */ +var mountSafeCallback = function(context: ReactComponent, callback: ?Function): any { + return function() { + if (!callback || (context.isMounted && !context.isMounted())) { + return; + } + return callback.apply(context, arguments); + }; +}; + module.exports = NativeMethodsMixin; diff --git a/Libraries/StyleSheet/precomputeStyle.js b/Libraries/StyleSheet/precomputeStyle.js index b875cc86d25987..1e9a290f83204a 100644 --- a/Libraries/StyleSheet/precomputeStyle.js +++ b/Libraries/StyleSheet/precomputeStyle.js @@ -13,8 +13,10 @@ var MatrixMath = require('MatrixMath'); var Platform = require('Platform'); + var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev'); var invariant = require('invariant'); +var stringifySafe = require('stringifySafe'); /** * This method provides a hook where flattened styles may be precomputed or @@ -123,6 +125,13 @@ function _convertToRadians(value: string): number { } function _validateTransform(key, value, transformation) { + invariant( + !value.getValue, + 'You passed an animated value or spring to a normal component. ' + + 'You need to wrap that component in an Animated. For example, ' + + 'replace by .' + ); + var multivalueTransforms = [ 'matrix', 'translate', @@ -132,7 +141,7 @@ function _validateTransform(key, value, transformation) { Array.isArray(value), 'Transform with key of %s must have an array as the value: %s', key, - JSON.stringify(transformation) + stringifySafe(transformation), ); } switch (key) { @@ -142,7 +151,7 @@ function _validateTransform(key, value, transformation) { 'Matrix transform must have a length of 9 (2d) or 16 (3d). ' + 'Provided matrix has a length of %s: %s', value.length, - JSON.stringify(transformation) + stringifySafe(transformation), ); break; case 'translate': @@ -152,13 +161,13 @@ function _validateTransform(key, value, transformation) { typeof value === 'string', 'Transform with key of "%s" must be a string: %s', key, - JSON.stringify(transformation) + stringifySafe(transformation), ); invariant( value.indexOf('deg') > -1 || value.indexOf('rad') > -1, 'Rotate transform must be expressed in degrees (deg) or radians ' + '(rad): %s', - JSON.stringify(transformation) + stringifySafe(transformation), ); break; default: @@ -166,7 +175,7 @@ function _validateTransform(key, value, transformation) { typeof value === 'number', 'Transform with key of "%s" must be a number: %s', key, - JSON.stringify(transformation) + stringifySafe(transformation), ); } } diff --git a/Libraries/Utilities/mountSafeCallback.js b/Libraries/Utilities/mountSafeCallback.js deleted file mode 100644 index c065718d19a4d2..00000000000000 --- a/Libraries/Utilities/mountSafeCallback.js +++ /dev/null @@ -1,23 +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 mountSafeCallback - * @flow - */ -'use strict'; - -var mountSafeCallback = function(context: ReactComponent, callback: ?Function): any { - return function() { - if (!callback || !context.isMounted()) { - return; - } - return callback.apply(context, arguments); - }; -}; - -module.exports = mountSafeCallback; diff --git a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj new file mode 100644 index 00000000000000..f4ce6d206daed9 --- /dev/null +++ b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj @@ -0,0 +1,257 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; + 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; + 3C86DF7C1ADF695F0047B81A /* RCTWebSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketManager.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1338BBDC1B04ACC80064A9C9 /* RCTSRWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSRWebSocket.h; sourceTree = ""; }; + 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSRWebSocket.m; sourceTree = ""; }; + 1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketExecutor.h; sourceTree = ""; }; + 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketExecutor.m; sourceTree = ""; }; + 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 3C86DF7A1ADF695F0047B81A /* RCTWebSocketManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketManager.h; sourceTree = ""; }; + 3C86DF7B1ADF695F0047B81A /* RCTWebSocketManager.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketManager.m; sourceTree = ""; tabWidth = 2; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3C86DF431ADF2C930047B81A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3C86DF3D1ADF2C930047B81A = { + isa = PBXGroup; + children = ( + 3C86DF7A1ADF695F0047B81A /* RCTWebSocketManager.h */, + 3C86DF7B1ADF695F0047B81A /* RCTWebSocketManager.m */, + 1338BBDC1B04ACC80064A9C9 /* RCTSRWebSocket.h */, + 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */, + 1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */, + 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */, + 3C86DF471ADF2C930047B81A /* Products */, + ); + indentWidth = 2; + sourceTree = ""; + tabWidth = 2; + }; + 3C86DF471ADF2C930047B81A /* Products */ = { + isa = PBXGroup; + children = ( + 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 3C86DF451ADF2C930047B81A /* RCTWebSocket */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */; + buildPhases = ( + 3C86DF421ADF2C930047B81A /* Sources */, + 3C86DF431ADF2C930047B81A /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RCTWebSocket; + productName = WebSocket; + productReference = 3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3C86DF3E1ADF2C930047B81A /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = Facebook; + TargetAttributes = { + 3C86DF451ADF2C930047B81A = { + CreatedOnToolsVersion = 6.3; + }; + }; + }; + buildConfigurationList = 3C86DF411ADF2C930047B81A /* Build configuration list for PBXProject "RCTWebSocket" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 3C86DF3D1ADF2C930047B81A; + productRefGroup = 3C86DF471ADF2C930047B81A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3C86DF451ADF2C930047B81A /* RCTWebSocket */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 3C86DF421ADF2C930047B81A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */, + 3C86DF7C1ADF695F0047B81A /* RCTWebSocketManager.m in Sources */, + 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3C86DF581ADF2C930047B81A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 3C86DF591ADF2C930047B81A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3C86DF5B1ADF2C930047B81A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + EXECUTABLE_PREFIX = lib; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../React/**", + "$(SRCROOT)/../SRWebSocket/", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 3C86DF5C1ADF2C930047B81A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + EXECUTABLE_PREFIX = lib; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../React/**", + "$(SRCROOT)/../SRWebSocket/", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3C86DF411ADF2C930047B81A /* Build configuration list for PBXProject "RCTWebSocket" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3C86DF581ADF2C930047B81A /* Debug */, + 3C86DF591ADF2C930047B81A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3C86DF5B1ADF2C930047B81A /* Debug */, + 3C86DF5C1ADF2C930047B81A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3C86DF3E1ADF2C930047B81A /* Project object */; +} diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 750cb422fddfef..a45c062cfbfdf3 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -836,6 +836,11 @@ - (void)setUp _batchedBridge = [[RCTBatchedBridge alloc] initWithParentBridge:self]; } +- (BOOL)isLoading +{ + return _batchedBridge.loading; +} + - (BOOL)isValid { return _batchedBridge.isValid; diff --git a/React/Executors/RCTContextExecutor.m b/React/Executors/RCTContextExecutor.m index 412ffd25693c36..ab5efe5a6079ad 100644 --- a/React/Executors/RCTContextExecutor.m +++ b/React/Executors/RCTContextExecutor.m @@ -112,6 +112,48 @@ static JSValueRef RCTNoop(JSContextRef context, JSObjectRef object, JSObjectRef return JSValueMakeUndefined(context); } +#if RCT_DEV + +static NSMutableArray *profiles; + +static JSValueRef RCTConsoleProfile(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) +{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + profiles = [[NSMutableArray alloc] init]; + }); + + static int profileCounter = 1; + NSString *profileName; + NSNumber *profileID = _RCTProfileBeginEvent(); + + if (argumentCount > 0) { + profileName = RCTJSValueToNSString(context, arguments[0]); + } else { + profileName = [NSString stringWithFormat:@"Profile %d", profileCounter++]; + } + + [profiles addObjectsFromArray:@[profileName, profileID]]; + + RCTLog(@"Profile '%@' finished.", profileName); + return JSValueMakeUndefined(context); +} + +static JSValueRef RCTConsoleProfileEnd(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception) +{ + NSNumber *profileID = [profiles lastObject]; + [profiles removeLastObject]; + NSString *profileName = [profiles lastObject]; + [profiles removeLastObject]; + + _RCTProfileEndEvent(profileID, profileName, @"console", nil); + + RCTLog(@"Profile '%@' started.", profileName); + return JSValueMakeUndefined(context); +} + +#endif + static NSString *RCTJSValueToNSString(JSContextRef context, JSValueRef value) { JSStringRef JSString = JSValueToStringCopy(context, value, NULL); @@ -198,6 +240,12 @@ - (instancetype)initWithJavaScriptThread:(NSThread *)javaScriptThread strongSelf->_context = [[RCTJavaScriptContext alloc] initWithJSContext:ctx]; [strongSelf _addNativeHook:RCTNativeLoggingHook withName:"nativeLoggingHook"]; [strongSelf _addNativeHook:RCTNoop withName:"noop"]; + +#if RCT_DEV + [strongSelf _addNativeHook:RCTConsoleProfile withName:"consoleProfile"]; + [strongSelf _addNativeHook:RCTConsoleProfileEnd withName:"consoleProfileEnd"]; +#endif + }]; } diff --git a/packager/transformer.js b/packager/transformer.js index 31cb8d3104baf3..00beeaddeeda11 100644 --- a/packager/transformer.js +++ b/packager/transformer.js @@ -16,10 +16,12 @@ var reactVisitors = require('react-tools/vendor/fbtransform/visitors').getAllVisitors(); var staticTypeSyntax = require('jstransform/visitors/type-syntax').visitorList; +var trailingCommaVisitors = + require('jstransform/visitors/es7-trailing-comma-visitors.js').visitorList; + // Note that reactVisitors now handles ES6 classes, rest parameters, arrow // functions, template strings, and object short notation. -var visitorList = reactVisitors; - +var visitorList = reactVisitors.concat(trailingCommaVisitors); function transform(srcTxt, filename) { var options = {