From fdde08f88279b39afbe7e76a5cbeeea79cc2b070 Mon Sep 17 00:00:00 2001 From: Liad Yosef Date: Mon, 9 Sep 2019 13:56:38 +0300 Subject: [PATCH] Bind rAF and cAF to window (#16606) When capturing local references of requestAnimationFrame and cancelAnimationFrame - bind them to the window object. Fixes #16606 --- packages/scheduler/src/forks/SchedulerHostConfig.default.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scheduler/src/forks/SchedulerHostConfig.default.js b/packages/scheduler/src/forks/SchedulerHostConfig.default.js index 77e15c1000b52..149ccf38b1037 100644 --- a/packages/scheduler/src/forks/SchedulerHostConfig.default.js +++ b/packages/scheduler/src/forks/SchedulerHostConfig.default.js @@ -83,8 +83,8 @@ if ( const Date = window.Date; const setTimeout = window.setTimeout; const clearTimeout = window.clearTimeout; - const requestAnimationFrame = window.requestAnimationFrame; - const cancelAnimationFrame = window.cancelAnimationFrame; + const requestAnimationFrame = window.requestAnimationFrame && window.requestAnimationFrame.bind(window); + const cancelAnimationFrame = window.cancelAnimationFrame && window.cancelAnimationFrame.bind(window); if (typeof console !== 'undefined') { // TODO: Remove fb.me link