From 2f818abb256cab285815fdfb9666c8ba9faca940 Mon Sep 17 00:00:00 2001 From: evanbacon Date: Mon, 1 Jul 2024 21:29:06 -0500 Subject: [PATCH 1/2] bind scope to null to prevent issues with inline requires --- src/ghQueueMicrotask.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ghQueueMicrotask.ts b/src/ghQueueMicrotask.ts index 1f59f2236f..9b53429b1b 100644 --- a/src/ghQueueMicrotask.ts +++ b/src/ghQueueMicrotask.ts @@ -1,5 +1,6 @@ // We check for typeof requestAnimationFrame because of SSR export const ghQueueMicrotask = - typeof requestAnimationFrame === 'function' - ? requestAnimationFrame - : queueMicrotask; + typeof requestAnimationFrame === "function" + // Functions are bound to null to avoid issues with scope when using Metro inline requires. + ? requestAnimationFrame.bind(null) + : queueMicrotask.bind(null); From 4ebae5d7777c3a183cec7d64f5f6011d76cd0f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bert?= Date: Tue, 2 Jul 2024 08:25:49 +0200 Subject: [PATCH 2/2] Fix prettier --- src/ghQueueMicrotask.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ghQueueMicrotask.ts b/src/ghQueueMicrotask.ts index 9b53429b1b..1efcbc21bf 100644 --- a/src/ghQueueMicrotask.ts +++ b/src/ghQueueMicrotask.ts @@ -1,6 +1,6 @@ // We check for typeof requestAnimationFrame because of SSR export const ghQueueMicrotask = - typeof requestAnimationFrame === "function" - // Functions are bound to null to avoid issues with scope when using Metro inline requires. - ? requestAnimationFrame.bind(null) + typeof requestAnimationFrame === 'function' + ? // Functions are bound to null to avoid issues with scope when using Metro inline requires. + requestAnimationFrame.bind(null) : queueMicrotask.bind(null);