mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
Removed duplicate UIManager constants
Summary: public We were calling constantsToExport twice for every ViewManager, and including two copies of the values in __fbBatchedBridgeConfig. This diff removes the copy from UIManager and then puts it back on the JS side. Reviewed By: tadeuzagallo Differential Revision: D2665625 fb-gh-sync-id: 147ec4bfb404835e3875964476ba233d619c28aa
This commit is contained in:
committed by
facebook-github-bot-7
parent
32c19c1994
commit
ca20d710fc
@@ -67,6 +67,8 @@ class MessageQueue {
|
||||
this._genModulesConfig(localModules),this._moduleTable, this._methodTable
|
||||
);
|
||||
|
||||
this._copyNativeComponentConstants(this.RemoteModules);
|
||||
|
||||
this._debugInfo = {};
|
||||
this._remoteModuleTable = {};
|
||||
this._remoteMethodTable = {};
|
||||
@@ -185,6 +187,30 @@ class MessageQueue {
|
||||
* Private helper methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copies the ViewManager constants into UIManager. This is only
|
||||
* needed for iOS, which puts the constants in the ViewManager
|
||||
* namespace instead of UIManager, unlike Android.
|
||||
*/
|
||||
_copyNativeComponentConstants(remoteModules) {
|
||||
let UIManager = remoteModules.RCTUIManager;
|
||||
UIManager && Object.keys(UIManager).forEach(viewName => {
|
||||
let viewConfig = UIManager[viewName];
|
||||
if (viewConfig.Manager) {
|
||||
const viewManager = remoteModules[viewConfig.Manager];
|
||||
viewManager && Object.keys(viewManager).forEach(key => {
|
||||
const value = viewManager[key];
|
||||
if (typeof value !== 'function') {
|
||||
if (!viewConfig.Constants) {
|
||||
viewConfig.Constants = {};
|
||||
}
|
||||
viewConfig.Constants[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the old, object-based module structure to the new
|
||||
* array-based structure. TODO (t8823865) Removed this
|
||||
|
||||
Reference in New Issue
Block a user