From 9bcc67e73a5a83f1551c47598be7bf65c3a812e1 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 18 Dec 2017 16:15:00 +0000 Subject: [PATCH] [fix] top-level API exports Also fixes importing these APIs from 'react-native' when used with the Babel plugin. --- src/apis/AppRegistry/index.js | 2 +- src/module.js | 5 ++--- src/modules/render/index.js | 12 ++++++++++++ src/modules/unmountComponentAtNode/index.js | 12 ++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/modules/render/index.js create mode 100644 src/modules/unmountComponentAtNode/index.js diff --git a/src/apis/AppRegistry/index.js b/src/apis/AppRegistry/index.js index 63e39649..9a006197 100644 --- a/src/apis/AppRegistry/index.js +++ b/src/apis/AppRegistry/index.js @@ -11,7 +11,7 @@ */ import invariant from 'fbjs/lib/invariant'; -import { unmountComponentAtNode } from 'react-dom'; +import { unmountComponentAtNode } from '../../modules/unmountComponentAtNode'; import renderApplication, { getApplication } from './renderApplication'; import type { ComponentType } from 'react'; diff --git a/src/module.js b/src/module.js index a0eee4b8..4bb479bb 100644 --- a/src/module.js +++ b/src/module.js @@ -2,7 +2,8 @@ import createElement from './modules/createElement'; import findNodeHandle from './modules/findNodeHandle'; import NativeModules from './modules/NativeModules'; import processColor from './modules/processColor'; -import { hydrate, render, unmountComponentAtNode } from 'react-dom'; +import render from './modules/render'; +import unmountComponentAtNode from './modules/unmountComponentAtNode'; // APIs import Animated from './apis/Animated'; @@ -63,7 +64,6 @@ import ViewPropTypes from './components/View/ViewPropTypes'; export { // top-level API findNodeHandle, - hydrate, render, unmountComponentAtNode, // modules @@ -128,7 +128,6 @@ export { const ReactNative = { // top-level API findNodeHandle, - hydrate, render, unmountComponentAtNode, diff --git a/src/modules/render/index.js b/src/modules/render/index.js new file mode 100644 index 00000000..e1b3a284 --- /dev/null +++ b/src/modules/render/index.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2016-present, Nicolas Gallagher. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + * + * @noflow + */ + +import { render } from 'react-dom'; +export default render; diff --git a/src/modules/unmountComponentAtNode/index.js b/src/modules/unmountComponentAtNode/index.js new file mode 100644 index 00000000..9b19d6b8 --- /dev/null +++ b/src/modules/unmountComponentAtNode/index.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2016-present, Nicolas Gallagher. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + * + * @noflow + */ + +import { unmountComponentAtNode } from 'react-dom'; +export default unmountComponentAtNode;