Skip to content

Commit

Permalink
chore: export BottomTabBarHeightCallbackContext (#10617)
Browse files Browse the repository at this point in the history
**Motivation**

Custom TabBarView required this to provide the correct height.

```tsx
import { useCallback, useContext } from 'react';
import {
  createBottomTabNavigator,
  BottomTabBarHeightCallbackContext, // this is required.
} from '@react-navigation/bottom-tabs';

const Tab = createBottomTabNavigator();

const BottomTabBar = () => {
  const reportHeight = useContext(BottomTabBarHeightCallbackContext);

  const handleLayout = useCallback(e => reportHeight(e.nativeEvent.layout.height), [reportHeight]);

  return (
    <View onLayout={handleLayout}>
      {/* ... */}
    </View>
  );
};

const App = (
  <Tab.Navigator tabBar={BottomTabBar}>
    {/* ... */}
  </Tab.Navigator>
);
```
  • Loading branch information
jinliming2 authored and satya164 committed Nov 27, 2022
1 parent b6403fd commit 35036a8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/bottom-tabs/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export { default as BottomTabView } from './views/BottomTabView';
/**
* Utilities
*/
export { default as BottomTabBarHeightCallbackContext } from './utils/BottomTabBarHeightCallbackContext';
export { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';

Expand Down

0 comments on commit 35036a8

Please sign in to comment.