Index UIManager.Commands correctly

Reviewed By: nicklockwood

Differential Revision: D3275652

fb-gh-sync-id: a38e9cf6a46f2aa373b4948aa419b42af402c784
fbshipit-source-id: a38e9cf6a46f2aa373b4948aa419b42af402c784
This commit is contained in:
Pieter De Baets 2016-05-09 05:24:51 -07:00 committed by Facebook Github Bot 5
parent 54f7ae1c02
commit d7de68241f

View File

@ -102,10 +102,13 @@ if (Platform.OS === 'ios') {
}
commands = {};
const viewManager = NativeModules[normalizePrefix(viewConfig.Manager)];
viewManager && Object.keys(viewManager).forEach((key, index) => {
// Note: we depend on the fact that the JS object holding the configuration
// retains key order. This will probably break at some point.
let index = 0;
viewManager && Object.keys(viewManager).forEach(key => {
const value = viewManager[key];
if (typeof value === 'function') {
commands[key] = index;
commands[key] = index++;
}
});
return commands;