From 9089b2cf87ecc2644090da22ed8797f56db5c7bb Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 13 May 2022 23:00:48 -0700 Subject: [PATCH] fix(Utils): dispatchToUIThread --- packages/core/utils/mainthread-helper.ios.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/core/utils/mainthread-helper.ios.ts b/packages/core/utils/mainthread-helper.ios.ts index e1bef0281..b22ee551d 100644 --- a/packages/core/utils/mainthread-helper.ios.ts +++ b/packages/core/utils/mainthread-helper.ios.ts @@ -8,12 +8,10 @@ export function isMainThread(): boolean { export function dispatchToUIThread(func: () => void) { const runloop = CFRunLoopGetMain(); - return function (func) { - if (runloop && func) { - CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, func); - CFRunLoopWakeUp(runloop); - } else if (func) { - func(); - } - }; + if (runloop && func) { + CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, func); + CFRunLoopWakeUp(runloop); + } else if (func) { + func(); + } }