@@ -311,10 +311,12 @@ void RCTUnsafeExecuteOnMainQueueSync(dispatch_block_t block)
311311 return ;
312312 }
313313
314+ #if !TARGET_OS_TV
314315 if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS ()) {
315316 unsafeExecuteOnMainThreadSync (block);
316317 return ;
317318 }
319+ #endif
318320
319321 dispatch_sync (dispatch_get_main_queue (), ^{
320322 block ();
@@ -339,10 +341,12 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp
339341 return ;
340342 }
341343
344+ #if !TARGET_OS_TV
342345 if (ReactNativeFeatureFlags::enableMainQueueCoordinatorOnIOS ()) {
343346 unsafeExecuteOnMainThreadSync (block);
344347 return ;
345348 }
349+ #endif
346350
347351 dispatch_sync (dispatch_get_main_queue (), executeOnce);
348352}
@@ -421,10 +425,9 @@ CGSize RCTViewportSize(void)
421425
422426CGSize RCTSwitchSize (void )
423427{
424- // UISwitch is not supported on AppleTV
425428#if TARGET_OS_TV
426429 return CGSizeMake (0 , 0 );
427- #endif
430+ #else
428431 static CGSize rctSwitchSize;
429432 static dispatch_once_t onceToken;
430433 dispatch_once (&onceToken, ^{
@@ -433,6 +436,7 @@ CGSize RCTSwitchSize(void)
433436 });
434437 });
435438 return rctSwitchSize;
439+ #endif
436440}
437441
438442CGFloat RCTRoundPixelValue (CGFloat value)
@@ -642,7 +646,9 @@ BOOL RCTRunningInAppExtension(void)
642646 // We have apps internally that might use UIScenes which are not window scenes.
643647 // Calling keyWindow on a UIScene which is not a UIWindowScene can cause a crash
644648 UIWindowScene *windowScene = (UIWindowScene *)sceneToUse;
645- return windowScene.keyWindow ;
649+ if (@available (iOS 15.0 , tvOS 15.0 , *)) {
650+ return windowScene.keyWindow ;
651+ }
646652 }
647653
648654 return nil ;
0 commit comments