diff --git a/src/component.js b/src/component.js index e589159..6662a22 100644 --- a/src/component.js +++ b/src/component.js @@ -37,7 +37,9 @@ const serialize = require('./utilities/serialize'); * * This has a very symmetrical relationship to the userland side of creating a * React Component. There are the additional private methods used by other parts - * of React Core, such as `getPublicInstance` or `getNativeNode`. + * of React Core, such as `getPublicInstance` or + * React <= 15.0 `getNativeNode` + * React > 15.0 `getHostNode` */ const MinimumViableComponent = function(element) { // This internal API—while relatively unchanged for a while—is likely pretty @@ -45,7 +47,7 @@ const MinimumViableComponent = function(element) { // not be the *best* abstraction for them. // `this.node` in ReactDOM points to the DOM node of a component. - // `getNativeNode` should return this. + // `getNativeNode`/`getHostNode` should return this. this.node = null; // `this._mountImage` is the representation you use to render a ReactElement // hierarchy. This could be an HTML string, a DOM node, or an identifier or @@ -71,7 +73,11 @@ MinimumViableComponent.prototype = Object.assign( mountComponent() {}, receiveComponent() {}, unmountComponent() {}, - getNativeNode() {} + // implement both of these for now. React <= 15.0 uses getNativeNode, but + // that is confusing. Host environment is more accurate and will be used + // going forward + getNativeNode() {}, + getHostNode() {} }, ReactMultiChild.Mixin ); @@ -146,7 +152,7 @@ const TinyRendererComponentMixin = { this.updateChildren(nextElement.props.children, transaction, context); }, // there is no native node - getNativeNode() {}, + getHostNode() {}, // how do you unmount JSON? unmountComponent() {}, }; diff --git a/src/injection.js b/src/injection.js index 6417083..1ccfdb1 100644 --- a/src/injection.js +++ b/src/injection.js @@ -39,7 +39,7 @@ * * ReactDOMComponent.js * * ReactEmptyComponent.js * * ReactInjection.js - * * ReactNativeComponent.js + * * ReactHostComponent.js * * ReactPerf.js * * ReactMount.js * * ReactServerRendering.js @@ -61,7 +61,7 @@ * * EventPluginHub * * EventPluginUtils * * EventEmitter - * * NativeComponent + * * HostComponent * * Perf * * Updates * @@ -76,7 +76,7 @@ const TinyRendererComponent = require('./component'); function inject() { // For the Tiny React Renderer only the generic component class will be - // injected. The NativeComponent injection has the following three methods: + // injected. The HostComponent injection has the following three methods: // // * injectGenericComponentClass // * injectTextComponentClass @@ -93,7 +93,7 @@ function inject() { // For example, the following scenario would map `` to the specific // ReactDOMInput component. // `injectComponentClasses({input: ReactDOMInput})` - ReactInjection.NativeComponent.injectGenericComponentClass( + (ReactInjection.NativeComponent || ReactInjection.HostComponent).injectGenericComponentClass( TinyRendererComponent );