From 9086365fafc24e3fe4b5dceb82364bb034bcccba Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Tue, 17 Mar 2015 22:22:03 -0700 Subject: [PATCH] [ReactNative] Strip prefixes from NativeModules keys --- .../IntegrationTestHarnessTest.js | 2 +- Libraries/ActionSheetIOS/ActionSheetIOS.js | 2 +- Libraries/AdSupport/AdSupportIOS.js | 2 +- Libraries/Animation/Animation.js | 2 +- Libraries/Animation/AnimationMixin.js | 2 +- Libraries/Animation/LayoutAnimation.js | 2 +- Libraries/AppState/AppState.js | 2 +- Libraries/AppStateIOS/AppStateIOS.ios.js | 2 +- .../BatchedBridgedModules/NativeModules.js | 4 +-- .../BatchedBridgedModules/POPAnimation.js | 2 +- .../RCTAlertManager.ios.js | 2 +- Libraries/CameraRoll/CameraRoll.js | 2 +- .../ActivityIndicatorIOS.ios.js | 2 +- .../DatePicker/DatePickerIOS.ios.js | 2 +- Libraries/Components/ListView/ListView.js | 2 +- .../Components/Navigation/NavigatorIOS.ios.js | 2 +- Libraries/Components/ScrollResponder.js | 4 +-- Libraries/Components/ScrollView/ScrollView.js | 4 +-- .../Components/StatusBar/StatusBarIOS.ios.js | 2 +- .../Components/TextInput/TextInput.ios.js | 2 +- .../Components/TextInput/TextInputState.js | 2 +- .../Components/WebView/WebView.android.js | 2 +- Libraries/Components/WebView/WebView.ios.js | 2 +- Libraries/Geolocation/Geolocation.ios.js | 2 +- Libraries/Image/Image.ios.js | 2 +- .../InitializeJavaScriptAppEngine.js | 4 +-- .../Initialization/loadSourceMap.js | 2 +- .../System/JSTimers/JSTimers.js | 2 +- Libraries/Network/NetInfo.js | 2 +- Libraries/Network/XMLHttpRequest.ios.js | 2 +- Libraries/Picker/PickerIOS.ios.js | 2 +- Libraries/RKBackendNode/queryLayoutByID.js | 2 +- .../ReactIOS/IOSNativeBridgeEventPlugin.js | 2 +- Libraries/ReactIOS/NativeMethodsMixin.js | 4 +-- Libraries/ReactIOS/ReactIOSDOMIDOperations.js | 2 +- .../ReactIOSGlobalResponderHandler.js | 2 +- Libraries/ReactIOS/ReactIOSMount.js | 2 +- Libraries/ReactIOS/ReactIOSNativeComponent.js | 2 +- Libraries/ReactIOS/ReactIOSTextComponent.js | 2 +- Libraries/Storage/AsyncStorage.ios.js | 4 +-- Libraries/Utilities/AlertIOS.js | 2 +- Libraries/Utilities/Dimensions.js | 2 +- Libraries/Utilities/PushNotificationIOS.js | 2 +- .../Utilities/nativeModulePrefixDuplicator.js | 25 ------------------- .../Utilities/nativeModulePrefixNormalizer.js | 24 ++++++++++++++++++ Libraries/Vibration/VibrationIOS.ios.js | 3 ++- 46 files changed, 75 insertions(+), 75 deletions(-) delete mode 100644 Libraries/Utilities/nativeModulePrefixDuplicator.js create mode 100644 Libraries/Utilities/nativeModulePrefixNormalizer.js diff --git a/IntegrationTests/IntegrationTestHarnessTest.js b/IntegrationTests/IntegrationTestHarnessTest.js index 5b6e78838..5ae78cf9c 100644 --- a/IntegrationTests/IntegrationTestHarnessTest.js +++ b/IntegrationTests/IntegrationTestHarnessTest.js @@ -3,7 +3,7 @@ */ 'use strict'; -var RCTTestModule = require('NativeModules').RCTTestModule; +var RCTTestModule = require('NativeModules').TestModule; var React = require('react-native'); var { Text, diff --git a/Libraries/ActionSheetIOS/ActionSheetIOS.js b/Libraries/ActionSheetIOS/ActionSheetIOS.js index 5a24f06b0..adbb8e3ab 100644 --- a/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -5,7 +5,7 @@ */ 'use strict'; -var { RCTActionSheetManager } = require('NativeModules'); +var RCTActionSheetManager = require('NativeModules').ActionSheetManager; var invariant = require('invariant'); diff --git a/Libraries/AdSupport/AdSupportIOS.js b/Libraries/AdSupport/AdSupportIOS.js index c0a081aa4..a470f05cd 100644 --- a/Libraries/AdSupport/AdSupportIOS.js +++ b/Libraries/AdSupport/AdSupportIOS.js @@ -5,7 +5,7 @@ */ 'use strict'; -var AdSupport = require('NativeModules').RCTAdSupport; +var AdSupport = require('NativeModules').AdSupport; module.exports = { getAdvertisingId: function(onSuccess, onFailure) { diff --git a/Libraries/Animation/Animation.js b/Libraries/Animation/Animation.js index 30624266d..3fbfb757f 100644 --- a/Libraries/Animation/Animation.js +++ b/Libraries/Animation/Animation.js @@ -6,7 +6,7 @@ */ 'use strict'; -var { RCTAnimationManager } = require('NativeModules'); +var RCTAnimationManager = require('NativeModules').AnimationManager; var AnimationUtils = require('AnimationUtils'); type EasingFunction = (t: number) => number; diff --git a/Libraries/Animation/AnimationMixin.js b/Libraries/Animation/AnimationMixin.js index 56f63fb8e..c33d630a9 100644 --- a/Libraries/Animation/AnimationMixin.js +++ b/Libraries/Animation/AnimationMixin.js @@ -7,7 +7,7 @@ 'use strict'; var AnimationUtils = require('AnimationUtils'); -var { RCTAnimationManager } = require('NativeModules'); +var RCTAnimationManager = require('NativeModules').AnimationManager; var invariant = require('invariant'); diff --git a/Libraries/Animation/LayoutAnimation.js b/Libraries/Animation/LayoutAnimation.js index a5adc567b..16f737ba3 100644 --- a/Libraries/Animation/LayoutAnimation.js +++ b/Libraries/Animation/LayoutAnimation.js @@ -6,7 +6,7 @@ 'use strict'; var PropTypes = require('ReactPropTypes'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker'); var keyMirror = require('keyMirror'); diff --git a/Libraries/AppState/AppState.js b/Libraries/AppState/AppState.js index 47834936a..043cdba55 100644 --- a/Libraries/AppState/AppState.js +++ b/Libraries/AppState/AppState.js @@ -6,7 +6,7 @@ 'use strict'; var NativeModules = require('NativeModules'); -var RCTAppState = NativeModules.RCTAppState; +var RCTAppState = NativeModules.AppState; var AppState = { diff --git a/Libraries/AppStateIOS/AppStateIOS.ios.js b/Libraries/AppStateIOS/AppStateIOS.ios.js index 1f6bca95b..9b3e44472 100644 --- a/Libraries/AppStateIOS/AppStateIOS.ios.js +++ b/Libraries/AppStateIOS/AppStateIOS.ios.js @@ -7,7 +7,7 @@ var NativeModules = require('NativeModules'); var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); -var RCTAppState = NativeModules.RCTAppState; +var RCTAppState = NativeModules.AppState; var logError = require('logError'); diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js index f8029f8b8..be36f8663 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js @@ -7,8 +7,8 @@ var NativeModules = require('BatchedBridge').RemoteModules; -var nativeModulePrefixDuplicator = require('nativeModulePrefixDuplicator'); +var nativeModulePrefixNormalizer = require('nativeModulePrefixNormalizer'); -nativeModulePrefixDuplicator(NativeModules); +nativeModulePrefixNormalizer(NativeModules); module.exports = NativeModules; diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/POPAnimation.js b/Libraries/BatchedBridge/BatchedBridgedModules/POPAnimation.js index 3195e3ee1..97158ecfa 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/POPAnimation.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/POPAnimation.js @@ -5,7 +5,7 @@ */ 'use strict'; -var RCTPOPAnimationManager = require('NativeModules').RCTPOPAnimationManager; +var RCTPOPAnimationManager = require('NativeModules').POPAnimationManager; if (!RCTPOPAnimationManager) { // POP animation isn't available in the OSS fork - this is a temporary // workaround to enable its availability to be determined at runtime. diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js b/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js index 3621795da..e8b3bcd27 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/RCTAlertManager.ios.js @@ -5,6 +5,6 @@ */ 'use strict'; -var { RCTAlertManager } = require('NativeModules'); +var RCTAlertManager = require('NativeModules').AlertManager; module.exports = RCTAlertManager; diff --git a/Libraries/CameraRoll/CameraRoll.js b/Libraries/CameraRoll/CameraRoll.js index d97fa8ce2..c8499fc97 100644 --- a/Libraries/CameraRoll/CameraRoll.js +++ b/Libraries/CameraRoll/CameraRoll.js @@ -6,7 +6,7 @@ 'use strict'; var ReactPropTypes = require('ReactPropTypes'); -var RCTCameraRollManager = require('NativeModules').RCTCameraRollManager; +var RCTCameraRollManager = require('NativeModules').CameraRollManager; var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker'); var deepFreezeAndThrowOnMutationInDev = diff --git a/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js b/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js index 7eab49dd1..8c09ac551 100644 --- a/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js +++ b/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js @@ -56,7 +56,7 @@ var ActivityIndicatorIOS = React.createClass({ render: function() { var style = styles.sizeSmall; - var NativeConstants = NativeModules.RCTUIManager.UIActivityIndicatorView.Constants; + var NativeConstants = NativeModules.UIManager.UIActivityIndicatorView.Constants; var activityIndicatorViewStyle = NativeConstants.StyleWhite; if (this.props.size === 'large') { style = styles.sizeLarge; diff --git a/Libraries/Components/DatePicker/DatePickerIOS.ios.js b/Libraries/Components/DatePicker/DatePickerIOS.ios.js index 2522b12e3..a010870b1 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.ios.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.ios.js @@ -11,7 +11,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var PropTypes = require('ReactPropTypes'); var React = require('React'); var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); -var RCTDatePickerIOSConsts = require('NativeModules').RCTUIManager.RCTDatePicker.Constants; +var RCTDatePickerIOSConsts = require('NativeModules').UIManager.RCTDatePicker.Constants; var StyleSheet = require('StyleSheet'); var View = require('View'); diff --git a/Libraries/Components/ListView/ListView.js b/Libraries/Components/ListView/ListView.js index c6e0f5113..e0c067a18 100644 --- a/Libraries/Components/ListView/ListView.js +++ b/Libraries/Components/ListView/ListView.js @@ -7,7 +7,7 @@ var ListViewDataSource = require('ListViewDataSource'); var React = require('React'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var ScrollView = require('ScrollView'); var ScrollResponder = require('ScrollResponder'); var StaticRenderer = require('StaticRenderer'); diff --git a/Libraries/Components/Navigation/NavigatorIOS.ios.js b/Libraries/Components/Navigation/NavigatorIOS.ios.js index c09ce242a..30082cf21 100644 --- a/Libraries/Components/Navigation/NavigatorIOS.ios.js +++ b/Libraries/Components/Navigation/NavigatorIOS.ios.js @@ -8,7 +8,7 @@ var EventEmitter = require('EventEmitter'); var React = require('React'); var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); -var { RCTNavigatorManager } = require('NativeModules'); +var RCTNavigatorManager = require('NativeModules').NavigatorManager; var StyleSheet = require('StyleSheet'); var StaticContainer = require('StaticContainer.react'); var View = require('View'); diff --git a/Libraries/Components/ScrollResponder.js b/Libraries/Components/ScrollResponder.js index b8f4c96c6..b6e55e078 100644 --- a/Libraries/Components/ScrollResponder.js +++ b/Libraries/Components/ScrollResponder.js @@ -11,8 +11,8 @@ var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); var Subscribable = require('Subscribable'); var TextInputState = require('TextInputState'); -var RCTUIManager = NativeModules.RCTUIManager; -var RCTUIManagerDeprecated = NativeModules.RCTUIManager; +var RCTUIManager = NativeModules.UIManager; +var RCTUIManagerDeprecated = NativeModules.UIManager; var RCTScrollViewConsts = RCTUIManager.RCTScrollView.Constants; var warning = require('warning'); diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 804b6f578..a069988ce 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -8,12 +8,12 @@ var EdgeInsetsPropType = require('EdgeInsetsPropType'); var Platform = require('Platform'); var PointPropType = require('PointPropType'); -var RCTScrollView = require('NativeModules').RCTUIManager.RCTScrollView; +var RCTScrollView = require('NativeModules').UIManager.RCTScrollView; var RCTScrollViewConsts = RCTScrollView.Constants; var React = require('React'); var ReactIOSTagHandles = require('ReactIOSTagHandles'); var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var ScrollResponder = require('ScrollResponder'); var StyleSheet = require('StyleSheet'); var StyleSheetPropType = require('StyleSheetPropType'); diff --git a/Libraries/Components/StatusBar/StatusBarIOS.ios.js b/Libraries/Components/StatusBar/StatusBarIOS.ios.js index 50097f3dd..55cb1608c 100644 --- a/Libraries/Components/StatusBar/StatusBarIOS.ios.js +++ b/Libraries/Components/StatusBar/StatusBarIOS.ios.js @@ -6,7 +6,7 @@ */ 'use strict'; -var { RCTStatusBarManager } = require('NativeModules'); +var RCTStatusBarManager = require('NativeModules').StatusBarManager; var StatusBarIOS = { diff --git a/Libraries/Components/TextInput/TextInput.ios.js b/Libraries/Components/TextInput/TextInput.ios.js index 21ad49f53..2f2b24dd6 100644 --- a/Libraries/Components/TextInput/TextInput.ios.js +++ b/Libraries/Components/TextInput/TextInput.ios.js @@ -8,7 +8,7 @@ var DocumentSelectionState = require('DocumentSelectionState'); var EventEmitter = require('EventEmitter'); var NativeMethodsMixin = require('NativeMethodsMixin'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var PropTypes = require('ReactPropTypes'); var React = require('React'); var ReactChildren = require('ReactChildren'); diff --git a/Libraries/Components/TextInput/TextInputState.js b/Libraries/Components/TextInput/TextInputState.js index 6d22e3e77..2bbe8a3d0 100644 --- a/Libraries/Components/TextInput/TextInputState.js +++ b/Libraries/Components/TextInput/TextInputState.js @@ -9,7 +9,7 @@ */ 'use strict'; -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var TextInputState = { /** diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index d153ebe92..43e6f2c5a 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -16,7 +16,7 @@ var keyMirror = require('keyMirror'); var merge = require('merge'); var PropTypes = React.PropTypes; -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var RCT_WEBVIEW_REF = 'webview'; diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index e7d483fc4..213f887ac 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -17,7 +17,7 @@ var insetsDiffer = require('insetsDiffer'); var merge = require('merge'); var PropTypes = React.PropTypes; -var { RCTWebViewManager } = require('NativeModules'); +var RCTWebViewManager = require('NativeModules').WebViewManager; var RCT_WEBVIEW_REF = 'webview'; diff --git a/Libraries/Geolocation/Geolocation.ios.js b/Libraries/Geolocation/Geolocation.ios.js index 0e8015335..37134dd31 100644 --- a/Libraries/Geolocation/Geolocation.ios.js +++ b/Libraries/Geolocation/Geolocation.ios.js @@ -6,7 +6,7 @@ 'use strict'; var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); -var RCTLocationObserver = require('NativeModules').RCTLocationObserver; +var RCTLocationObserver = require('NativeModules').LocationObserver; var invariant = require('invariant'); var logError = require('logError'); diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 771a27543..315667d25 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -114,7 +114,7 @@ var Image = React.createClass({ warning(RawImage === RCTStaticImage, 'tintColor style only supported on static images.'); } - var contentModes = NativeModules.RCTUIManager.UIView.ContentMode; + var contentModes = NativeModules.UIManager.UIView.ContentMode; var resizeMode; if (style.resizeMode === ImageResizeMode.stretch) { resizeMode = contentModes.ScaleToFill; diff --git a/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js b/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js index 6d4d762bd..92c9d27ed 100644 --- a/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js +++ b/Libraries/JavaScriptAppEngine/Initialization/InitializeJavaScriptAppEngine.js @@ -60,7 +60,7 @@ function setupDocumentShim() { var sourceMapPromise; function handleErrorWithRedBox(e) { - var RCTExceptionsManager = require('NativeModules').RCTExceptionsManager; + var RCTExceptionsManager = require('NativeModules').ExceptionsManager; var errorToString = require('errorToString'); var loadSourceMap = require('loadSourceMap'); @@ -115,7 +115,7 @@ function setupTimers() { } function setupAlert() { - var { RCTAlertManager } = require('NativeModules'); + var RCTAlertManager = require('NativeModules').AlertManager; if (!GLOBAL.alert) { GLOBAL.alert = function(text) { var alertOpts = { diff --git a/Libraries/JavaScriptAppEngine/Initialization/loadSourceMap.js b/Libraries/JavaScriptAppEngine/Initialization/loadSourceMap.js index 48fd9d1bf..0af19b27e 100644 --- a/Libraries/JavaScriptAppEngine/Initialization/loadSourceMap.js +++ b/Libraries/JavaScriptAppEngine/Initialization/loadSourceMap.js @@ -8,7 +8,7 @@ 'use strict'; var Promise = require('Promise'); -var RCTSourceCode = require('NativeModules').RCTSourceCode; +var RCTSourceCode = require('NativeModules').SourceCode; var SourceMapConsumer = require('SourceMap').SourceMapConsumer; var SourceMapURL = require('./source-map-url'); diff --git a/Libraries/JavaScriptAppEngine/System/JSTimers/JSTimers.js b/Libraries/JavaScriptAppEngine/System/JSTimers/JSTimers.js index 1b25e00c1..593070e9e 100644 --- a/Libraries/JavaScriptAppEngine/System/JSTimers/JSTimers.js +++ b/Libraries/JavaScriptAppEngine/System/JSTimers/JSTimers.js @@ -7,7 +7,7 @@ // Note that the module JSTimers is split into two in order to solve a cycle // in dependencies. NativeModules > BatchedBridge > MessageQueue > JSTimersExecution -var RCTTiming = require('NativeModules').RCTTiming; +var RCTTiming = require('NativeModules').Timing; var JSTimersExecution = require('JSTimersExecution'); /** diff --git a/Libraries/Network/NetInfo.js b/Libraries/Network/NetInfo.js index 671b064a2..b228547a6 100644 --- a/Libraries/Network/NetInfo.js +++ b/Libraries/Network/NetInfo.js @@ -8,7 +8,7 @@ var NativeModules = require('NativeModules'); var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); -var RCTReachability = NativeModules.RCTReachability; +var RCTReachability = NativeModules.Reachability; var DEVICE_REACHABILITY_EVENT = 'reachabilityDidChange'; diff --git a/Libraries/Network/XMLHttpRequest.ios.js b/Libraries/Network/XMLHttpRequest.ios.js index b747d0bed..d1e2e92e8 100644 --- a/Libraries/Network/XMLHttpRequest.ios.js +++ b/Libraries/Network/XMLHttpRequest.ios.js @@ -6,7 +6,7 @@ */ 'use strict'; -var RCTDataManager = require('NativeModules').RCTDataManager; +var RCTDataManager = require('NativeModules').DataManager; var crc32 = require('crc32'); diff --git a/Libraries/Picker/PickerIOS.ios.js b/Libraries/Picker/PickerIOS.ios.js index c2d1c2241..69d163cf5 100644 --- a/Libraries/Picker/PickerIOS.ios.js +++ b/Libraries/Picker/PickerIOS.ios.js @@ -11,7 +11,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); var ReactChildren = require('ReactChildren'); var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); -var RCTPickerIOSConsts = require('NativeModules').RCTUIManager.RCTPicker.Constants; +var RCTPickerIOSConsts = require('NativeModules').UIManager.RCTPicker.Constants; var StyleSheet = require('StyleSheet'); var View = require('View'); diff --git a/Libraries/RKBackendNode/queryLayoutByID.js b/Libraries/RKBackendNode/queryLayoutByID.js index a93130e89..0d8893eb6 100644 --- a/Libraries/RKBackendNode/queryLayoutByID.js +++ b/Libraries/RKBackendNode/queryLayoutByID.js @@ -6,7 +6,7 @@ 'use strict'; var ReactIOSTagHandles = require('ReactIOSTagHandles'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; /** * Queries the layout of a view. The layout does not reflect the element as diff --git a/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js b/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js index 16446f85d..fea12db6c 100644 --- a/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js +++ b/Libraries/ReactIOS/IOSNativeBridgeEventPlugin.js @@ -13,7 +13,7 @@ var SyntheticEvent = require('SyntheticEvent'); var merge = require('merge'); var warning = require('warning'); -var RCTUIManager = NativeModules.RCTUIManager; +var RCTUIManager = NativeModules.UIManager; var customBubblingEventTypes = RCTUIManager.customBubblingEventTypes; var customDirectEventTypes = RCTUIManager.customDirectEventTypes; diff --git a/Libraries/ReactIOS/NativeMethodsMixin.js b/Libraries/ReactIOS/NativeMethodsMixin.js index 767264fae..9edc06413 100644 --- a/Libraries/ReactIOS/NativeMethodsMixin.js +++ b/Libraries/ReactIOS/NativeMethodsMixin.js @@ -7,8 +7,8 @@ var NativeModules = require('NativeModules'); var NativeModules = require('NativeModules'); -var RCTPOPAnimationManager = NativeModules.RCTPOPAnimationManager; -var RCTUIManager = NativeModules.RCTUIManager; +var RCTPOPAnimationManager = NativeModules.POPAnimationManager; +var RCTUIManager = NativeModules.UIManager; var TextInputState = require('TextInputState'); var flattenStyle = require('flattenStyle'); diff --git a/Libraries/ReactIOS/ReactIOSDOMIDOperations.js b/Libraries/ReactIOS/ReactIOSDOMIDOperations.js index 771b58110..dfb96f8cb 100644 --- a/Libraries/ReactIOS/ReactIOSDOMIDOperations.js +++ b/Libraries/ReactIOS/ReactIOSDOMIDOperations.js @@ -9,7 +9,7 @@ var ReactIOSTagHandles = require('ReactIOSTagHandles'); var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var ReactPerf = require('ReactPerf'); /** diff --git a/Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js b/Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js index 9c9e64db5..d22f98489 100644 --- a/Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js +++ b/Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js @@ -3,7 +3,7 @@ */ 'use strict'; -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var ReactIOSTagHandles = require('ReactIOSTagHandles'); var ReactIOSGlobalResponderHandler = { diff --git a/Libraries/ReactIOS/ReactIOSMount.js b/Libraries/ReactIOS/ReactIOSMount.js index 7226159cc..e26e9934e 100644 --- a/Libraries/ReactIOS/ReactIOSMount.js +++ b/Libraries/ReactIOS/ReactIOSMount.js @@ -5,7 +5,7 @@ */ 'use strict'; -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var ReactIOSTagHandles = require('ReactIOSTagHandles'); var ReactPerf = require('ReactPerf'); diff --git a/Libraries/ReactIOS/ReactIOSNativeComponent.js b/Libraries/ReactIOS/ReactIOSNativeComponent.js index 39c2f294a..3bbec560c 100644 --- a/Libraries/ReactIOS/ReactIOSNativeComponent.js +++ b/Libraries/ReactIOS/ReactIOSNativeComponent.js @@ -11,7 +11,7 @@ var ReactIOSEventEmitter = require('ReactIOSEventEmitter'); var ReactIOSStyleAttributes = require('ReactIOSStyleAttributes'); var ReactIOSTagHandles = require('ReactIOSTagHandles'); var ReactMultiChild = require('ReactMultiChild'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var styleDiffer = require('styleDiffer'); var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev'); diff --git a/Libraries/ReactIOS/ReactIOSTextComponent.js b/Libraries/ReactIOS/ReactIOSTextComponent.js index ca8417ddf..ef53b2968 100644 --- a/Libraries/ReactIOS/ReactIOSTextComponent.js +++ b/Libraries/ReactIOS/ReactIOSTextComponent.js @@ -7,7 +7,7 @@ 'use strict'; var ReactIOSTagHandles = require('ReactIOSTagHandles'); -var RCTUIManager = require('NativeModules').RCTUIManager; +var RCTUIManager = require('NativeModules').UIManager; var assign = require('Object.assign'); diff --git a/Libraries/Storage/AsyncStorage.ios.js b/Libraries/Storage/AsyncStorage.ios.js index 754e59cb1..b1a68c40b 100644 --- a/Libraries/Storage/AsyncStorage.ios.js +++ b/Libraries/Storage/AsyncStorage.ios.js @@ -7,8 +7,8 @@ 'use strict'; var NativeModules = require('NativeModules'); -var RCTAsyncLocalStorage = NativeModules.RCTAsyncLocalStorage; -var RCTAsyncRocksDBStorage = NativeModules.RCTAsyncRocksDBStorage; +var RCTAsyncLocalStorage = NativeModules.AsyncLocalStorage; +var RCTAsyncRocksDBStorage = NativeModules.AsyncRocksDBStorage; // We use RocksDB if available. var RCTAsyncStorage = RCTAsyncRocksDBStorage || RCTAsyncLocalStorage; diff --git a/Libraries/Utilities/AlertIOS.js b/Libraries/Utilities/AlertIOS.js index bbbdc8981..8a342004c 100644 --- a/Libraries/Utilities/AlertIOS.js +++ b/Libraries/Utilities/AlertIOS.js @@ -6,7 +6,7 @@ */ 'use strict'; -var { RCTAlertManager } = require('NativeModules'); +var RCTAlertManager = require('NativeModules').AlertManager; var DEFAULT_BUTTON_TEXT = 'OK'; var DEFAULT_BUTTON = { diff --git a/Libraries/Utilities/Dimensions.js b/Libraries/Utilities/Dimensions.js index d33515799..5cbf8cb87 100644 --- a/Libraries/Utilities/Dimensions.js +++ b/Libraries/Utilities/Dimensions.js @@ -9,7 +9,7 @@ var NativeModules = require('NativeModules'); var invariant = require('invariant'); -var dimensions = NativeModules.RCTUIManager.Dimensions; +var dimensions = NativeModules.UIManager.Dimensions; class Dimensions { /** diff --git a/Libraries/Utilities/PushNotificationIOS.js b/Libraries/Utilities/PushNotificationIOS.js index 86733bde3..cb40e6dec 100644 --- a/Libraries/Utilities/PushNotificationIOS.js +++ b/Libraries/Utilities/PushNotificationIOS.js @@ -8,7 +8,7 @@ var NativeModules = require('NativeModules'); var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); -var RCTPushNotificationManager = NativeModules.RCTPushNotificationManager; +var RCTPushNotificationManager = NativeModules.PushNotificationManager; if (RCTPushNotificationManager) { var _initialNotification = RCTPushNotificationManager.initialNotification; } diff --git a/Libraries/Utilities/nativeModulePrefixDuplicator.js b/Libraries/Utilities/nativeModulePrefixDuplicator.js deleted file mode 100644 index fb2951612..000000000 --- a/Libraries/Utilities/nativeModulePrefixDuplicator.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule nativeModulePrefixDuplicator - */ -'use strict'; - -// Dirty hack to support old (RK) and new (RCT) native module name conventions -function nativeModulePrefixDuplicator(modules) { - Object.keys(modules).forEach((moduleName) => { - var rkModuleName = moduleName.replace(/^RCT/, 'RK'); - var rctModuleName = moduleName.replace(/^RK/, 'RCT'); - if (rkModuleName !== rctModuleName) { - if (modules[rkModuleName] && modules[rctModuleName]) { - throw new Error( - 'Module cannot be registered as both RCT and RK: ' + moduleName - ); - } - modules[rkModuleName] = modules[moduleName]; - modules[rctModuleName] = modules[moduleName]; - } - }); -} - -module.exports = nativeModulePrefixDuplicator; diff --git a/Libraries/Utilities/nativeModulePrefixNormalizer.js b/Libraries/Utilities/nativeModulePrefixNormalizer.js new file mode 100644 index 000000000..1c4807553 --- /dev/null +++ b/Libraries/Utilities/nativeModulePrefixNormalizer.js @@ -0,0 +1,24 @@ +/** + * Copyright 2004-present Facebook. All Rights Reserved. + * + * @providesModule nativeModulePrefixNormalizer + */ +'use strict'; + +// Dirty hack to support old (RK) and new (RCT) native module name conventions +function nativeModulePrefixNormalizer(modules) { + Object.keys(modules).forEach((moduleName) => { + var strippedName = moduleName.replace(/^(RCT|RK)/, ''); + if (modules['RCT' + strippedName] && modules['RK' + strippedName]) { + throw new Error( + 'Module cannot be registered as both RCT and RK: ' + moduleName + ); + } + if (strippedName !== moduleName) { + modules[strippedName] = modules[moduleName]; + delete modules[moduleName]; + } + }); +} + +module.exports = nativeModulePrefixNormalizer; diff --git a/Libraries/Vibration/VibrationIOS.ios.js b/Libraries/Vibration/VibrationIOS.ios.js index 054d6c81e..11b09f989 100644 --- a/Libraries/Vibration/VibrationIOS.ios.js +++ b/Libraries/Vibration/VibrationIOS.ios.js @@ -5,7 +5,8 @@ */ 'use strict'; -var {RCTVibration} = require('NativeModules'); +var RCTVibration = require('NativeModules').Vibration; + var invariant = require('invariant'); /**