Skip to content
Open
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
12 changes: 12 additions & 0 deletions src/components/BottomNavigation/BottomNavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export type Props<Route extends BaseRoute> = {
* Get label text for the tab, uses `route.title` by default. Use `renderLabel` to replace label component.
*/
getLabelText?: (props: { route: Route }) => string | undefined;
/**
* Get the height of the Bottom Tab. Useful for Custom Tab bars.
*/
getBottomTabHeight?: (height: number) => void;
/**
* Get the id to locate this tab button in tests, uses `route.testID` by default.
*/
Expand Down Expand Up @@ -366,6 +370,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
getColor = ({ route }: { route: Route }) => route.color,
getAccessibilityLabel = ({ route }: { route: Route }) =>
route.accessibilityLabel,
getBottomTabHeight,
getTestID = ({ route }: { route: Route }) => route.testID,
activeColor,
inactiveColor,
Expand Down Expand Up @@ -428,6 +433,13 @@ const BottomNavigationBar = <Route extends BaseRoute>({
*/
const [layout, onLayout] = useLayout();

/**
* Gets the height of the Bottom Tabs when using Custom Tab bar.
*/
React.useEffect(() => {
layout.measured && getBottomTabHeight?.(layout.height);
}, [layout.measured, getBottomTabHeight]);

/**
* Track whether the keyboard is visible to show and hide the navigation bar.
*/
Expand Down