Skip to content

Commit 7de2198

Browse files
committed
Document useBottomTabBarHeight
1 parent 3a6de26 commit 7de2198

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

versioned_docs/version-5.x/bottom-tab-navigator.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,39 @@ Takes an object containing following optional properties:
237237

238238
##### `style`
239239

240-
Style object for the tab bar.
240+
Style object for the tab bar. You can configure styles such as background color here.
241+
242+
To show your screen under the tab bar, you can set the `position` style to absolute:
243+
244+
```js
245+
style: { position: 'absolute' }
246+
```
247+
248+
You also might need to add a bottom margin to your content if you have a absolutely positioned tab bar. React Navigation won't do it automatically.
249+
250+
To get the height of the bottom tab bar, you can use `BottomTabBarHeightContext` with [React's Context API](https://reactjs.org/docs/context.html#contextconsumer) or `useBottomTabBarHeight`:
251+
252+
```js
253+
import { BottomTabBarHeightContext } from '@react-navigation/bottom-tabs';
254+
255+
// ...
256+
257+
<BottomTabBarHeightContext.Consumer>
258+
{tabBarHeight => (
259+
/* render something */
260+
)}
261+
</BottomTabBarHeightContext.Consumer>
262+
```
263+
264+
or
265+
266+
```js
267+
import { useBottomTabBarHeight } from '@react-navigation/bottom-tabs';
268+
269+
// ...
270+
271+
const tabBarHeight = useBottomTabBarHeight();
272+
```
241273

242274
### Options
243275

0 commit comments

Comments
 (0)