Skip to content

Commit b87d917

Browse files
committed
feat: add docs
1 parent bde5855 commit b87d917

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,38 @@ React.useEffect(() => {
265265
return unsubscribe;
266266
}, [navigation]);
267267
```
268+
269+
### Hooks
270+
271+
`useBottomTabBarHeight`
272+
273+
This hook returns the height of the bottom tab bar. This is useful when you want to place a component above the tab bar on iOS. It's not needed to offset the content of the screen as the navigator does it automatically.
274+
275+
```tsx
276+
import { useBottomTabBarHeight } from 'react-native-bottom-tabs';
277+
278+
function MyComponent() {
279+
const tabBarHeight = useBottomTabBarHeight();
280+
281+
return (
282+
<ScrollView>
283+
{/* Content */}
284+
<View style={{ bottom: tabBarHeight }} />
285+
</ScrollView>
286+
);
287+
}
288+
```
289+
290+
Alternatively, you can use the `BottomTabBarHeightContext` directly if you are using a class component or need it in a reusable component that can be used outside the bottom tab navigator:
291+
292+
```tsx
293+
import { BottomTabBarHeightContext } from 'react-native-bottom-tabs';
294+
295+
// ...
296+
297+
<BottomTabBarHeightContext.Consumer>
298+
{tabBarHeight => (
299+
/* render something */
300+
)}
301+
</BottomTabBarHeightContext.Consumer>
302+
```

0 commit comments

Comments
 (0)