Skip to content

Commit eb1c4c1

Browse files
sbuggaymeta-codesync[bot]
authored andcommitted
Compile out UIInterfaceOrientation (#54997)
Summary: Pull Request resolved: #54997 UIInterfaceOrientation is unsupported on AppleTV. Changelog: [Internal] Reviewed By: Abbondanzo Differential Revision: D89899900 fbshipit-source-id: 4c960f8c2e5b5cff8965d5a268613f6fbb639876
1 parent fef5b84 commit eb1c4c1

5 files changed

Lines changed: 16 additions & 0 deletions

File tree

packages/react-native/React/Base/RCTConvert.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ typedef NSURL RCTFileURL;
7979
+ (UIKeyboardAppearance)UIKeyboardAppearance:(id)json;
8080
+ (UIReturnKeyType)UIReturnKeyType:(id)json;
8181
+ (UIUserInterfaceStyle)UIUserInterfaceStyle:(id)json API_AVAILABLE(ios(12));
82+
#if !TARGET_OS_TV
8283
+ (UIInterfaceOrientationMask)UIInterfaceOrientationMask:(NSString *)orientation;
84+
#endif
8385
+ (UIModalPresentationStyle)UIModalPresentationStyle:(id)json;
8486

8587
#if !TARGET_OS_TV

packages/react-native/React/Base/RCTConvert.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC
499499
UIUserInterfaceStyleUnspecified,
500500
integerValue)
501501

502+
#if !TARGET_OS_TV
502503
RCT_ENUM_CONVERTER(
503504
UIInterfaceOrientationMask,
504505
(@{
@@ -510,6 +511,7 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC
510511
}),
511512
NSNotFound,
512513
unsignedIntegerValue)
514+
#endif
513515

514516
RCT_ENUM_CONVERTER(
515517
UIModalPresentationStyle,

packages/react-native/React/Views/RCTModalHostView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ __attribute__((deprecated("This API will be removed along with the legacy archit
3838

3939
@property (nonatomic, weak) id<RCTModalHostViewInteractor> delegate;
4040

41+
#if !TARGET_OS_TV
4142
@property (nonatomic, copy) NSArray<NSString *> *supportedOrientations;
4243
@property (nonatomic, copy) RCTDirectEventBlock onOrientationChange;
44+
#endif
4345

4446
// Fabric only
4547
@property (nonatomic, copy) RCTDirectEventBlock onDismiss;

packages/react-native/React/Views/RCTModalHostView.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ @implementation RCTModalHostView {
2525
RCTModalHostViewController *_modalViewController;
2626
RCTTouchHandler *_touchHandler;
2727
UIView *_reactSubview;
28+
#if !TARGET_OS_TV
2829
UIInterfaceOrientation _lastKnownOrientation;
30+
#endif
2931
RCTDirectEventBlock _onRequestClose;
3032
}
3133

@@ -90,6 +92,7 @@ - (void)presentationControllerDidDismiss:(UIPresentationController *)presentatio
9092

9193
- (void)notifyForOrientationChange
9294
{
95+
#if !TARGET_OS_TV
9396
if (!_onOrientationChange) {
9497
return;
9598
}
@@ -106,6 +109,7 @@ - (void)notifyForOrientationChange
106109
@"orientation" : isPortrait ? @"portrait" : @"landscape",
107110
};
108111
_onOrientationChange(eventPayload);
112+
#endif
109113
}
110114

111115
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex
@@ -191,7 +195,9 @@ - (void)ensurePresentedOnlyIfNeeded
191195
if (shouldBePresented) {
192196
RCTAssert(self.reactViewController, @"Can't present modal view controller without a presenting view controller");
193197

198+
#if !TARGET_OS_TV
194199
_modalViewController.supportedInterfaceOrientations = [self supportedOrientationsMask];
200+
#endif
195201

196202
if ([self.animationType isEqualToString:@"fade"]) {
197203
_modalViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
@@ -224,6 +230,7 @@ - (void)setTransparent:(BOOL)transparent
224230
transparent ? UIModalPresentationOverFullScreen : UIModalPresentationFullScreen;
225231
}
226232

233+
#if !TARGET_OS_TV
227234
- (UIInterfaceOrientationMask)supportedOrientationsMask
228235
{
229236
if (_supportedOrientations.count == 0) {
@@ -250,6 +257,7 @@ - (UIInterfaceOrientationMask)supportedOrientationsMask
250257
}
251258
return supportedOrientations;
252259
}
260+
#endif
253261

254262
@end
255263

packages/react-native/React/Views/RCTModalHostViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ __attribute__((deprecated("This API will be removed along with the legacy archit
1414

1515
@property (nonatomic, copy) void (^boundsDidChangeBlock)(CGRect newBounds);
1616

17+
#if !TARGET_OS_TV
1718
@property (nonatomic, assign) UIInterfaceOrientationMask supportedInterfaceOrientations;
19+
#endif
1820

1921
@end
2022

0 commit comments

Comments
 (0)