Skip to content

Commit 6f180f8

Browse files
committed
fix build problems on tvOS
1 parent 300884d commit 6f180f8

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
@@ -1984,6 +1984,8 @@ - (void)presentViewController:(UIViewController *)viewControllerToPresent
19841984

19851985
#pragma mark - RNSOrientationProviding
19861986

1987+
#if !TARGET_OS_TV
1988+
19871989
- (RNSOrientation)evaluateOrientation
19881990
{
19891991
if ([self.childViewControllers.lastObject respondsToSelector:@selector(evaluateOrientation)]) {
@@ -1994,10 +1996,12 @@ - (RNSOrientation)evaluateOrientation
19941996
return childOrientation;
19951997
}
19961998
}
1997-
1999+
19982000
return rnscreens::conversion::RNSOrientationFromUIInterfaceOrientationMask([self supportedInterfaceOrientations]);
19992001
}
20002002

2003+
#endif // !TARGET_OS_TV
2004+
20012005
#ifdef RCT_NEW_ARCH_ENABLED
20022006
#pragma mark - Fabric specific
20032007

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
@@ -100,16 +100,20 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations
100100
return [self topViewController].supportedInterfaceOrientations;
101101
}
102102

103+
#if !TARGET_OS_TV
104+
103105
- (RNSOrientation)evaluateOrientation
104106
{
105107
if ([self.topViewController respondsToSelector:@selector(evaluateOrientation)]) {
106108
id<RNSOrientationProviding> top = static_cast<id<RNSOrientationProviding>>(self.topViewController);
107109
return [top evaluateOrientation];
108110
}
109-
111+
110112
return RNSOrientationInherit;
111113
}
112114

115+
#endif // !TARGET_OS_TV
116+
113117
- (UIViewController *)childViewControllerForHomeIndicatorAutoHidden
114118
{
115119
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)