UNPKG

@freakycoder/animated-tabbar

Version:

A 60FPS animated tab bar with a variety of cool animation presets.

29 lines (25 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useTabBarVisibility = void 0; var _react = require("react"); var _reactNativeReanimated = require("react-native-reanimated"); const useTabBarVisibility = shouldShowTabBar => { // Shared animated value for the tab bar visibility const position = (0, _reactNativeReanimated.useSharedValue)(shouldShowTabBar ? 1 : 0); // Effect hook to animate position when shouldShowTabBar changes (0, _react.useEffect)(() => { // Animate the position value to 1 or 0 with timing position.value = (0, _reactNativeReanimated.withTiming)(shouldShowTabBar ? 1 : 0, { duration: 250, easing: _reactNativeReanimated.Easing.linear }); }, [shouldShowTabBar, position]); // The animated style or value can be returned as needed // If you need to use the position value in a style, you can create a derived animated style // Otherwise, returning the position directly is also fine for logic-based operations return position; }; exports.useTabBarVisibility = useTabBarVisibility; //# sourceMappingURL=useTabBarVisibility.js.map