diff --git a/packages/react-native/Libraries/Interaction/InteractionManagerStub.js b/packages/react-native/Libraries/Interaction/InteractionManagerStub.js index 5b45d8bd76b..4e94dcf40ce 100644 --- a/packages/react-native/Libraries/Interaction/InteractionManagerStub.js +++ b/packages/react-native/Libraries/Interaction/InteractionManagerStub.js @@ -25,6 +25,14 @@ type Task = } | (() => void); +// NOTE: The original implementation of `InteractionManager` never rejected +// the returned promise. This preserves that behavior in the stub. +function reject(error: Error): void { + setTimeout(() => { + throw error; + }, 0); +} + /** * InteractionManager allows long-running work to be scheduled after any * interactions/animations have completed. In particular, this allows JavaScript @@ -97,7 +105,7 @@ const InteractionManagerStub = { ... } { let immediateID: ?$FlowIssue; - const promise = new Promise((resolve, reject) => { + const promise = new Promise(resolve => { immediateID = setImmediate(() => { if (typeof task === 'object' && task !== null) { if (typeof task.gen === 'function') {