Skip to content

Commit eb82887

Browse files
committed
feat!: remove ignoresTopSafeArea
1 parent 3edc401 commit eb82887

14 files changed

+9
-62
lines changed

.changeset/twelve-rules-study.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-bottom-tabs': minor
3+
---
4+
5+
feat!: remove ignoresTopSafeArea prop, safe area handling is now automatic

apps/example/src/App.tsx

-10
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ import NativeBottomTabsUnmounting from './Examples/NativeBottomTabsUnmounting';
3131
import NativeBottomTabsCustomTabBar from './Examples/NativeBottomTabsCustomTabBar';
3232
import NativeBottomTabsFreezeOnBlur from './Examples/NativeBottomTabsFreezeOnBlur';
3333

34-
const FourTabsIgnoreSafeArea = () => {
35-
return <FourTabs ignoresTopSafeArea />;
36-
};
37-
3834
const HiddenTab = () => {
3935
return <FourTabs hideOneTab />;
4036
};
@@ -89,12 +85,6 @@ const examples = [
8985
name: 'Embedded stacks',
9086
screenOptions: { headerShown: false },
9187
},
92-
{
93-
component: FourTabsIgnoreSafeArea,
94-
name: 'Four Tabs - No header',
95-
platform: 'ios',
96-
screenOptions: { headerShown: false },
97-
},
9888
{
9989
component: FourTabsRippleColor,
10090
name: 'Four Tabs with ripple Color',

apps/example/src/Examples/FourTabs.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Chat } from '../Screens/Chat';
77
import type { ColorValue } from 'react-native';
88

