Skip to content

Commit 742454b

Browse files
committed
fix build problems on tvOS
1 parent b7ca7b1 commit 742454b

8 files changed

+46
-3
lines changed

ios/RNSScreen.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
#import "RNSScreenContainer.h"
66
#import "RNSScreenContentWrapper.h"
77
#import "RNSScrollViewBehaviorOverriding.h"
8+
9+
#if !TARGET_OS_TV
810
#import "RNSOrientationProviding.h"
11+
#endif // !TARGET_OS_TV
912

1013
#if RCT_NEW_ARCH_ENABLED
1114
#import <React/RCTViewComponentView.h>
@@ -34,8 +37,11 @@ namespace react = facebook::react;
3437

3538
@class RNSScreenView;
3639

40+
#if !TARGET_OS_TV
3741
@interface RNSScreen : UIViewController <RNSViewControllerDelegate, RNSOrientationProviding>
38-
42+
#else // !TARGET_OS_TV
43+
@interface RNSScreen : UIViewController <RNSViewControllerDelegate>
44+
#endif // !TARGET_OS_TV
3945
- (instancetype)initWithView:(UIView *)view;
4046
- (UIViewController *)findChildVCForConfigAndTrait:(RNSWindowTrait)trait includingModals:(BOOL)includingModals;
4147
- (BOOL)hasNestedStack;

ios/RNSScreen.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1996,6 +1996,8 @@ - (void)presentViewController:(UIViewController *)viewControllerToPresent
19961996

19971997
#pragma mark - RNSOrientationProviding
19981998

1999+
#if !TARGET_OS_TV
2000+
19992001
- (RNSOrientation)evaluateOrientation
20002002
{
20012003
if ([self.childViewControllers.lastObject respondsToSelector:@selector(evaluateOrientation)]) {
@@ -2006,10 +2008,12 @@ - (RNSOrientation)evaluateOrientation
20062008
return childOrientation;
20072009
}
20082010
}
2009-
2011+
20102012
return rnscreens::conversion::RNSOrientationFromUIInterfaceOrientationMask([self supportedInterfaceOrientations]);
20112013
}
20122014

2015+
#endif // !TARGET_OS_TV
2016+
20132017
#ifdef RCT_NEW_ARCH_ENABLED
20142018
#pragma mark - Fabric specific
20152019

ios/RNSScreenStack.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77

88
#import "RNSBottomTabsSpecialEffectsSupporting.h"
99
#import "RNSScreenContainer.h"
10+
11+
#if !TARGET_OS_TV
1012
#import "RNSOrientationProviding.h"
13+
#endif // !TARGET_OS_TV
1114

1215
NS_ASSUME_NONNULL_BEGIN
1316

17+
#if !TARGET_OS_TV
1418
@interface RNSNavigationController : UINavigationController <RNSViewControllerDelegate, RNSBottomTabsSpecialEffectsSupporting, RNSOrientationProviding>
19+
#else // !TARGET_OS_TV
20+
@interface RNSNavigationController : UINavigationController <RNSViewControllerDelegate, RNSBottomTabsSpecialEffectsSupporting>
21+
#endif // !TARGET_OS_TV
1522

1623
@end
1724

ios/RNSScreenStack.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,20 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations
9999
return [self topViewController].supportedInterfaceOrientations;
100100
}
101101

102+
#if !TARGET_OS_TV
103+
102104
- (RNSOrientation)evaluateOrientation
103105
{
104106
if ([self.topViewController respondsToSelector:@selector(evaluateOrientation)]) {
105107
id<RNSOrientationProviding> top = static_cast<id<RNSOrientationProviding>>(self.topViewController);
106108
return [top evaluateOrientation];
107109
}
108-
110+
109111
return RNSOrientationInherit;
110112
}
111113

114+
#endif // !TARGET_OS_TV
115+
112116
- (UIViewController *)childViewControllerForHomeIndicatorAutoHidden
113117
{
114118
return [self topViewController];

ios/bottom-tabs/RNSTabBarController.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#import <UIKit/UIKit.h>
22
#import "RNSTabBarAppearanceCoordinator.h"
33
#import "RNSTabsScreenViewController.h"
4+
5+
#if !TARGET_OS_TV
46
#import "RNSOrientationProviding.h"
7+
#endif // !TARGET_OS_TV
58

69
NS_ASSUME_NONNULL_BEGIN
710

@@ -22,7 +25,11 @@ NS_ASSUME_NONNULL_BEGIN
2225
* i.e. if you made changes through one of signals method, unless you flush them immediately (not needed atm), they will
2326
* be executed only after react finishes the transaction (from within transaction execution block).
2427
*/
28+
#if !TARGET_OS_TV
2529
@interface RNSTabBarController : UITabBarController <RNSReactTransactionObserving, RNSOrientationProviding>
30+
#else // !TARGET_OS_TV
31+
@interface RNSTabBarController : UITabBarController <RNSReactTransactionObserving>
32+
#endif // !TARGET_OS_TV
2633

2734
- (instancetype)initWithTabsHostComponentView:(nullable RNSBottomTabsHostComponentView *)tabsHostComponentView;
2835

ios/bottom-tabs/RNSTabBarController.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ - (void)updateOrientation
229229

230230
#pragma mark - RNSOrientationProviding
231231

232+
#if !TARGET_OS_TV
233+
232234
- (RNSOrientation)evaluateOrientation
233235
{
234236
if ([self.selectedViewController respondsToSelector:@selector(evaluateOrientation)]) {
@@ -239,4 +241,6 @@ - (RNSOrientation)evaluateOrientation
239241
return RNSOrientationInherit;
240242
}
241243

244+
#endif // !TARGET_OS_TV
245+
242246
@end

ios/bottom-tabs/RNSTabsScreenViewController.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
#import <UIKit/UIKit.h>
22
#import "RNSBottomTabsScreenComponentView.h"
33
#import "RNSBottomTabsSpecialEffectsSupporting.h"
4+
5+
#if !TARGET_OS_TV
46
#import "RNSOrientationProviding.h"
7+
#endif // !TARGET_OS_TV
58

69
NS_ASSUME_NONNULL_BEGIN
710

11+
#if !TARGET_OS_TV
812
@interface RNSTabsScreenViewController : UIViewController <RNSOrientationProviding>
13+
#else // !TARGET_OS_TV
14+
@interface RNSTabsScreenViewController : UIViewController
15+
#endif // !TARGET_OS_TV
916

1017
@property (nonatomic, strong, readonly, nullable) RNSBottomTabsScreenComponentView *tabScreenComponentView;
1118
@property (nonatomic, weak, readonly, nullable) id<RNSBottomTabsSpecialEffectsSupporting> tabsSpecialEffectsDelegate;

ios/bottom-tabs/RNSTabsScreenViewController.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ - (bool)tabScreenSelectedRepeatedly
107107
return false;
108108
}
109109

110+
#if !TARGET_OS_TV
111+
110112
- (RNSOrientation)evaluateOrientation
111113
{
112114
if ([self.childViewControllers.lastObject respondsToSelector:@selector(evaluateOrientation)]) {
@@ -121,4 +123,6 @@ - (RNSOrientation)evaluateOrientation
121123
return self.tabScreenComponentView.orientation;
122124
}
123125

126+
#endif // !TARGET_OS_TV
127+
124128
@end

0 commit comments

Comments
 (0)