[ReactNative] Flush ReactUpdates only once per batch

This commit is contained in:
Tadeu Zagallo
2015-04-22 17:50:54 -07:00
parent ffb3026419
commit 2bda21fbf0

View File

@@ -10,7 +10,9 @@
* @flow
*/
'use strict';
var ErrorUtils = require('ErrorUtils');
var ReactUpdates = require('ReactUpdates');
var invariant = require('invariant');
var warning = require('warning');
@@ -307,9 +309,10 @@ var MessageQueueMixin = {
);
},
processBatch: function (batch) {
processBatch: function(batch) {
var self = this;
batch.forEach(function (call) {
ReactUpdates.batchedUpdates(function() {
batch.forEach(function(call) {
invariant(
call.module === 'BatchedBridge',
'All the calls should pass through the BatchedBridge module'
@@ -323,6 +326,7 @@ var MessageQueueMixin = {
'Unrecognized method called on BatchedBridge: ' + call.method);
}
});
});
return this.flushedQueue();
},