99
interface Props {
10-
ignoresTopSafeArea?: boolean;
1110
disablePageAnimations?: boolean;
1211
scrollEdgeAppearance?: 'default' | 'opaque' | 'transparent';
1312
backgroundColor?: ColorValue;
@@ -18,7 +17,6 @@ interface Props {
1817
}
1918

2019
export default function FourTabs({
21-
ignoresTopSafeArea = false,
2220
disablePageAnimations = false,
2321
scrollEdgeAppearance = 'default',
2422
backgroundColor,
@@ -64,7 +62,6 @@ export default function FourTabs({
6462

6563
return (
6664
<TabView
67-
ignoresTopSafeArea={ignoresTopSafeArea}
6865
sidebarAdaptable
6966
disablePageAnimations={disablePageAnimations}
7067
scrollEdgeAppearance={scrollEdgeAppearance}

docs/docs/docs/guides/standalone-usage.md

-5
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ A tab bar style that adapts to each platform:
118118
- macOS/tvOS: Sidebar
119119
- visionOS: Ornament with sidebar for secondary tabs
120120

121-
#### `ignoresTopSafeArea` <Badge text="iOS" type="info" />
122-
123-
Whether to ignore the top safe area.
124-
- Type: `boolean`
125-
126121
#### `disablePageAnimations` <Badge text="iOS" type="info" />
127122

128123
Whether to disable animations between tabs.

docs/docs/docs/guides/usage-with-react-navigation.mdx

-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ Optional unique ID for the navigator. This can be used with `navigation.getParen
7373

7474
The name of the route to render on first load of the navigator.
7575

76-
#### `ignoresTopSafeArea` <Badge text="iOS" type="info" />
77-
78-
Whether to ignore the top safe area. Defaults to `true`.
79-
8076
#### `screenOptions`
8177

8278
Default options to use for the screens in the navigator.

docs/docs/docs/guides/usage-with-vector-icons.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Tabs = createNativeBottomTabNavigator();
2121

2222
function NativeBottomTabs() {
2323
return (
24-
<Tabs.Navigator ignoresTopSafeArea>
24+
<Tabs.Navigator>
2525
<Tabs.Screen
2626
name="Home"
2727
component={HomeScreen}

packages/react-native-bottom-tabs/android/src/oldarch/RCTTabViewManager.kt

-4
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ class RCTTabViewManager(context: ReactApplicationContext) : ViewGroupManager<Rea
137137
fun setSidebarAdaptable(view: ReactBottomNavigationView, flag: Boolean) {
138138
}
139139

140-
@ReactProp(name = "ignoresTopSafeArea")
141-
fun setIgnoresTopSafeArea(view: ReactBottomNavigationView, flag: Boolean) {
142-
}
143-
144140
@ReactProp(name = "hapticFeedbackEnabled")
145141
fun setHapticFeedbackEnabled(view: ReactBottomNavigationView, value: Boolean) {
146142
tabViewImpl.setHapticFeedbackEnabled(view, value)

packages/react-native-bottom-tabs/ios/Fabric/RCTTabViewComponentView.mm

+1-5
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
119119
_tabViewProvider.labeled = newViewProps.labeled;
120120
}
121121

122-
if (oldViewProps.ignoresTopSafeArea != newViewProps.ignoresTopSafeArea) {
123-
_tabViewProvider.ignoresTopSafeArea = newViewProps.ignoresTopSafeArea;
124-
}
125-
126122
if (oldViewProps.selectedPage != newViewProps.selectedPage) {
127123
_tabViewProvider.selectedPage = RCTNSStringFromString(newViewProps.selectedPage);
128124
}
@@ -162,7 +158,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
162158
if (oldViewProps.fontFamily != newViewProps.fontFamily) {
163159
_tabViewProvider.fontFamily = RCTNSStringFromStringNilIfEmpty(newViewProps.fontFamily);
164160
}
165-
161+
166162
if (oldViewProps.tabBarHidden != newViewProps.tabBarHidden) {
167163
_tabViewProvider.tabBarHidden = newViewProps.tabBarHidden;
168164
}

packages/react-native-bottom-tabs/ios/RCTTabViewViewManager.mm

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ @implementation RCTTabView
3232
RCT_EXPORT_VIEW_PROPERTY(icons, NSArray<RCTImageSource *>);
3333
RCT_EXPORT_VIEW_PROPERTY(sidebarAdaptable, BOOL)
3434
RCT_EXPORT_VIEW_PROPERTY(labeled, BOOL)
35-
RCT_EXPORT_VIEW_PROPERTY(ignoresTopSafeArea, BOOL)
3635
RCT_EXPORT_VIEW_PROPERTY(disablePageAnimations, BOOL)
3736
RCT_EXPORT_VIEW_PROPERTY(scrollEdgeAppearance, NSString)
3837
RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL)

packages/react-native-bottom-tabs/ios/TabViewImpl.swift

+1-16
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ struct TabViewImpl: View {
8686
let icon = props.icons[index]
8787

8888
RepresentableView(view: child)
89-
.ignoresTopSafeArea(
90-
props.ignoresTopSafeArea
91-
)
89+
.ignoresSafeArea(.all, edges: .all)
9290
.tabItem {
9391
TabItem(
9492
title: tabData?.title,
@@ -290,19 +288,6 @@ extension View {
290288
}
291289
}
292290

293-
@ViewBuilder
294-
func ignoresTopSafeArea(
295-
_ flag: Bool
296-
) -> some View {
297-
if flag {
298-
self
299-
.ignoresSafeArea(.container, edges: .all)
300-
} else {
301-
self
302-
.ignoresSafeArea(.container, edges: .bottom)
303-
}
304-
}
305-
306291
#if !os(macOS)
307292
@ViewBuilder
308293
func configureAppearance(props: TabViewProps, tabBar: UITabBar?) -> some View {

packages/react-native-bottom-tabs/ios/TabViewProps.swift

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class TabViewProps: ObservableObject {
1515
@Published var activeTintColor: PlatformColor?
1616
@Published var inactiveTintColor: PlatformColor?
1717
@Published var translucent: Bool = true
18-
@Published var ignoresTopSafeArea: Bool = true
1918
@Published var disablePageAnimations: Bool = false
2019
@Published var hapticFeedbackEnabled: Bool = false
2120
@Published var fontSize: Int?

packages/react-native-bottom-tabs/ios/TabViewProvider.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ public final class TabInfo: NSObject {
8585
}
8686
}
8787

88-
@objc public var ignoresTopSafeArea: Bool = true {
89-
didSet {
90-
props.ignoresTopSafeArea = ignoresTopSafeArea
91-
}
92-
}
93-
9488
@objc public var selectedPage: NSString? {
9589
didSet {
9690
props.selectedPage = selectedPage as? String
@@ -156,7 +150,7 @@ public final class TabInfo: NSObject {
156150
props.fontSize = fontSize as? Int
157151
}
158152
}
159-
153+
160154
@objc public var tabBarHidden: Bool = false {
161155
didSet {
162156
props.tabBarHidden = tabBarHidden

packages/react-native-bottom-tabs/src/TabView.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ interface Props<Route extends BaseRoute> {
3636
* - visionOS shows an ornament and also shows a sidebar for secondary tabs within a `TabSection`.
3737
*/
3838
sidebarAdaptable?: boolean;
39-
/**
40-
* Whether to ignore the top safe area. (iOS only)
41-
*/
42-
ignoresTopSafeArea?: boolean;
4339
/**
4440
* Whether to disable page animations between tabs. (iOS only) Defaults to `false`.
4541
*/

packages/react-native-bottom-tabs/src/TabViewNativeComponent.ts

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export interface TabViewProps extends ViewProps {
4949
rippleColor?: ColorValue;
5050
activeTintColor?: ColorValue;
5151
inactiveTintColor?: ColorValue;
52-
ignoresTopSafeArea?: WithDefault<boolean, true>;
5352
disablePageAnimations?: boolean;
5453
activeIndicatorColor?: ColorValue;
5554
hapticFeedbackEnabled?: boolean;

0 commit comments

Comments
 (0)