Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ class TabsHostViewManager :
value: String?,
) = Unit

override fun setTabBarHidden(
view: TabsHost,
value: Boolean,
) = Unit

// Android additional

@ReactProp(name = "tabBarItemTitleFontColorActive", customType = "Color")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public void setProperty(T view, String propName, @Nullable Object value) {
case "tabBarControllerMode":
mViewManager.setTabBarControllerMode(view, (String) value);
break;
case "tabBarHidden":
mViewManager.setTabBarHidden(view, value == null ? false : (boolean) value);
break;
case "controlNavigationStateInJS":
mViewManager.setControlNavigationStateInJS(view, value == null ? false : (boolean) value);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ public interface RNSBottomTabsManagerInterface<T extends View> {
void setTabBarTintColor(T view, @Nullable Integer value);
void setTabBarMinimizeBehavior(T view, @Nullable String value);
void setTabBarControllerMode(T view, @Nullable String value);
void setTabBarHidden(T view, boolean value);
void setControlNavigationStateInJS(T view, boolean value);
}
2 changes: 2 additions & 0 deletions ios/bottom-tabs/RNSBottomTabsHostComponentView.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, strong, readonly, nullable) UIColor *tabBarTintColor;

@property (nonatomic, readonly) BOOL tabBarHidden;

@property (nonatomic, readonly) BOOL experimental_controlNavigationStateInJS;

#if RNS_IPHONE_OS_VERSION_AVAILABLE(26_0)
Expand Down
25 changes: 25 additions & 0 deletions ios/bottom-tabs/RNSBottomTabsHostComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
_tabBarTintColor = RCTUIColorFromSharedColor(newComponentProps.tabBarTintColor);
}

if (newComponentProps.tabBarHidden != oldComponentProps.tabBarHidden) {
_tabBarHidden = newComponentProps.tabBarHidden;
#if RNS_IPHONE_OS_VERSION_AVAILABLE(18_0)
if (@available(iOS 18.0, *)) {
[_controller setTabBarHidden:_tabBarHidden animated:NO];
} else
#endif // RNS_IPHONE_OS_VERSION_AVAILABLE(18_0)
{
_controller.tabBar.hidden = _tabBarHidden;
}
}

if (newComponentProps.tabBarMinimizeBehavior != oldComponentProps.tabBarMinimizeBehavior) {
#if RNS_IPHONE_OS_VERSION_AVAILABLE(26_0)
if (@available(iOS 26.0, *)) {
Expand Down Expand Up @@ -429,6 +441,19 @@ - (void)setTabBarTintColor:(UIColor *_Nullable)tabBarTintColor
[self invalidateTabBarAppearance];
}

- (void)setTabBarHidden:(BOOL)tabBarHidden
{
_tabBarHidden = tabBarHidden;
#if RNS_IPHONE_OS_VERSION_AVAILABLE(18_0)
if (@available(iOS 18.0, *)) {
[_controller setTabBarHidden:_tabBarHidden animated:NO];
} else
#endif // RNS_IPHONE_OS_VERSION_AVAILABLE(18_0)
{
_controller.tabBar.hidden = _tabBarHidden;
}
}

// This is a Paper-only setter method that will be called by the mounting code.
// It allows us to store UITabBarMinimizeBehavior in the component while accepting a custom enum as input from JS.
- (void)setTabBarMinimizeBehaviorFromRNSTabBarMinimizeBehavior:(RNSTabBarMinimizeBehavior)tabBarMinimizeBehavior
Expand Down
1 change: 1 addition & 0 deletions ios/bottom-tabs/RNSBottomTabsHostComponentViewManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ - (UIView *)view
#pragma mark - LEGACY Props

RCT_EXPORT_VIEW_PROPERTY(tabBarTintColor, UIColor);
RCT_EXPORT_VIEW_PROPERTY(tabBarHidden, BOOL);
// This remapping allows us to store UITabBarMinimizeBehavior in the component while accepting a custom enum as input
// from JS.
RCT_REMAP_VIEW_PROPERTY(
Expand Down
8 changes: 8 additions & 0 deletions src/components/bottom-tabs/BottomTabs.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ export interface BottomTabsProps extends ViewProps {
* @supported iOS 18 or higher
*/
tabBarControllerMode?: TabBarControllerMode;
/**
* @summary Hides the tab bar.
*
* @default false
*
* @platform ios
*/
tabBarHidden?: boolean;
// #endregion iOS-only appearance

// #region Experimental support
Expand Down
1 change: 1 addition & 0 deletions src/fabric/bottom-tabs/BottomTabsNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface NativeProps extends ViewProps {
tabBarTintColor?: ColorValue;
tabBarMinimizeBehavior?: WithDefault<TabBarMinimizeBehavior, 'automatic'>;
tabBarControllerMode?: WithDefault<TabBarControllerMode, 'automatic'>;
tabBarHidden?: WithDefault<boolean, false>;

// Control

Expand Down
Loading