From ff00e1496c10ddf854672b49037c83c1351a00cb Mon Sep 17 00:00:00 2001 From: Krzysztof Magiera Date: Fri, 8 May 2015 09:45:43 -0700 Subject: [PATCH] [ReactNative] Rename ReactIOS JS module (and relatives) to ReactNative. --- Examples/UIExplorer/createExamplePage.js | 14 +++--- .../ART/{ReactIOSART.js => ReactNativeART.js} | 16 +++--- .../BatchedBridgedModules/RCTEventEmitter.js | 4 +- Libraries/Components/MapView/MapView.js | 8 +-- .../Components/Navigation/NavigatorIOS.ios.js | 12 ++--- Libraries/Components/ScrollView/ScrollView.js | 10 ++-- Libraries/Components/TextInput/TextInput.js | 14 +++--- .../Touchable/TouchableHighlight.js | 4 +- Libraries/Components/View/View.js | 14 +++--- .../Components/WebView/WebView.android.js | 8 +-- Libraries/Components/WebView/WebView.ios.js | 2 +- Libraries/Image/Image.ios.js | 4 +- Libraries/Picker/PickerIOS.ios.js | 10 ++-- Libraries/RKBackendNode/queryLayoutByID.js | 4 +- Libraries/ReactIOS/requireNativeComponent.js | 4 +- Libraries/ReactIOS/verifyPropTypes.js | 4 +- Libraries/{ReactIOS => ReactNative}/React.js | 2 +- .../ReactNative.js} | 24 ++++----- .../ReactNativeBaseComponentEnvironment.js} | 16 +++--- .../ReactNativeBaseComponentMixin.js} | 16 +++--- .../ReactNativeDOMIDOperations.js} | 16 +++--- .../ReactNativeDefaultInjection.js} | 32 ++++++------ .../ReactNativeEventEmitter.js} | 22 ++++---- .../ReactNativeGlobalInteractionHandler.js} | 6 +-- .../ReactNativeGlobalResponderHandler.js} | 10 ++-- .../ReactNativeMount.js} | 50 +++++++++---------- .../ReactNativeNativeComponent.js} | 46 ++++++++--------- .../ReactNativeReconcileTransaction.js} | 14 +++--- .../ReactNativeStyleAttributes.js} | 10 ++-- .../ReactNativeTagHandles.js} | 20 ++++---- .../ReactNativeTextComponent.js} | 14 +++--- .../ReactNativeViewAttributes.js} | 12 ++--- .../createReactNativeNativeComponentClass.js} | 16 +++--- Libraries/Text/Text.js | 10 ++-- .../browser/eventPlugins/PanResponder.js | 2 +- .../worker/UniversalWorkerNodeHandle.js | 4 +- React/Base/RCTRootView.m | 4 +- 37 files changed, 239 insertions(+), 239 deletions(-) rename Libraries/ART/{ReactIOSART.js => ReactNativeART.js} (96%) rename Libraries/{ReactIOS => ReactNative}/React.js (89%) rename Libraries/{ReactIOS/ReactIOS.js => ReactNative/ReactNative.js} (85%) rename Libraries/{ReactIOS/ReactIOSComponentEnvironment.js => ReactNative/ReactNativeBaseComponentEnvironment.js} (51%) rename Libraries/{ReactIOS/ReactIOSComponentMixin.js => ReactNative/ReactNativeBaseComponentMixin.js} (86%) rename Libraries/{ReactIOS/ReactIOSDOMIDOperations.js => ReactNative/ReactNativeDOMIDOperations.js} (87%) rename Libraries/{ReactIOS/ReactIOSDefaultInjection.js => ReactNative/ReactNativeDefaultInjection.js} (76%) rename Libraries/{ReactIOS/ReactIOSEventEmitter.js => ReactNative/ReactNativeEventEmitter.js} (90%) rename Libraries/{ReactIOS/ReactIOSGlobalInteractionHandler.js => ReactNative/ReactNativeGlobalInteractionHandler.js} (85%) rename Libraries/{ReactIOS/ReactIOSGlobalResponderHandler.js => ReactNative/ReactNativeGlobalResponderHandler.js} (66%) rename Libraries/{ReactIOS/ReactIOSMount.js => ReactNative/ReactNativeMount.js} (79%) rename Libraries/{ReactIOS/ReactIOSNativeComponent.js => ReactNative/ReactNativeNativeComponent.js} (86%) rename Libraries/{ReactIOS/ReactIOSReconcileTransaction.js => ReactNative/ReactNativeReconcileTransaction.js} (88%) rename Libraries/{ReactIOS/ReactIOSStyleAttributes.js => ReactNative/ReactNativeStyleAttributes.js} (74%) rename Libraries/{ReactIOS/ReactIOSTagHandles.js => ReactNative/ReactNativeTagHandles.js} (86%) rename Libraries/{ReactIOS/ReactIOSTextComponent.js => ReactNative/ReactNativeTextComponent.js} (80%) rename Libraries/{ReactIOS/ReactIOSViewAttributes.js => ReactNative/ReactNativeViewAttributes.js} (79%) rename Libraries/{ReactIOS/createReactIOSNativeComponentClass.js => ReactNative/createReactNativeNativeComponentClass.js} (66%) diff --git a/Examples/UIExplorer/createExamplePage.js b/Examples/UIExplorer/createExamplePage.js index 4bc933eba..c65ea7bf3 100644 --- a/Examples/UIExplorer/createExamplePage.js +++ b/Examples/UIExplorer/createExamplePage.js @@ -17,7 +17,7 @@ 'use strict'; var React = require('react-native'); -var ReactIOS = require('ReactIOS'); +var ReactNative = require('ReactNative'); var UIExplorerBlock = require('./UIExplorerBlock'); var UIExplorerPage = require('./UIExplorerPage'); @@ -49,15 +49,15 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule) // renderComponent to be called. var originalRender = React.render; var originalRenderComponent = React.renderComponent; - var originalIOSRender = ReactIOS.render; - var originalIOSRenderComponent = ReactIOS.renderComponent; + var originalIOSRender = ReactNative.render; + var originalIOSRenderComponent = ReactNative.renderComponent; var renderedComponent; // TODO remove typecasts when Flow bug #6560135 is fixed // and workaround is removed from react-native.js (React: Object).render = (React: Object).renderComponent = - (ReactIOS: Object).render = - (ReactIOS: Object).renderComponent = + (ReactNative: Object).render = + (ReactNative: Object).renderComponent = function(element, container) { renderedComponent = element; }; @@ -67,8 +67,8 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule) } (React: Object).render = originalRender; (React: Object).renderComponent = originalRenderComponent; - (ReactIOS: Object).render = originalIOSRender; - (ReactIOS: Object).renderComponent = originalIOSRenderComponent; + (ReactNative: Object).render = originalIOSRender; + (ReactNative: Object).renderComponent = originalIOSRenderComponent; return ( this.state.mostRecentEventCounter) { this.setState({mostRecentEventCounter: counter}); - } + } }, }); @@ -592,17 +592,17 @@ var styles = StyleSheet.create({ }, }); -var RCTTextView = createReactIOSNativeComponentClass({ +var RCTTextView = createReactNativeComponentClass({ validAttributes: RCTTextViewAttributes, uiViewClassName: 'RCTTextView', }); -var RCTTextField = createReactIOSNativeComponentClass({ +var RCTTextField = createReactNativeComponentClass({ validAttributes: RCTTextFieldAttributes, uiViewClassName: 'RCTTextField', }); -var AndroidTextInput = createReactIOSNativeComponentClass({ +var AndroidTextInput = createReactNativeComponentClass({ validAttributes: AndroidTextInputAttributes, uiViewClassName: 'AndroidTextInput', }); diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index 080a6750c..b96d8d0d0 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -14,7 +14,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheet = require('StyleSheet'); var TimerMixin = require('react-timer-mixin'); var Touchable = require('Touchable'); @@ -120,7 +120,7 @@ var TouchableHighlight = React.createClass({ viewConfig: { uiViewClassName: 'RCTView', - validAttributes: ReactIOSViewAttributes.RCTView + validAttributes: ReactNativeViewAttributes.RCTView }, /** diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index aa69ab0eb..bd7529e58 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -15,12 +15,12 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var PropTypes = require('ReactPropTypes'); var RCTUIManager = require('NativeModules').UIManager; var React = require('React'); -var ReactIOSStyleAttributes = require('ReactIOSStyleAttributes'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes'); +var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheetPropType = require('StyleSheetPropType'); var ViewStylePropTypes = require('ViewStylePropTypes'); -var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass'); +var createReactNativeComponentClass = require('createReactNativeComponentClass'); var stylePropType = StyleSheetPropType(ViewStylePropTypes); @@ -53,7 +53,7 @@ var View = React.createClass({ */ viewConfig: { uiViewClassName: 'RCTView', - validAttributes: ReactIOSViewAttributes.RCTView + validAttributes: ReactNativeViewAttributes.RCTView }, propTypes: { @@ -163,8 +163,8 @@ var View = React.createClass({ }, }); -var RCTView = createReactIOSNativeComponentClass({ - validAttributes: ReactIOSViewAttributes.RCTView, +var RCTView = createReactNativeComponentClass({ + validAttributes: ReactNativeViewAttributes.RCTView, uiViewClassName: 'RCTView', }); RCTView.propTypes = View.propTypes; @@ -172,7 +172,7 @@ if (__DEV__) { var viewConfig = RCTUIManager.viewConfigs && RCTUIManager.viewConfigs.RCTView || {}; for (var prop in viewConfig.nativeProps) { var viewAny: any = View; // Appease flow - if (!viewAny.propTypes[prop] && !ReactIOSStyleAttributes[prop]) { + if (!viewAny.propTypes[prop] && !ReactNativeStyleAttributes[prop]) { throw new Error( 'View is missing propType for native prop `' + prop + '`' ); diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index 79ded6506..10b65a31c 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -12,11 +12,11 @@ var EdgeInsetsPropType = require('EdgeInsetsPropType'); var React = require('React'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheet = require('StyleSheet'); var View = require('View'); -var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass'); +var createReactNativeComponentClass = require('createReactNativeComponentClass'); var keyMirror = require('keyMirror'); var merge = require('merge'); @@ -168,8 +168,8 @@ var WebView = React.createClass({ }, }); -var RCTWebView = createReactIOSNativeComponentClass({ - validAttributes: merge(ReactIOSViewAttributes.UIView, { +var RCTWebView = createReactNativeComponentClass({ + validAttributes: merge(ReactNativeViewAttributes.UIView, { url: true, javaScriptEnabledAndroid: true, }), diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index ed2c98fae..b4a5d8002 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -14,7 +14,7 @@ var ActivityIndicatorIOS = require('ActivityIndicatorIOS'); var EdgeInsetsPropType = require('EdgeInsetsPropType'); var React = require('React'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheet = require('StyleSheet'); var Text = require('Text'); var View = require('View'); diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 32965c213..f388468c4 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -18,7 +18,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var NativeModules = require('NativeModules'); var PropTypes = require('ReactPropTypes'); var React = require('React'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheet = require('StyleSheet'); var StyleSheetPropType = require('StyleSheetPropType'); @@ -113,7 +113,7 @@ var Image = React.createClass({ */ viewConfig: { uiViewClassName: 'UIView', - validAttributes: ReactIOSViewAttributes.UIView + validAttributes: ReactNativeViewAttributes.UIView }, render: function() { diff --git a/Libraries/Picker/PickerIOS.ios.js b/Libraries/Picker/PickerIOS.ios.js index 189b507c8..b2c3c3927 100644 --- a/Libraries/Picker/PickerIOS.ios.js +++ b/Libraries/Picker/PickerIOS.ios.js @@ -15,13 +15,13 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); var ReactChildren = require('ReactChildren'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var RCTPickerIOSConsts = require('NativeModules').UIManager.RCTPicker.Constants; var StyleSheet = require('StyleSheet'); var View = require('View'); -var createReactIOSNativeComponentClass = - require('createReactIOSNativeComponentClass'); +var createReactNativeComponentClass = + require('createReactNativeComponentClass'); var merge = require('merge'); var PICKER = 'picker'; @@ -112,12 +112,12 @@ var styles = StyleSheet.create({ }, }); -var rkPickerIOSAttributes = merge(ReactIOSViewAttributes.UIView, { +var rkPickerIOSAttributes = merge(ReactNativeViewAttributes.UIView, { items: true, selectedIndex: true, }); -var RCTPickerIOS = createReactIOSNativeComponentClass({ +var RCTPickerIOS = createReactNativeComponentClass({ validAttributes: rkPickerIOSAttributes, uiViewClassName: 'RCTPicker', }); diff --git a/Libraries/RKBackendNode/queryLayoutByID.js b/Libraries/RKBackendNode/queryLayoutByID.js index dcb74e474..d9b1ed8cc 100644 --- a/Libraries/RKBackendNode/queryLayoutByID.js +++ b/Libraries/RKBackendNode/queryLayoutByID.js @@ -11,7 +11,7 @@ */ 'use strict'; -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var RCTUIManager = require('NativeModules').UIManager; type OnSuccessCallback = ( @@ -52,7 +52,7 @@ var queryLayoutByID = function( ): void { // Native bridge doesn't *yet* surface errors. RCTUIManager.measure( - ReactIOSTagHandles.rootNodeIDToTag[rootNodeID], + ReactNativeTagHandles.rootNodeIDToTag[rootNodeID], onSuccess ); }; diff --git a/Libraries/ReactIOS/requireNativeComponent.js b/Libraries/ReactIOS/requireNativeComponent.js index 4d9241853..c1c3b1376 100644 --- a/Libraries/ReactIOS/requireNativeComponent.js +++ b/Libraries/ReactIOS/requireNativeComponent.js @@ -14,7 +14,7 @@ var RCTUIManager = require('NativeModules').UIManager; var UnimplementedView = require('UnimplementedView'); -var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass'); +var createReactNativeComponentClass = require('createReactNativeComponentClass'); var deepDiffer = require('deepDiffer'); var insetsDiffer = require('insetsDiffer'); var pointsDiffer = require('pointsDiffer'); @@ -59,7 +59,7 @@ function requireNativeComponent( if (__DEV__) { wrapperComponent && verifyPropTypes(wrapperComponent, viewConfig); } - return createReactIOSNativeComponentClass(viewConfig); + return createReactNativeComponentClass(viewConfig); } var TypeToDifferMap = { diff --git a/Libraries/ReactIOS/verifyPropTypes.js b/Libraries/ReactIOS/verifyPropTypes.js index ab1d61728..6ee23cda8 100644 --- a/Libraries/ReactIOS/verifyPropTypes.js +++ b/Libraries/ReactIOS/verifyPropTypes.js @@ -11,7 +11,7 @@ */ 'use strict'; -var ReactIOSStyleAttributes = require('ReactIOSStyleAttributes'); +var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes'); var View = require('View'); function verifyPropTypes( @@ -26,7 +26,7 @@ function verifyPropTypes( for (var prop in nativeProps) { if (!component.propTypes[prop] && !View.propTypes[prop] && - !ReactIOSStyleAttributes[prop] && + !ReactNativeStyleAttributes[prop] && (!nativePropsToIgnore || !nativePropsToIgnore[prop])) { throw new Error( '`' + component.displayName + '` has no propType for native prop `' + diff --git a/Libraries/ReactIOS/React.js b/Libraries/ReactNative/React.js similarity index 89% rename from Libraries/ReactIOS/React.js rename to Libraries/ReactNative/React.js index ce9de0852..1eeeb32c3 100644 --- a/Libraries/ReactIOS/React.js +++ b/Libraries/ReactNative/React.js @@ -12,4 +12,4 @@ "use strict"; -module.exports = require('ReactIOS'); +module.exports = require('ReactNative'); diff --git a/Libraries/ReactIOS/ReactIOS.js b/Libraries/ReactNative/ReactNative.js similarity index 85% rename from Libraries/ReactIOS/ReactIOS.js rename to Libraries/ReactNative/ReactNative.js index 56faaa30b..9ec36fdfa 100644 --- a/Libraries/ReactIOS/ReactIOS.js +++ b/Libraries/ReactNative/ReactNative.js @@ -6,7 +6,7 @@ * 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 ReactIOS + * @providesModule ReactNative * @flow */ "use strict"; @@ -19,15 +19,15 @@ var ReactCurrentOwner = require('ReactCurrentOwner'); var ReactElement = require('ReactElement'); var ReactElementValidator = require('ReactElementValidator'); var ReactInstanceHandles = require('ReactInstanceHandles'); -var ReactIOSDefaultInjection = require('ReactIOSDefaultInjection'); -var ReactIOSMount = require('ReactIOSMount'); +var ReactNativeDefaultInjection = require('ReactNativeDefaultInjection'); +var ReactNativeMount = require('ReactNativeMount'); var ReactPropTypes = require('ReactPropTypes'); var deprecated = require('deprecated'); var invariant = require('invariant'); var onlyChild = require('onlyChild'); -ReactIOSDefaultInjection.inject(); +ReactNativeDefaultInjection.inject(); var createElement = ReactElement.createElement; var createFactory = ReactElement.createFactory; @@ -72,11 +72,11 @@ var render = function( mountInto: number, callback?: ?(() => void) ): ?ReactComponent { - return ReactIOSMount.renderComponent(element, mountInto, callback); + return ReactNativeMount.renderComponent(element, mountInto, callback); }; -var ReactIOS = { - hasReactIOSInitialized: false, +var ReactNative = { + hasReactNativeInitialized: false, Children: { map: ReactChildren.map, forEach: ReactChildren.forEach, @@ -91,12 +91,12 @@ var ReactIOS = { cloneElement: cloneElement, _augmentElement: augmentElement, render: render, - unmountComponentAtNode: ReactIOSMount.unmountComponentAtNode, + unmountComponentAtNode: ReactNativeMount.unmountComponentAtNode, // Hook for JSX spread, don't use this for anything else. __spread: Object.assign, - unmountComponentAtNodeAndRemoveContainer: ReactIOSMount.unmountComponentAtNodeAndRemoveContainer, + unmountComponentAtNodeAndRemoveContainer: ReactNativeMount.unmountComponentAtNodeAndRemoveContainer, isValidClass: ReactElement.isValidFactory, isValidElement: ReactElement.isValidElement, @@ -126,10 +126,10 @@ if ( __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ CurrentOwner: ReactCurrentOwner, InstanceHandles: ReactInstanceHandles, - Mount: ReactIOSMount, + Mount: ReactNativeMount, Reconciler: require('ReactReconciler'), - TextComponent: require('ReactIOSTextComponent'), + TextComponent: require('ReactNativeTextComponent'), }); } -module.exports = ReactIOS; +module.exports = ReactNative; diff --git a/Libraries/ReactIOS/ReactIOSComponentEnvironment.js b/Libraries/ReactNative/ReactNativeBaseComponentEnvironment.js similarity index 51% rename from Libraries/ReactIOS/ReactIOSComponentEnvironment.js rename to Libraries/ReactNative/ReactNativeBaseComponentEnvironment.js index 0dc0b1d1c..6e038620d 100644 --- a/Libraries/ReactIOS/ReactIOSComponentEnvironment.js +++ b/Libraries/ReactNative/ReactNativeBaseComponentEnvironment.js @@ -6,19 +6,19 @@ * 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 ReactIOSComponentEnvironment + * @providesModule ReactNativeComponentEnvironment * @flow */ 'use strict'; -var ReactIOSDOMIDOperations = require('ReactIOSDOMIDOperations'); -var ReactIOSReconcileTransaction = require('ReactIOSReconcileTransaction'); +var ReactNativeDOMIDOperations = require('ReactNativeDOMIDOperations'); +var ReactNativeReconcileTransaction = require('ReactNativeReconcileTransaction'); -var ReactIOSComponentEnvironment = { +var ReactNativeComponentEnvironment = { - processChildrenUpdates: ReactIOSDOMIDOperations.dangerouslyProcessChildrenUpdates, + processChildrenUpdates: ReactNativeDOMIDOperations.dangerouslyProcessChildrenUpdates, - replaceNodeWithMarkupByID: ReactIOSDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID, + replaceNodeWithMarkupByID: ReactNativeDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID, /** * Nothing to do for UIKit bridge. @@ -36,7 +36,7 @@ var ReactIOSComponentEnvironment = { }, - ReactReconcileTransaction: ReactIOSReconcileTransaction, + ReactReconcileTransaction: ReactNativeReconcileTransaction, }; -module.exports = ReactIOSComponentEnvironment; +module.exports = ReactNativeComponentEnvironment; diff --git a/Libraries/ReactIOS/ReactIOSComponentMixin.js b/Libraries/ReactNative/ReactNativeBaseComponentMixin.js similarity index 86% rename from Libraries/ReactIOS/ReactIOSComponentMixin.js rename to Libraries/ReactNative/ReactNativeBaseComponentMixin.js index 03d7f5ad0..5e17db9fa 100644 --- a/Libraries/ReactIOS/ReactIOSComponentMixin.js +++ b/Libraries/ReactNative/ReactNativeBaseComponentMixin.js @@ -6,12 +6,12 @@ * 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 ReactIOSComponentMixin + * @providesModule ReactNativeComponentMixin * @flow */ 'use strict'; -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var ReactInstanceMap = require('ReactInstanceMap'); /** @@ -23,7 +23,7 @@ var ReactInstanceMap = require('ReactInstanceMap'); * making assumptions about the nature of those resources, and this allows that * infra to be shared across multiple platforms, where the resources are very * different. General infra (such as `ReactMultiChild`) reasons opaquely about - * the data, but platform specific code (such as `ReactIOSNativeComponent`) can + * the data, but platform specific code (such as `ReactNativeBaseComponent`) can * make assumptions about the data. * * @@ -54,9 +54,9 @@ var ReactInstanceMap = require('ReactInstanceMap'); * mountImage innerHTML innerHTML {rootNodeID, tag} * */ -var ReactIOSComponentMixin = { +var ReactNativeComponentMixin = { /** - * This has no particular meaning in ReactIOS. If this were in the DOM, this + * This has no particular meaning in ReactNative. If this were in the DOM, this * would return the DOM node. There should be nothing that invokes this * method. Any current callers of this are mistaken - they should be invoking * `getNodeHandle`. @@ -64,16 +64,16 @@ var ReactIOSComponentMixin = { getNativeNode: function() { // TODO (balpert): Wrap iOS native components in a composite wrapper, then // ReactInstanceMap.get here will always succeed - return ReactIOSTagHandles.rootNodeIDToTag[ + return ReactNativeTagHandles.rootNodeIDToTag[ (ReactInstanceMap.get(this) || this)._rootNodeID ]; }, getNodeHandle: function() { - return ReactIOSTagHandles.rootNodeIDToTag[ + return ReactNativeTagHandles.rootNodeIDToTag[ (ReactInstanceMap.get(this) || this)._rootNodeID ]; } }; -module.exports = ReactIOSComponentMixin; +module.exports = ReactNativeComponentMixin; diff --git a/Libraries/ReactIOS/ReactIOSDOMIDOperations.js b/Libraries/ReactNative/ReactNativeDOMIDOperations.js similarity index 87% rename from Libraries/ReactIOS/ReactIOSDOMIDOperations.js rename to Libraries/ReactNative/ReactNativeDOMIDOperations.js index 7d421442f..3b47d4d8f 100644 --- a/Libraries/ReactIOS/ReactIOSDOMIDOperations.js +++ b/Libraries/ReactNative/ReactNativeDOMIDOperations.js @@ -6,13 +6,13 @@ * 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 ReactIOSDOMIDOperations + * @providesModule ReactNativeDOMIDOperations * @flow */ "use strict"; -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes'); var RCTUIManager = require('NativeModules').UIManager; var ReactPerf = require('ReactPerf'); @@ -38,7 +38,7 @@ var dangerouslyProcessChildrenUpdates = function(childrenUpdates, markupList) { // containerID. for (var i = 0; i < childrenUpdates.length; i++) { var update = childrenUpdates[i]; - var containerTag = ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(update.parentID); + var containerTag = ReactNativeTagHandles.mostRecentMountedNodeHandleForRootNodeID(update.parentID); var updates = byContainerTag[containerTag] || (byContainerTag[containerTag] = {}); if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING) { (updates.moveFromIndices || (updates.moveFromIndices = [])).push(update.fromIndex); @@ -49,7 +49,7 @@ var dangerouslyProcessChildrenUpdates = function(childrenUpdates, markupList) { var mountImage = markupList[update.markupIndex]; var tag = mountImage.tag; var rootNodeID = mountImage.rootNodeID; - ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle(rootNodeID, tag); + ReactNativeTagHandles.associateRootNodeIDWithMountedNodeHandle(rootNodeID, tag); (updates.addAtIndices || (updates.addAtIndices = [])).push(update.toIndex); (updates.addChildTags || (updates.addChildTags = [])).push(tag); } @@ -75,7 +75,7 @@ var dangerouslyProcessChildrenUpdates = function(childrenUpdates, markupList) { * Operations used to process updates to DOM nodes. This is made injectable via * `ReactComponent.DOMIDOperations`. */ -var ReactIOSDOMIDOperations = { +var ReactNativeDOMIDOperations = { dangerouslyProcessChildrenUpdates: ReactPerf.measure( // FIXME(frantic): #4441289 Hack to avoid modifying react-tools 'ReactDOMIDOperations', @@ -93,11 +93,11 @@ var ReactIOSDOMIDOperations = { 'ReactDOMIDOperations', 'dangerouslyReplaceNodeWithMarkupByID', function(id, mountImage) { - var oldTag = ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(id); + var oldTag = ReactNativeTagHandles.mostRecentMountedNodeHandleForRootNodeID(id); RCTUIManager.replaceExistingNonRootView(oldTag, mountImage.tag); - ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle(id, mountImage.tag); + ReactNativeTagHandles.associateRootNodeIDWithMountedNodeHandle(id, mountImage.tag); } ), }; -module.exports = ReactIOSDOMIDOperations; +module.exports = ReactNativeDOMIDOperations; diff --git a/Libraries/ReactIOS/ReactIOSDefaultInjection.js b/Libraries/ReactNative/ReactNativeDefaultInjection.js similarity index 76% rename from Libraries/ReactIOS/ReactIOSDefaultInjection.js rename to Libraries/ReactNative/ReactNativeDefaultInjection.js index 7b3df0d85..93c261280 100644 --- a/Libraries/ReactIOS/ReactIOSDefaultInjection.js +++ b/Libraries/ReactNative/ReactNativeDefaultInjection.js @@ -6,7 +6,7 @@ * 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 ReactIOSDefaultInjection + * @providesModule ReactNativeDefaultInjection * @flow */ @@ -26,18 +26,18 @@ var ReactComponentEnvironment = require('ReactComponentEnvironment'); var ReactDefaultBatchingStrategy = require('ReactDefaultBatchingStrategy'); var ReactEmptyComponent = require('ReactEmptyComponent'); var ReactInstanceHandles = require('ReactInstanceHandles'); -var ReactIOSComponentEnvironment = require('ReactIOSComponentEnvironment'); -var ReactIOSComponentMixin = require('ReactIOSComponentMixin'); -var ReactIOSGlobalInteractionHandler = require('ReactIOSGlobalInteractionHandler'); -var ReactIOSGlobalResponderHandler = require('ReactIOSGlobalResponderHandler'); -var ReactIOSMount = require('ReactIOSMount'); -var ReactIOSTextComponent = require('ReactIOSTextComponent'); +var ReactNativeComponentEnvironment = require('ReactNativeComponentEnvironment'); +var ReactNativeComponentMixin = require('ReactNativeComponentMixin'); +var ReactNativeGlobalInteractionHandler = require('ReactNativeGlobalInteractionHandler'); +var ReactNativeGlobalResponderHandler = require('ReactNativeGlobalResponderHandler'); +var ReactNativeMount = require('ReactNativeMount'); +var ReactNativeTextComponent = require('ReactNativeTextComponent'); var ReactNativeComponent = require('ReactNativeComponent'); var ReactUpdates = require('ReactUpdates'); var ResponderEventPlugin = require('ResponderEventPlugin'); var UniversalWorkerNodeHandle = require('UniversalWorkerNodeHandle'); -var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass'); +var createReactNativeComponentClass = require('createReactNativeComponentClass'); var invariant = require('invariant'); // Just to ensure this gets packaged, since its only caller is from Native. @@ -53,11 +53,11 @@ function inject() { EventPluginHub.injection.injectInstanceHandle(ReactInstanceHandles); ResponderEventPlugin.injection.injectGlobalResponderHandler( - ReactIOSGlobalResponderHandler + ReactNativeGlobalResponderHandler ); ResponderEventPlugin.injection.injectGlobalInteractionHandler( - ReactIOSGlobalInteractionHandler + ReactNativeGlobalInteractionHandler ); /** @@ -70,7 +70,7 @@ function inject() { }); ReactUpdates.injection.injectReconcileTransaction( - ReactIOSComponentEnvironment.ReactReconcileTransaction + ReactNativeComponentEnvironment.ReactReconcileTransaction ); ReactUpdates.injection.injectBatchingStrategy( @@ -78,22 +78,22 @@ function inject() { ); ReactComponentEnvironment.injection.injectEnvironment( - ReactIOSComponentEnvironment + ReactNativeComponentEnvironment ); // Can't import View here because it depends on React to make its composite - var RCTView = createReactIOSNativeComponentClass({ + var RCTView = createReactNativeComponentClass({ validAttributes: {}, uiViewClassName: 'RCTView', }); ReactEmptyComponent.injection.injectEmptyComponent(RCTView); - EventPluginUtils.injection.injectMount(ReactIOSMount); + EventPluginUtils.injection.injectMount(ReactNativeMount); - ReactClass.injection.injectMixin(ReactIOSComponentMixin); + ReactClass.injection.injectMixin(ReactNativeComponentMixin); ReactNativeComponent.injection.injectTextComponentClass( - ReactIOSTextComponent + ReactNativeTextComponent ); ReactNativeComponent.injection.injectAutoWrapper(function(tag) { // Show a nicer error message for non-function tags diff --git a/Libraries/ReactIOS/ReactIOSEventEmitter.js b/Libraries/ReactNative/ReactNativeEventEmitter.js similarity index 90% rename from Libraries/ReactIOS/ReactIOSEventEmitter.js rename to Libraries/ReactNative/ReactNativeEventEmitter.js index 017a0fb0a..9bd344e79 100644 --- a/Libraries/ReactIOS/ReactIOSEventEmitter.js +++ b/Libraries/ReactNative/ReactNativeEventEmitter.js @@ -6,7 +6,7 @@ * 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 ReactIOSEventEmitter + * @providesModule ReactNativeEventEmitter * @flow */ @@ -14,7 +14,7 @@ var EventPluginHub = require('EventPluginHub'); var ReactEventEmitterMixin = require('ReactEventEmitterMixin'); -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var NodeHandle = require('NodeHandle'); var EventConstants = require('EventConstants'); @@ -82,15 +82,15 @@ var removeTouchesAtIndices = function( }; /** - * `ReactIOSEventEmitter` is used to attach top-level event listeners. For example: + * `ReactNativeEventEmitter` is used to attach top-level event listeners. For example: * - * ReactIOSEventEmitter.putListener('myID', 'onClick', myFunction); + * ReactNativeEventEmitter.putListener('myID', 'onClick', myFunction); * * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. * * @internal */ -var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, { +var ReactNativeEventEmitter = merge(ReactEventEmitterMixin, { registrationNames: EventPluginHub.registrationNameModules, @@ -118,7 +118,7 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, { nativeEventParam: Object ) { var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT; - ReactIOSEventEmitter.handleTopLevel( + ReactNativeEventEmitter.handleTopLevel( topLevelType, rootNodeID, rootNodeID, @@ -138,8 +138,8 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, { topLevelType: string, nativeEventParam: Object ) { - var rootNodeID = ReactIOSTagHandles.tagToRootNodeID[tag]; - ReactIOSEventEmitter._receiveRootNodeIDEvent( + var rootNodeID = ReactNativeTagHandles.tagToRootNodeID[tag]; + ReactNativeEventEmitter._receiveRootNodeIDEvent( rootNodeID, topLevelType, nativeEventParam @@ -191,7 +191,7 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, { var rootNodeID = null; var target = nativeEvent.target; if (target !== null && target !== undefined) { - if (target < ReactIOSTagHandles.tagsStartAt) { + if (target < ReactNativeTagHandles.tagsStartAt) { if (__DEV__) { warning( false, @@ -202,7 +202,7 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, { rootNodeID = NodeHandle.getRootNodeID(target); } } - ReactIOSEventEmitter._receiveRootNodeIDEvent( + ReactNativeEventEmitter._receiveRootNodeIDEvent( rootNodeID, eventTopLevelType, nativeEvent @@ -211,4 +211,4 @@ var ReactIOSEventEmitter = merge(ReactEventEmitterMixin, { } }); -module.exports = ReactIOSEventEmitter; +module.exports = ReactNativeEventEmitter; diff --git a/Libraries/ReactIOS/ReactIOSGlobalInteractionHandler.js b/Libraries/ReactNative/ReactNativeGlobalInteractionHandler.js similarity index 85% rename from Libraries/ReactIOS/ReactIOSGlobalInteractionHandler.js rename to Libraries/ReactNative/ReactNativeGlobalInteractionHandler.js index 568acab8a..d5c9b9544 100644 --- a/Libraries/ReactIOS/ReactIOSGlobalInteractionHandler.js +++ b/Libraries/ReactNative/ReactNativeGlobalInteractionHandler.js @@ -6,7 +6,7 @@ * 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 ReactIOSGlobalInteractionHandler + * @providesModule ReactNativeGlobalInteractionHandler * @flow */ 'use strict'; @@ -17,7 +17,7 @@ var InteractionManager = require('InteractionManager'); // released/terminated. var interactionHandle = null; -var ReactIOSGlobalInteractionHandler = { +var ReactNativeGlobalInteractionHandler = { onChange: function(numberActiveTouches: number) { if (numberActiveTouches === 0) { if (interactionHandle) { @@ -30,4 +30,4 @@ var ReactIOSGlobalInteractionHandler = { } }; -module.exports = ReactIOSGlobalInteractionHandler; +module.exports = ReactNativeGlobalInteractionHandler; diff --git a/Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js b/Libraries/ReactNative/ReactNativeGlobalResponderHandler.js similarity index 66% rename from Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js rename to Libraries/ReactNative/ReactNativeGlobalResponderHandler.js index e5c16d05a..3ba933e8c 100644 --- a/Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js +++ b/Libraries/ReactNative/ReactNativeGlobalResponderHandler.js @@ -6,19 +6,19 @@ * 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 ReactIOSGlobalResponderHandler + * @providesModule ReactNativeGlobalResponderHandler * @flow */ 'use strict'; var RCTUIManager = require('NativeModules').UIManager; -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); -var ReactIOSGlobalResponderHandler = { +var ReactNativeGlobalResponderHandler = { onChange: function(from: string, to: string) { if (to !== null) { RCTUIManager.setJSResponder( - ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(to) + ReactNativeTagHandles.mostRecentMountedNodeHandleForRootNodeID(to) ); } else { RCTUIManager.clearJSResponder(); @@ -26,4 +26,4 @@ var ReactIOSGlobalResponderHandler = { } }; -module.exports = ReactIOSGlobalResponderHandler; +module.exports = ReactNativeGlobalResponderHandler; diff --git a/Libraries/ReactIOS/ReactIOSMount.js b/Libraries/ReactNative/ReactNativeMount.js similarity index 79% rename from Libraries/ReactIOS/ReactIOSMount.js rename to Libraries/ReactNative/ReactNativeMount.js index 9b1428fdd..004a3fbda 100644 --- a/Libraries/ReactIOS/ReactIOSMount.js +++ b/Libraries/ReactNative/ReactNativeMount.js @@ -6,14 +6,14 @@ * 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 ReactIOSMount + * @providesModule ReactNativeMount * @flow */ 'use strict'; var RCTUIManager = require('NativeModules').UIManager; -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var ReactPerf = require('ReactPerf'); var ReactReconciler = require('ReactReconciler'); var ReactUpdateQueue = require('ReactUpdateQueue'); @@ -45,7 +45,7 @@ function mountComponentIntoNode( componentInstance, rootID, transaction, emptyObject ); componentInstance._isTopLevel = true; - ReactIOSMount._mountImageIntoNode(markup, container); + ReactNativeMount._mountImageIntoNode(markup, container); } /** @@ -75,7 +75,7 @@ function batchedMountComponentIntoNode( * As soon as `ReactMount` is refactored to not rely on the DOM, we can share * code between the two. For now, we'll hard code the ID logic. */ -var ReactIOSMount = { +var ReactNativeMount = { instanceCount: 0, _instancesByContainerID: {}, @@ -89,9 +89,9 @@ var ReactIOSMount = { containerTag: number, callback?: ?(() => void) ): ?ReactComponent { - var topRootNodeID = ReactIOSTagHandles.tagToRootNodeID[containerTag]; + var topRootNodeID = ReactNativeTagHandles.tagToRootNodeID[containerTag]; if (topRootNodeID) { - var prevComponent = ReactIOSMount._instancesByContainerID[topRootNodeID]; + var prevComponent = ReactNativeMount._instancesByContainerID[topRootNodeID]; if (prevComponent) { var prevElement = prevComponent._currentElement; if (shouldUpdateReactComponent(prevElement, nextElement)) { @@ -101,28 +101,28 @@ var ReactIOSMount = { } return prevComponent; } else { - ReactIOSMount.unmountComponentAtNode(containerTag); + ReactNativeMount.unmountComponentAtNode(containerTag); } } } - if (!ReactIOSTagHandles.reactTagIsNativeTopRootID(containerTag)) { + if (!ReactNativeTagHandles.reactTagIsNativeTopRootID(containerTag)) { console.error('You cannot render into anything but a top root'); return; } - var topRootNodeID = ReactIOSTagHandles.allocateRootNodeIDForTag(containerTag); - ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle( + var topRootNodeID = ReactNativeTagHandles.allocateRootNodeIDForTag(containerTag); + ReactNativeTagHandles.associateRootNodeIDWithMountedNodeHandle( topRootNodeID, containerTag ); var instance = instantiateReactComponent(nextElement); - ReactIOSMount._instancesByContainerID[topRootNodeID] = instance; + ReactNativeMount._instancesByContainerID[topRootNodeID] = instance; var childRootNodeID = instanceNumberToChildRootID( topRootNodeID, - ReactIOSMount.instanceCount++ + ReactNativeMount.instanceCount++ ); // The initial render is synchronous but any updates that happen during @@ -153,14 +153,14 @@ var ReactIOSMount = { function(mountImage, containerID) { // Since we now know that the `mountImage` has been mounted, we can // mark it as such. - ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle( + ReactNativeTagHandles.associateRootNodeIDWithMountedNodeHandle( mountImage.rootNodeID, mountImage.tag ); var addChildTags = [mountImage.tag]; var addAtIndices = [0]; RCTUIManager.manageChildren( - ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID), + ReactNativeTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID), null, // moveFromIndices null, // moveToIndices addChildTags, @@ -181,7 +181,7 @@ var ReactIOSMount = { unmountComponentAtNodeAndRemoveContainer: function( containerTag: number ) { - ReactIOSMount.unmountComponentAtNode(containerTag); + ReactNativeMount.unmountComponentAtNode(containerTag); // call back into native to remove all of the subviews from this container RCTUIManager.removeRootView(containerTag); }, @@ -192,18 +192,18 @@ var ReactIOSMount = { * component at this time. */ unmountComponentAtNode: function(containerTag: number): boolean { - if (!ReactIOSTagHandles.reactTagIsNativeTopRootID(containerTag)) { + if (!ReactNativeTagHandles.reactTagIsNativeTopRootID(containerTag)) { console.error('You cannot render into anything but a top root'); return false; } - var containerID = ReactIOSTagHandles.tagToRootNodeID[containerTag]; - var instance = ReactIOSMount._instancesByContainerID[containerID]; + var containerID = ReactNativeTagHandles.tagToRootNodeID[containerTag]; + var instance = ReactNativeMount._instancesByContainerID[containerID]; if (!instance) { return false; } - ReactIOSMount.unmountComponentFromNode(instance, containerID); - delete ReactIOSMount._instancesByContainerID[containerID]; + ReactNativeMount.unmountComponentFromNode(instance, containerID); + delete ReactNativeMount._instancesByContainerID[containerID]; return true; }, @@ -214,7 +214,7 @@ var ReactIOSMount = { * @param {string} containerID ID of container we're removing from. * @final * @internal - * @see {ReactIOSMount.unmountComponentAtNode} + * @see {ReactNativeMount.unmountComponentAtNode} */ unmountComponentFromNode: function( instance: ReactComponent, @@ -223,7 +223,7 @@ var ReactIOSMount = { // Call back into native to remove all of the subviews from this container ReactReconciler.unmountComponent(instance); var containerTag = - ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID); + ReactNativeTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID); RCTUIManager.removeSubviewsFromContainerWithID(containerTag); }, @@ -232,10 +232,10 @@ var ReactIOSMount = { } }; -ReactIOSMount.renderComponent = ReactPerf.measure( +ReactNativeMount.renderComponent = ReactPerf.measure( 'ReactMount', '_renderNewRootComponent', - ReactIOSMount.renderComponent + ReactNativeMount.renderComponent ); -module.exports = ReactIOSMount; +module.exports = ReactNativeMount; diff --git a/Libraries/ReactIOS/ReactIOSNativeComponent.js b/Libraries/ReactNative/ReactNativeNativeComponent.js similarity index 86% rename from Libraries/ReactIOS/ReactIOSNativeComponent.js rename to Libraries/ReactNative/ReactNativeNativeComponent.js index 7f27ae0ea..1db02652e 100644 --- a/Libraries/ReactIOS/ReactIOSNativeComponent.js +++ b/Libraries/ReactNative/ReactNativeNativeComponent.js @@ -6,16 +6,16 @@ * 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 ReactIOSNativeComponent + * @providesModule ReactNativeBaseComponent * @flow */ 'use strict'; var NativeMethodsMixin = require('NativeMethodsMixin'); -var ReactIOSComponentMixin = require('ReactIOSComponentMixin'); -var ReactIOSEventEmitter = require('ReactIOSEventEmitter'); -var ReactIOSStyleAttributes = require('ReactIOSStyleAttributes'); -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeComponentMixin = require('ReactNativeComponentMixin'); +var ReactNativeEventEmitter = require('ReactNativeEventEmitter'); +var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var ReactMultiChild = require('ReactMultiChild'); var RCTUIManager = require('NativeModules').UIManager; @@ -26,23 +26,23 @@ var flattenStyle = require('flattenStyle'); var precomputeStyle = require('precomputeStyle'); var warning = require('warning'); -var registrationNames = ReactIOSEventEmitter.registrationNames; -var putListener = ReactIOSEventEmitter.putListener; -var deleteAllListeners = ReactIOSEventEmitter.deleteAllListeners; +var registrationNames = ReactNativeEventEmitter.registrationNames; +var putListener = ReactNativeEventEmitter.putListener; +var deleteAllListeners = ReactNativeEventEmitter.deleteAllListeners; -type ReactIOSNativeComponentViewConfig = { +type ReactNativeBaseComponentViewConfig = { validAttributes: Object; uiViewClassName: string; } /** - * @constructor ReactIOSNativeComponent + * @constructor ReactNativeBaseComponent * @extends ReactComponent * @extends ReactMultiChild * @param {!object} UIKit View Configuration. */ -var ReactIOSNativeComponent = function( - viewConfig: ReactIOSNativeComponentViewConfig +var ReactNativeBaseComponent = function( + viewConfig: ReactNativeBaseComponentViewConfig ) { this.viewConfig = viewConfig; }; @@ -75,7 +75,7 @@ cachedIndexArray._cache = {}; * Mixin for containers that contain UIViews. NOTE: markup is rendered markup * which is a `viewID` ... see the return value for `mountComponent` ! */ -ReactIOSNativeComponent.Mixin = { +ReactNativeBaseComponent.Mixin = { getPublicInstance: function() { // TODO: This should probably use a composite wrapper return this; @@ -97,7 +97,7 @@ ReactIOSNativeComponent.Mixin = { * recording the fact that its own `rootNodeID` is associated with a * `nodeHandle`. Only the code that actually adds its `nodeHandle` (`tag`) as * a child of a container can confidently record that in - * `ReactIOSTagHandles`. + * `ReactNativeTagHandles`. */ initializeChildren: function(children, containerTag, transaction, context) { var mountImages = this.mountChildren(children, transaction, context); @@ -117,7 +117,7 @@ ReactIOSNativeComponent.Mixin = { mountImage && mountImage.rootNodeID && mountImage.tag, 'Mount image returned does not have required data' ); - ReactIOSTagHandles.associateRootNodeIDWithMountedNodeHandle( + ReactNativeTagHandles.associateRootNodeIDWithMountedNodeHandle( childID, childTag ); @@ -166,7 +166,7 @@ ReactIOSNativeComponent.Mixin = { updatePayload, this.previousFlattenedStyle, nextFlattenedStyle, - ReactIOSStyleAttributes + ReactNativeStyleAttributes ); this.previousFlattenedStyle = nextFlattenedStyle; } @@ -195,7 +195,7 @@ ReactIOSNativeComponent.Mixin = { if (updatePayload) { RCTUIManager.updateView( - ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(this._rootNodeID), + ReactNativeTagHandles.mostRecentMountedNodeHandleForRootNodeID(this._rootNodeID), this.viewConfig.uiViewClassName, updatePayload ); @@ -243,7 +243,7 @@ ReactIOSNativeComponent.Mixin = { mountComponent: function(rootID, transaction, context) { this._rootNodeID = rootID; - var tag = ReactIOSTagHandles.allocateTag(); + var tag = ReactNativeTagHandles.allocateTag(); this.previousFlattenedStyle = {}; var updatePayload = this.computeUpdatedProperties( @@ -268,15 +268,15 @@ ReactIOSNativeComponent.Mixin = { }; /** - * Order of mixins is important. ReactIOSNativeComponent overrides methods in + * Order of mixins is important. ReactNativeBaseComponent overrides methods in * ReactMultiChild. */ Object.assign( - ReactIOSNativeComponent.prototype, + ReactNativeBaseComponent.prototype, ReactMultiChild.Mixin, - ReactIOSNativeComponent.Mixin, + ReactNativeBaseComponent.Mixin, NativeMethodsMixin, - ReactIOSComponentMixin + ReactNativeComponentMixin ); -module.exports = ReactIOSNativeComponent; +module.exports = ReactNativeBaseComponent; diff --git a/Libraries/ReactIOS/ReactIOSReconcileTransaction.js b/Libraries/ReactNative/ReactNativeReconcileTransaction.js similarity index 88% rename from Libraries/ReactIOS/ReactIOSReconcileTransaction.js rename to Libraries/ReactNative/ReactNativeReconcileTransaction.js index 229b1ba67..ac9ed657b 100644 --- a/Libraries/ReactIOS/ReactIOSReconcileTransaction.js +++ b/Libraries/ReactNative/ReactNativeReconcileTransaction.js @@ -6,7 +6,7 @@ * 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 ReactIOSReconcileTransaction + * @providesModule ReactNativeReconcileTransaction * @flow */ @@ -55,9 +55,9 @@ var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING]; * - Implement/integrate with customized constraint based layout system and keep * track of which dimensions must be remeasured. * - * @class ReactIOSReconcileTransaction + * @class ReactNativeReconcileTransaction */ -function ReactIOSReconcileTransaction() { +function ReactNativeReconcileTransaction() { this.reinitializeTransaction(); this.reactMountReady = CallbackQueue.getPooled(null); } @@ -93,12 +93,12 @@ var Mixin = { }; Object.assign( - ReactIOSReconcileTransaction.prototype, + ReactNativeReconcileTransaction.prototype, Transaction.Mixin, - ReactIOSReconcileTransaction, + ReactNativeReconcileTransaction, Mixin ); -PooledClass.addPoolingTo(ReactIOSReconcileTransaction); +PooledClass.addPoolingTo(ReactNativeReconcileTransaction); -module.exports = ReactIOSReconcileTransaction; +module.exports = ReactNativeReconcileTransaction; diff --git a/Libraries/ReactIOS/ReactIOSStyleAttributes.js b/Libraries/ReactNative/ReactNativeStyleAttributes.js similarity index 74% rename from Libraries/ReactIOS/ReactIOSStyleAttributes.js rename to Libraries/ReactNative/ReactNativeStyleAttributes.js index 5f83523e2..9adaf342a 100644 --- a/Libraries/ReactIOS/ReactIOSStyleAttributes.js +++ b/Libraries/ReactNative/ReactNativeStyleAttributes.js @@ -6,7 +6,7 @@ * 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 ReactIOSStyleAttributes + * @providesModule ReactNativeStyleAttributes * @flow */ @@ -20,13 +20,13 @@ var keyMirror = require('keyMirror'); var matricesDiffer = require('matricesDiffer'); var sizesDiffer = require('sizesDiffer'); -var ReactIOSStyleAttributes = { +var ReactNativeStyleAttributes = { ...keyMirror(ViewStylePropTypes), ...keyMirror(TextStylePropTypes), ...keyMirror(ImageStylePropTypes), }; -ReactIOSStyleAttributes.transformMatrix = { diff: matricesDiffer }; -ReactIOSStyleAttributes.shadowOffset = { diff: sizesDiffer }; +ReactNativeStyleAttributes.transformMatrix = { diff: matricesDiffer }; +ReactNativeStyleAttributes.shadowOffset = { diff: sizesDiffer }; -module.exports = ReactIOSStyleAttributes; +module.exports = ReactNativeStyleAttributes; diff --git a/Libraries/ReactIOS/ReactIOSTagHandles.js b/Libraries/ReactNative/ReactNativeTagHandles.js similarity index 86% rename from Libraries/ReactIOS/ReactIOSTagHandles.js rename to Libraries/ReactNative/ReactNativeTagHandles.js index 7ef7d8329..bf1dc59f2 100644 --- a/Libraries/ReactIOS/ReactIOSTagHandles.js +++ b/Libraries/ReactNative/ReactNativeTagHandles.js @@ -6,7 +6,7 @@ * 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 ReactIOSTagHandles + * @providesModule ReactNativeTagHandles * @flow */ 'use strict'; @@ -28,17 +28,17 @@ var warning = require('warning'); * unmount a component with a `rootNodeID`, then mount a new one in its place, */ var INITIAL_TAG_COUNT = 1; -var ReactIOSTagHandles = { +var ReactNativeTagHandles = { tagsStartAt: INITIAL_TAG_COUNT, tagCount: INITIAL_TAG_COUNT, allocateTag: function(): number { // Skip over root IDs as those are reserved for native - while (this.reactTagIsNativeTopRootID(ReactIOSTagHandles.tagCount)) { - ReactIOSTagHandles.tagCount++; + while (this.reactTagIsNativeTopRootID(ReactNativeTagHandles.tagCount)) { + ReactNativeTagHandles.tagCount++; } - var tag = ReactIOSTagHandles.tagCount; - ReactIOSTagHandles.tagCount++; + var tag = ReactNativeTagHandles.tagCount; + ReactNativeTagHandles.tagCount++; return tag; }, @@ -57,8 +57,8 @@ var ReactIOSTagHandles = { ) { warning(rootNodeID && tag, 'Root node or tag is null when associating'); if (rootNodeID && tag) { - ReactIOSTagHandles.tagToRootNodeID[tag] = rootNodeID; - ReactIOSTagHandles.rootNodeIDToTag[rootNodeID] = tag; + ReactNativeTagHandles.tagToRootNodeID[tag] = rootNodeID; + ReactNativeTagHandles.rootNodeIDToTag[rootNodeID] = tag; } }, @@ -90,7 +90,7 @@ var ReactIOSTagHandles = { mostRecentMountedNodeHandleForRootNodeID: function( rootNodeID: string ): number { - return ReactIOSTagHandles.rootNodeIDToTag[rootNodeID]; + return ReactNativeTagHandles.rootNodeIDToTag[rootNodeID]; }, tagToRootNodeID: ([] : Array), @@ -98,4 +98,4 @@ var ReactIOSTagHandles = { rootNodeIDToTag: ({} : {[key: string]: number}) }; -module.exports = ReactIOSTagHandles; +module.exports = ReactNativeTagHandles; diff --git a/Libraries/ReactIOS/ReactIOSTextComponent.js b/Libraries/ReactNative/ReactNativeTextComponent.js similarity index 80% rename from Libraries/ReactIOS/ReactIOSTextComponent.js rename to Libraries/ReactNative/ReactNativeTextComponent.js index 1d246310b..bdca141c0 100644 --- a/Libraries/ReactIOS/ReactIOSTextComponent.js +++ b/Libraries/ReactNative/ReactNativeTextComponent.js @@ -6,21 +6,21 @@ * 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 ReactIOSTextComponent + * @providesModule ReactNativeTextComponent */ 'use strict'; -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var RCTUIManager = require('NativeModules').UIManager; var assign = require('Object.assign'); -var ReactIOSTextComponent = function(props) { +var ReactNativeTextComponent = function(props) { // This constructor and its argument is currently used by mocks. }; -assign(ReactIOSTextComponent.prototype, { +assign(ReactNativeTextComponent.prototype, { construct: function(text) { // This is really a ReactText (ReactNode), not a ReactElement @@ -31,7 +31,7 @@ assign(ReactIOSTextComponent.prototype, { mountComponent: function(rootID, transaction, context) { this._rootNodeID = rootID; - var tag = ReactIOSTagHandles.allocateTag(); + var tag = ReactNativeTagHandles.allocateTag(); RCTUIManager.createView(tag, 'RCTRawText', {text: this._stringText}); return { rootNodeID: rootID, @@ -46,7 +46,7 @@ assign(ReactIOSTextComponent.prototype, { if (nextStringText !== this._stringText) { this._stringText = nextStringText; RCTUIManager.updateView( - ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID( + ReactNativeTagHandles.mostRecentMountedNodeHandleForRootNodeID( this._rootNodeID ), 'RCTRawText', @@ -64,4 +64,4 @@ assign(ReactIOSTextComponent.prototype, { }); -module.exports = ReactIOSTextComponent; +module.exports = ReactNativeTextComponent; diff --git a/Libraries/ReactIOS/ReactIOSViewAttributes.js b/Libraries/ReactNative/ReactNativeViewAttributes.js similarity index 79% rename from Libraries/ReactIOS/ReactIOSViewAttributes.js rename to Libraries/ReactNative/ReactNativeViewAttributes.js index 489741b05..d154d045f 100644 --- a/Libraries/ReactIOS/ReactIOSViewAttributes.js +++ b/Libraries/ReactNative/ReactNativeViewAttributes.js @@ -6,16 +6,16 @@ * 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 ReactIOSViewAttributes + * @providesModule ReactNativeViewAttributes * @flow */ 'use strict'; var merge = require('merge'); -var ReactIOSViewAttributes = {}; +var ReactNativeViewAttributes = {}; -ReactIOSViewAttributes.UIView = { +ReactNativeViewAttributes.UIView = { pointerEvents: true, accessible: true, accessibilityLabel: true, @@ -23,8 +23,8 @@ ReactIOSViewAttributes.UIView = { onLayout: true, }; -ReactIOSViewAttributes.RCTView = merge( - ReactIOSViewAttributes.UIView, { +ReactNativeViewAttributes.RCTView = merge( + ReactNativeViewAttributes.UIView, { // This is a special performance property exposed by RCTView and useful for // scrolling content when there are many subviews, most of which are offscreen. @@ -34,4 +34,4 @@ ReactIOSViewAttributes.RCTView = merge( removeClippedSubviews: true, }); -module.exports = ReactIOSViewAttributes; +module.exports = ReactNativeViewAttributes; diff --git a/Libraries/ReactIOS/createReactIOSNativeComponentClass.js b/Libraries/ReactNative/createReactNativeNativeComponentClass.js similarity index 66% rename from Libraries/ReactIOS/createReactIOSNativeComponentClass.js rename to Libraries/ReactNative/createReactNativeNativeComponentClass.js index 5a5af04dc..3a63089b6 100644 --- a/Libraries/ReactIOS/createReactIOSNativeComponentClass.js +++ b/Libraries/ReactNative/createReactNativeNativeComponentClass.js @@ -6,17 +6,17 @@ * 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 createReactIOSNativeComponentClass + * @providesModule createReactNativeComponentClass * @flow */ "use strict"; var ReactElement = require('ReactElement'); -var ReactIOSNativeComponent = require('ReactIOSNativeComponent'); +var ReactNativeBaseComponent = require('ReactNativeBaseComponent'); -// See also ReactIOSNativeComponent -type ReactIOSNativeComponentViewConfig = { +// See also ReactNativeBaseComponent +type ReactNativeBaseComponentViewConfig = { validAttributes: Object; uiViewClassName: string; } @@ -25,8 +25,8 @@ type ReactIOSNativeComponentViewConfig = { * @param {string} config iOS View configuration. * @private */ -var createReactIOSNativeComponentClass = function( - viewConfig: ReactIOSNativeComponentViewConfig +var createReactNativeComponentClass = function( + viewConfig: ReactNativeBaseComponentViewConfig ): Function { // returning Function is lossy :/ var Constructor = function(element) { this._currentElement = element; @@ -36,9 +36,9 @@ var createReactIOSNativeComponentClass = function( this.previousFlattenedStyle = null; }; Constructor.displayName = viewConfig.uiViewClassName; - Constructor.prototype = new ReactIOSNativeComponent(viewConfig); + Constructor.prototype = new ReactNativeBaseComponent(viewConfig); return Constructor; }; -module.exports = createReactIOSNativeComponentClass; +module.exports = createReactNativeComponentClass; diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index a67abacb0..2ea93263f 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -13,19 +13,19 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); -var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheetPropType = require('StyleSheetPropType'); var TextStylePropTypes = require('TextStylePropTypes'); var Touchable = require('Touchable'); -var createReactIOSNativeComponentClass = - require('createReactIOSNativeComponentClass'); +var createReactNativeComponentClass = + require('createReactNativeComponentClass'); var merge = require('merge'); var stylePropType = StyleSheetPropType(TextStylePropTypes); var viewConfig = { - validAttributes: merge(ReactIOSViewAttributes.UIView, { + validAttributes: merge(ReactNativeViewAttributes.UIView, { isHighlighted: true, numberOfLines: true, }), @@ -202,6 +202,6 @@ type RectOffset = { var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; -var RCTText = createReactIOSNativeComponentClass(viewConfig); +var RCTText = createReactNativeComponentClass(viewConfig); module.exports = Text; diff --git a/Libraries/vendor/react/browser/eventPlugins/PanResponder.js b/Libraries/vendor/react/browser/eventPlugins/PanResponder.js index d2782cc37..721da744a 100644 --- a/Libraries/vendor/react/browser/eventPlugins/PanResponder.js +++ b/Libraries/vendor/react/browser/eventPlugins/PanResponder.js @@ -183,7 +183,7 @@ var PanResponder = { * changes* in the centroid of recently moved touches. * * There is also some nuance with how we handle multiple moved touches in a - * single event. With the way `ReactIOSEventEmitter` dispatches touches as + * single event. With the way `ReactNativeEventEmitter` dispatches touches as * individual events, multiple touches generate two 'move' events, each of * them triggering `onResponderMove`. But with the way `PanResponder` works, * all of the gesture inference is performed on the first dispatch, since it diff --git a/Libraries/vendor/react/platformImplementations/universal/worker/UniversalWorkerNodeHandle.js b/Libraries/vendor/react/platformImplementations/universal/worker/UniversalWorkerNodeHandle.js index ab43a08f6..b91feba9b 100644 --- a/Libraries/vendor/react/platformImplementations/universal/worker/UniversalWorkerNodeHandle.js +++ b/Libraries/vendor/react/platformImplementations/universal/worker/UniversalWorkerNodeHandle.js @@ -2,7 +2,7 @@ * @providesModule UniversalWorkerNodeHandle */ -var ReactIOSTagHandles = require('ReactIOSTagHandles'); +var ReactNativeTagHandles = require('ReactNativeTagHandles'); var invariant = require('invariant'); @@ -12,7 +12,7 @@ var UniversalWorkerNodeHandle = { nodeHandle !== undefined && nodeHandle !== null && nodeHandle !== 0, 'No node handle defined' ); - return ReactIOSTagHandles.tagToRootNodeID[nodeHandle]; + return ReactNativeTagHandles.tagToRootNodeID[nodeHandle]; } }; diff --git a/React/Base/RCTRootView.m b/React/Base/RCTRootView.m index 9ee09d495..f631af636 100644 --- a/React/Base/RCTRootView.m +++ b/React/Base/RCTRootView.m @@ -96,7 +96,7 @@ } RCT_IMPORT_METHOD(AppRegistry, runApplication) -RCT_IMPORT_METHOD(ReactIOS, unmountComponentAtNodeAndRemoveContainer) +RCT_IMPORT_METHOD(ReactNative, unmountComponentAtNodeAndRemoveContainer) - (void)javaScriptDidLoad:(NSNotification *)notification @@ -217,7 +217,7 @@ RCT_IMPORT_METHOD(ReactIOS, unmountComponentAtNodeAndRemoveContainer) - (void)dealloc { - [_bridge enqueueJSCall:@"ReactIOS.unmountComponentAtNodeAndRemoveContainer" + [_bridge enqueueJSCall:@"ReactNative.unmountComponentAtNodeAndRemoveContainer" args:@[self.reactTag]]; }