React Native: Fix InteractionManager Race Condition

This commit is contained in:
Tim Yung 2015-04-13 11:19:28 -07:00
parent db45ed4a53
commit 29696a26eb
1 changed files with 6 additions and 3 deletions

View File

@ -119,6 +119,8 @@ function scheduleUpdate() {
* Notify listeners, process queue, etc
*/
function processUpdate() {
_nextUpdateHandle = null;
var interactionCount = _interactionSet.size;
_addInteractionSet.forEach(handle =>
_interactionSet.add(handle)
@ -138,12 +140,13 @@ function processUpdate() {
// process the queue regardless of a transition
if (nextInteractionCount === 0) {
_queue.forEach(callback => {
var queue = _queue;
_queue = [];
queue.forEach(callback => {
ErrorUtils.applyWithGuard(callback);
});
_queue = [];
}
_nextUpdateHandle = null;
_addInteractionSet.clear();
_deleteInteractionSet.clear();
}