From 725e03412820064a0e0c927397aa8473fa3a1961 Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Thu, 11 Jul 2019 11:54:38 -0700 Subject: [PATCH] TM iOS: Run RCTPlatform methods on the main queue Summary: This module expects to compute main queue stuffs inside getConstants(), mark it so. This address crashes when running tests: ``` Main Thread Checker: UI API called on a background thread: -[UIApplication keyWindow] PID: 88318, TID: 22602153, Thread name: com.facebook.react.JavaScript, Queue name: com.apple.root.default-qos.overcommit, QoS: 0 Backtrace: 4 RNTester 0x0000000100beece8 RCTKeyWindow + 72 5 RNTester 0x0000000100beeee4 RCTForceTouchAvailable + 148 6 RNTester 0x0000000100c0b54d -[RCTPlatform getConstants] + 109 ``` Sample CI failure: https://circleci.com/gh/facebook/react-native/101079 Reviewed By: PeteTheHeat Differential Revision: D16198720 fbshipit-source-id: 272eaccf5027d0bf5b2838ed9623ae079fac148e --- React/CoreModules/RCTPlatform.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/React/CoreModules/RCTPlatform.mm b/React/CoreModules/RCTPlatform.mm index aa70b683fcc..69cae85879d 100644 --- a/React/CoreModules/RCTPlatform.mm +++ b/React/CoreModules/RCTPlatform.mm @@ -44,6 +44,11 @@ RCT_EXPORT_MODULE(PlatformConstants) return YES; } +- (dispatch_queue_t)methodQueue +{ + return dispatch_get_main_queue(); +} + // TODO: Use the generated struct return type. - (NSDictionary *)constantsToExport {