2015-01-29 17:10:49 -08:00
|
|
|
/**
|
2015-03-23 15:07:33 -07:00
|
|
|
* 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.
|
2015-01-29 17:10:49 -08:00
|
|
|
*
|
2015-05-08 09:45:43 -07:00
|
|
|
* @providesModule ReactNative
|
2015-03-25 18:19:28 -07:00
|
|
|
* @flow
|
2015-01-29 17:10:49 -08:00
|
|
|
*/
|
2015-05-19 13:43:46 -07:00
|
|
|
'use strict';
|
2015-01-29 17:10:49 -08:00
|
|
|
|
2016-04-09 04:17:34 -07:00
|
|
|
const ReactIsomorphic = require('ReactIsomorphic');
|
|
|
|
const ReactNativeImpl = require('ReactNativeImpl');
|
2016-04-09 13:23:47 -07:00
|
|
|
const warning = require('fbjs/lib/warning');
|
2015-10-22 15:46:45 -07:00
|
|
|
|
2016-04-09 04:17:34 -07:00
|
|
|
const ReactNative = { ...ReactNativeImpl };
|
2015-01-29 17:10:49 -08:00
|
|
|
|
2016-04-09 04:17:34 -07:00
|
|
|
const dedupe = {};
|
2015-01-29 17:10:49 -08:00
|
|
|
|
|
|
|
if (__DEV__) {
|
2016-04-09 04:17:34 -07:00
|
|
|
for (const key in ReactNativeImpl) {
|
|
|
|
Object.defineProperty(ReactNative, key, {
|
|
|
|
get: function() {
|
|
|
|
return ReactNativeImpl[key];
|
|
|
|
},
|
|
|
|
set: function(value) {
|
|
|
|
// Useful for hacky solutions like createExamplePage.
|
|
|
|
ReactNativeImpl[key] = value;
|
|
|
|
},
|
|
|
|
});
|
2015-01-29 17:10:49 -08:00
|
|
|
}
|
2016-04-09 04:17:34 -07:00
|
|
|
}
|
2015-01-29 17:10:49 -08:00
|
|
|
|
2016-04-09 04:17:34 -07:00
|
|
|
for (const key in ReactIsomorphic) {
|
|
|
|
ReactNative[key] = ReactIsomorphic[key];
|
2015-01-29 17:10:49 -08:00
|
|
|
if (__DEV__) {
|
2016-04-09 04:17:34 -07:00
|
|
|
Object.defineProperty(ReactNative, key, {
|
|
|
|
get: function() {
|
|
|
|
warning(
|
|
|
|
dedupe[key],
|
|
|
|
'ReactNative.' + key + ' is deprecated. Use React.' + key +
|
|
|
|
' from the "react" package instead.'
|
|
|
|
);
|
|
|
|
dedupe[key] = true;
|
|
|
|
return ReactIsomorphic[key];
|
|
|
|
},
|
|
|
|
set: function(value) {
|
|
|
|
// Useful for hacky solutions like createExamplePage.
|
|
|
|
ReactIsomorphic[key] = value;
|
|
|
|
},
|
|
|
|
});
|
2015-01-29 17:10:49 -08:00
|
|
|
}
|
2015-03-23 15:07:33 -07:00
|
|
|
}
|
|
|
|
|
2015-05-08 09:45:43 -07:00
|
|
|
module.exports = ReactNative;
|