mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Remove node_modules/react from the list of discoverable haste modules
Summary: This removes `node_modules/react` from the list of directories that are used for haste module resolutions. Modules required from React are now imported with `require('react/lib/…')`.
Reviewed By: astreet
Differential Revision: D3509863
fbshipit-source-id: 32cd34e2b8496f0a6676dbe6bb1eacc18124c01e
This commit is contained in:
committed by
Facebook Github Bot 7
parent
4ac4f86bf5
commit
bd60d828c5
12
Libraries/react-native/React.js
vendored
Normal file
12
Libraries/react-native/React.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2016-present, Facebook, Inc.
|
||||
* 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. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule React
|
||||
*/
|
||||
'use strict';
|
||||
module.exports = require('react/lib/React');
|
||||
13
Libraries/react-native/ReactNative.js
vendored
Normal file
13
Libraries/react-native/ReactNative.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2016-present, Facebook, Inc.
|
||||
* 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. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @flow
|
||||
* @providesModule ReactNative
|
||||
*/
|
||||
'use strict';
|
||||
module.exports = require('react/lib/ReactNative');
|
||||
20
Libraries/react-native/react-native.js
vendored
20
Libraries/react-native/react-native.js
vendored
@@ -13,8 +13,8 @@
|
||||
const warning = require('fbjs/lib/warning');
|
||||
|
||||
if (__DEV__) {
|
||||
const warningDedupe = {};
|
||||
const addonWarn = function(prevName, newPackageName) {
|
||||
var warningDedupe = {};
|
||||
var addonWarn = function(prevName, newPackageName) {
|
||||
warning(
|
||||
warningDedupe[prevName],
|
||||
'React.addons.' + prevName + ' is deprecated. Please import the "' +
|
||||
@@ -127,14 +127,14 @@ const ReactNative = {
|
||||
if (__DEV__) {
|
||||
addonWarn('LinkedStateMixin', 'react-addons-linked-state-mixin');
|
||||
}
|
||||
return require('LinkedStateMixin');
|
||||
return require('react/lib/LinkedStateMixin');
|
||||
},
|
||||
Perf: undefined,
|
||||
get PureRenderMixin() {
|
||||
if (__DEV__) {
|
||||
addonWarn('PureRenderMixin', 'react-addons-pure-render-mixin');
|
||||
}
|
||||
return require('ReactComponentWithPureRenderMixin');
|
||||
return require('react/lib/ReactComponentWithPureRenderMixin');
|
||||
},
|
||||
get TestModule() {
|
||||
if (__DEV__) {
|
||||
@@ -157,19 +157,19 @@ const ReactNative = {
|
||||
);
|
||||
warningDedupe.batchedUpdates = true;
|
||||
}
|
||||
return require('ReactUpdates').batchedUpdates;
|
||||
return require('react/lib/ReactUpdates').batchedUpdates;
|
||||
},
|
||||
get createFragment() {
|
||||
if (__DEV__) {
|
||||
addonWarn('createFragment', 'react-addons-create-fragment');
|
||||
}
|
||||
return require('ReactFragment').create;
|
||||
return require('react/lib/ReactFragment').create;
|
||||
},
|
||||
get update() {
|
||||
if (__DEV__) {
|
||||
addonWarn('update', 'react-addons-update');
|
||||
}
|
||||
return require('update');
|
||||
return require('react/lib/update');
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -190,7 +190,7 @@ if (__DEV__) {
|
||||
|
||||
// Preserve getters with warnings on the internal ReactNative copy without
|
||||
// invoking them.
|
||||
const ReactNativeInternal = require('ReactNative');
|
||||
const ReactNativeInternal = require('react/lib/ReactNative');
|
||||
function applyForwarding(key) {
|
||||
if (__DEV__) {
|
||||
Object.defineProperty(
|
||||
@@ -213,7 +213,7 @@ if (__DEV__) {
|
||||
if (__DEV__) {
|
||||
addonWarn('Perf', 'react-addons-perf');
|
||||
}
|
||||
return require('ReactPerf');
|
||||
return require('react/lib/ReactPerf');
|
||||
}
|
||||
});
|
||||
Object.defineProperty(ReactNative.addons, 'TestUtils', {
|
||||
@@ -222,7 +222,7 @@ if (__DEV__) {
|
||||
if (__DEV__) {
|
||||
addonWarn('update', 'react-addons-test-utils');
|
||||
}
|
||||
return require('ReactTestUtils');
|
||||
return require('react/lib/ReactTestUtils');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// Our ReactNative.js has had its types stripped, so here we
|
||||
// need to enumerate and type the properties we need access to.
|
||||
//
|
||||
var ReactNativeInternal = (require('ReactNative'): {
|
||||
var ReactNativeInternal = (require('react/lib/ReactNative'): {
|
||||
// render
|
||||
render: (
|
||||
element: ReactElement<any>,
|
||||
|
||||
Reference in New Issue
Block a user