@react-navigation/bottom-tabs#useBottomTabBarHeight TypeScript Examples
The following examples show how to use
@react-navigation/bottom-tabs#useBottomTabBarHeight.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: useKeyboardHeight.ts From jellyfin-audio-player with MIT License | 6 votes |
useKeyboardHeight = () => {
const keyboardHeight = useRef(new Animated.Value(0)).current;
const tabBarHeight = useBottomTabBarHeight();
useEffect(() => {
const keyboardWillShow = (e: KeyboardEvent) => {
Animated.timing(keyboardHeight, {
duration: e.duration,
toValue: tabBarHeight - e.endCoordinates.height,
useNativeDriver: true,
}).start();
};
const keyboardWillHide = (e: KeyboardEvent) => {
Animated.timing(keyboardHeight, {
duration: e.duration,
toValue: 0,
useNativeDriver: true,
}).start();
};
const keyboardWillShowSub = Keyboard.addListener(
'keyboardWillShow',
keyboardWillShow
);
const keyboardWillHideSub = Keyboard.addListener(
'keyboardWillHide',
keyboardWillHide
);
return () => {
keyboardWillHideSub.remove();
keyboardWillShowSub.remove();
};
}, [keyboardHeight, tabBarHeight]);
return keyboardHeight;
}