Skip to content

Commit 50c6ad7

Browse files
committed
paper support
1 parent c0a1608 commit 50c6ad7

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

ios/bottom-tabs/RCTConvert+RNSBottomTabs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
1111

1212
+ (RNSBottomTabsIconType)RNSBottomTabsIconType:(nonnull id)json;
1313

14+
+ (RNSOrientation)RNSOrientation:(nonnull id)json;
15+
1416
@end
1517

1618
NS_ASSUME_NONNULL_END

ios/bottom-tabs/RCTConvert+RNSBottomTabs.mm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ + (UIOffset)UIOffset:(id)json;
3030
RNSTabBarMinimizeBehaviorAutomatic,
3131
integerValue)
3232

33+
RCT_ENUM_CONVERTER(
34+
RNSOrientation,
35+
(@{
36+
@"inherit" : @(RNSOrientationInherit),
37+
@"all" : @(RNSOrientationAll),
38+
@"allButUpsideDown" : @(RNSOrientationAllButUpsideDown),
39+
@"portrait" : @(RNSOrientationPortrait),
40+
@"portraitUpsideDown" : @(RNSOrientationPortraitUpsideDown),
41+
@"landscape" : @(RNSOrientationLandscape),
42+
@"landscapeLeft" : @(RNSOrientationLandscapeLeft),
43+
@"landscapeRight" : @(RNSOrientationLandscapeRight),
44+
}),
45+
RNSOrientationInherit,
46+
integerValue)
47+
3348
@end
3449

3550
#endif // !RCT_NEW_ARCH_ENABLED

ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ @implementation RNSBottomTabsScreenComponentView {
3030
BOOL _isOverrideScrollViewContentInsetAdjustmentBehaviorSet;
3131
#if !RCT_NEW_ARCH_ENABLED
3232
BOOL _tabItemNeedsAppearanceUpdate;
33+
BOOL _tabScreenOrientationNeedsUpdate;
3334
#endif // !RCT_NEW_ARCH_ENABLED
3435
}
3536

@@ -56,6 +57,7 @@ - (void)initState
5657

5758
#if !RCT_NEW_ARCH_ENABLED
5859
_tabItemNeedsAppearanceUpdate = NO;
60+
_tabScreenOrientationNeedsUpdate = NO;
5961
#endif
6062

6163
// This is a temporary workaround to avoid UIScrollEdgeEffect glitch
@@ -297,7 +299,7 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
297299
if (tabItemNeedsAppearanceUpdate) {
298300
[_controller tabItemAppearanceHasChanged];
299301
}
300-
302+
301303
if (tabScreenOrientationNeedsUpdate) {
302304
[_controller tabScreenOrientationHasChanged];
303305
}
@@ -364,6 +366,11 @@ - (void)didSetProps:(NSArray<NSString *> *)changedProps
364366
[_controller tabItemAppearanceHasChanged];
365367
_tabItemNeedsAppearanceUpdate = NO;
366368
}
369+
370+
if (_tabScreenOrientationNeedsUpdate) {
371+
[_controller tabScreenOrientationHasChanged];
372+
_tabScreenOrientationNeedsUpdate = NO;
373+
}
367374
}
368375

369376
#pragma mark - LEGACY prop setters
@@ -491,6 +498,12 @@ - (void)setOverrideScrollViewContentInsetAdjustmentBehavior:(BOOL)overrideScroll
491498
// when the prop is undefined in JS and default value is used instead of calling this setter.
492499
}
493500

501+
- (void)setOrientation:(RNSOrientation)orientation
502+
{
503+
_orientation = orientation;
504+
_tabItemNeedsAppearanceUpdate = YES;
505+
}
506+
494507
- (void)setOnWillAppear:(RCTDirectEventBlock)onWillAppear
495508
{
496509
[self.reactEventEmitter setOnWillAppear:onWillAppear];

ios/bottom-tabs/RNSBottomTabsScreenComponentViewManager.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ - (UIView *)view
2121

2222
RCT_REMAP_VIEW_PROPERTY(isFocused, isSelectedScreen, BOOL);
2323
RCT_EXPORT_VIEW_PROPERTY(title, NSString);
24+
RCT_EXPORT_VIEW_PROPERTY(orientation, RNSOrientation);
2425
RCT_EXPORT_VIEW_PROPERTY(badgeValue, NSString);
2526
RCT_EXPORT_VIEW_PROPERTY(tabBarBackgroundColor, UIColor);
2627
RCT_EXPORT_VIEW_PROPERTY(tabBarBlurEffect, RNSBlurEffectStyle);

ios/bottom-tabs/RNSTabBarController.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ - (void)setNeedsUpdateOfTabBarAppearance:(bool)needsUpdateOfTabBarAppearance
7474
- (void)setNeedsOrientationUpdate:(bool)needsOrientationUpdate
7575
{
7676
_needsOrientationUpdate = needsOrientationUpdate;
77+
#if !RCT_NEW_ARCH_ENABLED
78+
[self scheduleControllerUpdateIfNeeded];
79+
#endif // !RCT_NEW_ARCH_ENABLED
80+
7781
}
7882

7983
#pragma mark-- RNSReactTransactionObserving

0 commit comments

Comments
 (0)