Sebastian Markbage a7c8111605 Prefix warning module with fbjs/lib/
Summary:This works internally at FB but not here because mixed mode requires are mandatory. At FB www, only the providesModule version works. In React Core, we only use the providesModule name. I have to remember to change these back again when I do the move so that we can unify. 0f3bd02d0f

We really should pick a single convention per project. In React Core, we translate it in the package/build step to whatever output convention is needed.
Closes https://github.com/facebook/react-native/pull/6891

Differential Revision: D3160811

Pulled By: vjeux

fb-gh-sync-id: daf1f5e1cfae2a7c33cca88139fb5391d25bfe3e
fbshipit-source-id: daf1f5e1cfae2a7c33cca88139fb5391d25bfe3e
2016-04-09 13:24:28 -07:00

44 lines
1.1 KiB
JavaScript

/**
* Copyright (c) 2015-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
* @flow
*/
'use strict';
const ReactIsomorphic = require('ReactIsomorphic');
const ReactNativeImpl = require('ReactNativeImpl');
const warning = require('fbjs/lib/warning');
const React = { ...ReactIsomorphic };
const dedupe = {};
for (const key in ReactNativeImpl) {
React[key] = ReactNativeImpl[key];
if (__DEV__) {
Object.defineProperty(React, key, {
get: function() {
warning(
dedupe[key],
'React.' + key + ' is deprecated. Use ReactNative.' + key +
' from the "react-native" package instead.'
);
dedupe[key] = true;
return ReactNativeImpl[key];
},
set: function(value) {
// Useful for hacky solutions like createExamplePage.
ReactNativeImpl[key] = value;
},
});
}
}
module.exports = React;