#include "REAIOSScheduler.h" #include "RuntimeManager.h" namespace reanimated { using namespace facebook; using namespace react; REAIOSScheduler::REAIOSScheduler(std::shared_ptr jsInvoker) { this->jsCallInvoker_ = jsInvoker; } void REAIOSScheduler::scheduleOnUI(std::function job) { if (runtimeManager.lock() == nullptr) { return; } if([NSThread isMainThread]) { if (runtimeManager.lock()) job(); return; } Scheduler::scheduleOnUI(job); if([NSThread isMainThread]) { if (runtimeManager.lock()) triggerUI(); return; } __block std::weak_ptr blockRuntimeManager = runtimeManager; dispatch_async(dispatch_get_main_queue(), ^{ if (blockRuntimeManager.lock()) triggerUI(); }); } REAIOSScheduler::~REAIOSScheduler(){ } }