diff --git a/lib/commonjs/ghQueueMicrotask.js b/lib/commonjs/ghQueueMicrotask.js index dc088ed48aeea534cbe6f0bdc95b093d4b000cd1..2402b8db1e9dfcaef0126e3abc8ef77420d53b8a 100644 --- a/lib/commonjs/ghQueueMicrotask.js +++ b/lib/commonjs/ghQueueMicrotask.js @@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ghQueueMicrotask = void 0; -// `queueMicrotask` was introduced to react-native in version 0.66 (https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0660) -// Because Gesture Handler supports versions 0.64+, we have to handle situations where someone uses older version of react native. -// That's why if `queueMicrotask` doesn't exist, we use `setImmediate` instead, since it was used before we switched to `queueMicrotask` in version 2.11.0 -const ghQueueMicrotask = typeof queueMicrotask === 'function' ? queueMicrotask : setImmediate; +// We check for typeof requestAnimationFrame because of SSR +const ghQueueMicrotask = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : queueMicrotask; exports.ghQueueMicrotask = ghQueueMicrotask; //# sourceMappingURL=ghQueueMicrotask.js.map \ No newline at end of file diff --git a/lib/module/ghQueueMicrotask.js b/lib/module/ghQueueMicrotask.js index 5ddf6672e62a6b0d07574f2b0d4b3c1c749c41fb..24a3a05cd53125946779f99e90728150099101bf 100644 --- a/lib/module/ghQueueMicrotask.js +++ b/lib/module/ghQueueMicrotask.js @@ -1,5 +1,3 @@ -// `queueMicrotask` was introduced to react-native in version 0.66 (https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0660) -// Because Gesture Handler supports versions 0.64+, we have to handle situations where someone uses older version of react native. -// That's why if `queueMicrotask` doesn't exist, we use `setImmediate` instead, since it was used before we switched to `queueMicrotask` in version 2.11.0 -export const ghQueueMicrotask = typeof queueMicrotask === 'function' ? queueMicrotask : setImmediate; +// We check for typeof requestAnimationFrame because of SSR +export const ghQueueMicrotask = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : queueMicrotask; //# sourceMappingURL=ghQueueMicrotask.js.map \ No newline at end of file diff --git a/src/ghQueueMicrotask.ts b/src/ghQueueMicrotask.ts index b0570292c3fb3243c380f503f1a9e147c6ece52b..9c337724886e0c5c15b6c29e44129ebe77b3e9eb 100644 --- a/src/ghQueueMicrotask.ts +++ b/src/ghQueueMicrotask.ts @@ -1,5 +1,5 @@ -// `queueMicrotask` was introduced to react-native in version 0.66 (https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0660) -// Because Gesture Handler supports versions 0.64+, we have to handle situations where someone uses older version of react native. -// That's why if `queueMicrotask` doesn't exist, we use `setImmediate` instead, since it was used before we switched to `queueMicrotask` in version 2.11.0 +// We check for typeof requestAnimationFrame because of SSR export const ghQueueMicrotask = - typeof queueMicrotask === 'function' ? queueMicrotask : setImmediate; + typeof requestAnimationFrame === "function" + ? requestAnimationFrame + : queueMicrotask;