From d7de68241fddd5a8266683fb68491bd953f4eba0 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 9 May 2016 05:24:51 -0700 Subject: [PATCH] Index UIManager.Commands correctly Reviewed By: nicklockwood Differential Revision: D3275652 fb-gh-sync-id: a38e9cf6a46f2aa373b4948aa419b42af402c784 fbshipit-source-id: a38e9cf6a46f2aa373b4948aa419b42af402c784 --- .../BatchedBridge/BatchedBridgedModules/NativeModules.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js index 3fea37e1a..e781e4670 100644 --- a/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js +++ b/Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js @@ -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;