Skip to content

Commit b30134e

Browse files
committed
Rename host-y things to “host” instead of “native” (#5)
Tracking the changes in facebook/react#6754
1 parent e23b0d2 commit b30134e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/component.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ const serialize = require('./utilities/serialize');
3737
*
3838
* This has a very symmetrical relationship to the userland side of creating a
3939
* React Component. There are the additional private methods used by other parts
40-
* of React Core, such as `getPublicInstance` or `getNativeNode`.
40+
* of React Core, such as `getPublicInstance` or
41+
* React <= 15.0 `getNativeNode`
42+
* React > 15.0 `getHostNode`
4143
*/
4244
const MinimumViableComponent = function(element) {
4345
// This internal API—while relatively unchanged for a while—is likely pretty
4446
// volatile. Many of these names began with ReactDOM and ReactART which may
4547
// not be the *best* abstraction for them.
4648

4749
// `this.node` in ReactDOM points to the DOM node of a component.
48-
// `getNativeNode` should return this.
50+
// `getNativeNode`/`getHostNode` should return this.
4951
this.node = null;
5052
// `this._mountImage` is the representation you use to render a ReactElement
5153
// hierarchy. This could be an HTML string, a DOM node, or an identifier or
@@ -71,7 +73,11 @@ MinimumViableComponent.prototype = Object.assign(
7173
mountComponent() {},
7274
receiveComponent() {},
7375
unmountComponent() {},
74-
getNativeNode() {}
76+
// implement both of these for now. React <= 15.0 uses getNativeNode, but
77+
// that is confusing. Host environment is more accurate and will be used
78+
// going forward
79+
getNativeNode() {},
80+
getHostNode() {}
7581
},
7682
ReactMultiChild.Mixin
7783
);
@@ -146,7 +152,7 @@ const TinyRendererComponentMixin = {
146152
this.updateChildren(nextElement.props.children, transaction, context);
147153
},
148154
// there is no native node
149-
getNativeNode() {},
155+
getHostNode() {},
150156
// how do you unmount JSON?
151157
unmountComponent() {},
152158
};

src/injection.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* * ReactDOMComponent.js
4040
* * ReactEmptyComponent.js
4141
* * ReactInjection.js
42-
* * ReactNativeComponent.js
42+
* * ReactHostComponent.js
4343
* * ReactPerf.js
4444
* * ReactMount.js
4545
* * ReactServerRendering.js
@@ -61,7 +61,7 @@
6161
* * EventPluginHub
6262
* * EventPluginUtils
6363
* * EventEmitter
64-
* * NativeComponent
64+
* * HostComponent
6565
* * Perf
6666
* * Updates
6767
*
@@ -76,7 +76,7 @@ const TinyRendererComponent = require('./component');
7676

7777
function inject() {
7878
// For the Tiny React Renderer only the generic component class will be
79-
// injected. The NativeComponent injection has the following three methods:
79+
// injected. The HostComponent injection has the following three methods:
8080
//
8181
// * injectGenericComponentClass
8282
// * injectTextComponentClass
@@ -93,7 +93,7 @@ function inject() {
9393
// For example, the following scenario would map `<input />` to the specific
9494
// ReactDOMInput component.
9595
// `injectComponentClasses({input: ReactDOMInput})`
96-
ReactInjection.NativeComponent.injectGenericComponentClass(
96+
(ReactInjection.NativeComponent || ReactInjection.HostComponent).injectGenericComponentClass(
9797
TinyRendererComponent
9898
);
9999

0 commit comments

Comments
 (0)