diff --git a/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj b/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj index 70bc4f6a6..05480738f 100644 --- a/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj +++ b/Examples/SampleApp/SampleApp.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; }; 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; @@ -34,13 +33,6 @@ remoteGlobalIDString = 134814201AA4EA6300B7C361; remoteInfo = RCTActionSheet; }; - 00C302B31ABCB8E700DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTAdSupport; - }; 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; @@ -116,7 +108,6 @@ /* Begin PBXFileReference section */ 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = ""; }; 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../../Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; - 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = ../../Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = ""; }; 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../../Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; @@ -152,7 +143,6 @@ files = ( 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */, 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, @@ -175,14 +165,6 @@ name = Products; sourceTree = ""; }; - 00C302B01ABCB8E700DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */, - ); - name = Products; - sourceTree = ""; - }; 00C302B61ABCB90400DB3ED1 /* Products */ = { isa = PBXGroup; children = ( @@ -283,7 +265,6 @@ children = ( 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, @@ -394,10 +375,6 @@ ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; }, - { - ProductGroup = 00C302B01ABCB8E700DB3ED1 /* Products */; - ProjectRef = 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */; - }, { ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; @@ -451,13 +428,6 @@ remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAdSupport.a; - remoteRef = 00C302B31ABCB8E700DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js b/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js index a3f1fe6be..d6afa3e06 100644 --- a/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js +++ b/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js @@ -53,6 +53,12 @@ var ActivityIndicatorIOS = React.createClass({ 'small', 'large', ]), + /** + * Invoked on mount and layout changes with + * + * {nativeEvent: { layout: {x, y, width, height}}}. + */ + onLayout: PropTypes.func, }, getDefaultProps: function(): DefaultProps { @@ -65,10 +71,12 @@ var ActivityIndicatorIOS = React.createClass({ }, render: function() { - var {style, ...props} = this.props; + var {onLayout, style, ...props} = this.props; var sizeStyle = (this.props.size === 'large') ? styles.sizeLarge : styles.sizeSmall; return ( - + ); diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index bd7529e58..c3659e961 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -91,7 +91,9 @@ var View = React.createClass({ onStartShouldSetResponderCapture: PropTypes.func, /** - * Invoked on mount and layout changes with {x, y, width, height}. + * Invoked on mount and layout changes with + * + * {nativeEvent: { layout: {x, y, width, height}}}. */ onLayout: PropTypes.func, diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index f388468c4..45c1ad828 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -99,6 +99,12 @@ var Image = React.createClass({ * testing scripts. */ testID: PropTypes.string, + /** + * Invoked on mount and layout changes with + * + * {nativeEvent: { layout: {x, y, width, height}}}. + */ + onLayout: PropTypes.func, }, statics: { diff --git a/Libraries/NativeApp/RCTNativeAppEventEmitter.js b/Libraries/NativeApp/RCTNativeAppEventEmitter.js new file mode 100644 index 000000000..38ccb0dcf --- /dev/null +++ b/Libraries/NativeApp/RCTNativeAppEventEmitter.js @@ -0,0 +1,18 @@ +/** + * 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 RCTNativeAppEventEmitter + * @flow + */ +'use strict'; + +var EventEmitter = require('EventEmitter'); + +var RCTNativeAppEventEmitter = new EventEmitter(); + +module.exports = RCTNativeAppEventEmitter; diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index dee0d8543..6e934a8e6 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -92,6 +92,12 @@ var Text = React.createClass({ * Used to locate this view in end-to-end tests. */ testID: React.PropTypes.string, + /** + * Invoked on mount and layout changes with + * + * {nativeEvent: { layout: {x, y, width, height}}}. + */ + onLayout: React.PropTypes.func, }, viewConfig: viewConfig, diff --git a/Libraries/react-native/react-native.js b/Libraries/react-native/react-native.js index b94b172f3..c81183b5b 100644 --- a/Libraries/react-native/react-native.js +++ b/Libraries/react-native/react-native.js @@ -59,6 +59,7 @@ var ReactNative = Object.assign(Object.create(require('React')), { // Plugins DeviceEventEmitter: require('RCTDeviceEventEmitter'), + NativeAppEventEmitter: require('RCTNativeAppEventEmitter'), NativeModules: require('NativeModules'), requireNativeComponent: require('requireNativeComponent'), diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index a45c062cf..42973a3b6 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -1148,6 +1148,9 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(NSString *)module method:(NSStrin [[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptDidLoadNotification object:_parentBridge userInfo:@{ @"bridge": self }]; + } else { + [[RCTRedBox sharedInstance] showErrorMessage:[loadError localizedDescription] + withDetails:[loadError localizedFailureReason]]; } }]; } diff --git a/packager/react-packager/src/Packager/Package.js b/packager/react-packager/src/Packager/Package.js index c621f7470..eca709d50 100644 --- a/packager/react-packager/src/Packager/Package.js +++ b/packager/react-packager/src/Packager/Package.js @@ -285,6 +285,6 @@ function generateSourceMapForVirtualModule(module) { names: [], mappings: mappings, file: module.sourcePath, - sourcesContent: [ module.code ], + sourcesContent: [ module.sourceCode ], }; } diff --git a/packager/react-packager/src/Packager/__tests__/Packager-test.js b/packager/react-packager/src/Packager/__tests__/Packager-test.js index 9babda547..901c467ba 100644 --- a/packager/react-packager/src/Packager/__tests__/Packager-test.js +++ b/packager/react-packager/src/Packager/__tests__/Packager-test.js @@ -150,7 +150,9 @@ describe('Packager', function() { sourceCode: 'module.exports = ' + JSON.stringify(imgModule_DEPRECATED) + ';', - sourcePath: '/root/img/img.png' + sourcePath: '/root/img/img.png', + virtual: true, + map: undefined, }); var imgModule = { @@ -172,13 +174,17 @@ describe('Packager', function() { sourceCode: 'module.exports = require("AssetRegistry").registerAsset(' + JSON.stringify(imgModule) + ');', - sourcePath: '/root/img/new_image.png' + sourcePath: '/root/img/new_image.png', + virtual: true, + map: undefined, }); expect(p.addModule.mock.calls[4][0]).toEqual({ code: 'lol module.exports = {"json":true}; lol', sourceCode: 'module.exports = {"json":true};', - sourcePath: '/root/file.json' + sourcePath: '/root/file.json', + map: undefined, + virtual: true, }); expect(p.finalize.mock.calls[0]).toEqual([ diff --git a/packager/react-packager/src/Packager/index.js b/packager/react-packager/src/Packager/index.js index e647f7642..e5afefe76 100644 --- a/packager/react-packager/src/Packager/index.js +++ b/packager/react-packager/src/Packager/index.js @@ -165,6 +165,7 @@ Packager.prototype._transformModule = function(ppackage, module) { map: transformed.map, sourceCode: transformed.sourceCode, sourcePath: transformed.sourcePath, + virtual: transformed.virtual, }); }); };