Skip to content

Commit 3c29ee5

Browse files
authored
docs: add custom tab bars documentation, update how is it different (#280)
1 parent 196ea22 commit 3c29ee5

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

docs/docs/docs/getting-started/how-is-it-different.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ SwiftUI's TabView offer built-in smooth animations between tabs.
4949

5050
Using one prop you can add haptic feedback support to your tab bar on both Android and iOS. This can significantly enhance users experience.
5151

52+
### Picture In Picture avoidance
53+
54+
When picture in picture popup is shown system will automatically avoid tabs from being covered by it.
55+
56+
<video controls width="100%" src='https://github.com/user-attachments/assets/061ed6bc-39ea-4ee0-820f-981a9af9a203' />
57+
5258
## When to use JS Bottom Tabs
5359

5460
Using native components enforce certain constraints that we need to adapt to.

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,38 @@ Supported properties:
172172
- `fontSize`
173173
- `fontWeight`
174174

175+
#### `tabBar`
176+
177+
Function that returns a React element to display as the tab bar.
178+
179+
The function receives an object containing the following properties as the argument:
180+
181+
- `state` - The state object for the tab navigator.
182+
- `descriptors` - The descriptors object containing options for the tab navigator.
183+
- `navigation` - The navigation object for the tab navigator.
184+
185+
The state.routes array contains all the routes defined in the navigator. Each route's options can be accessed using `descriptors[route.key].options`.
186+
187+
Example:
188+
189+
```tsx
190+
function MyTabBar({ state, descriptors, navigation }) {
191+
// Render your tab bar here
192+
}
193+
194+
function MyTabs() {
195+
return (
196+
<Tab.Navigator
197+
tabBar={(props) => <MyTabBar {...props} />}
198+
>
199+
<Tab.Screen name="Home" component={HomeScreen} />
200+
<Tab.Screen name="Profile" component={ProfileScreen} />
201+
</Tab.Navigator>
202+
);
203+
}
204+
```
205+
206+
175207
### Options
176208

177209
The following options can be used to configure the screens in the navigator. These can be specified under `screenOptions` prop of `Tab.navigator` or `options` prop of `Tab.Screen`.

0 commit comments

Comments
 (0)