import { IonTabBar } from "@ionic/react"; import { forwardRef, useRef } from "react"; import PostsTabButton from "./tabs/buttons/PostsTabButton"; import InboxTabButton from "./tabs/buttons/InboxTabButton"; import ProfileTabButton from "./tabs/buttons/ProfileTabButton"; import SearchTabButton from "./tabs/buttons/SearchTabButton"; import SettingsTabButton from "./tabs/buttons/SettingsTabButton"; import { styled } from "@linaria/react"; const StyledIonTabBar = styled(IonTabBar)` @media (orientation: landscape) and (max-height: 450px) { height: 36px; ion-badge { inset-inline-start: calc(70% + 6px); &.md { inset-inline-start: calc(75% + 6px); } } ion-tab-button { flex-direction: row; > ion-label { margin-bottom: 0; } > ion-icon { font-size: 22px !important; margin-right: 5px; } } } `; type CustomTabBarType = typeof IonTabBar & { /** * Signal to Ionic that this is a tab bar component */ isTabBar?: boolean; }; const TabBar: CustomTabBarType = forwardRef(function TabBar(props, ref) { const longPressedRef = useRef(false); const resetLongPress = () => { longPressedRef.current = false; }; const sharedTabProps = { longPressedRef, }; return ( { // stop keyboard closing when search input has text on search tab press up if (longPressedRef.current) e.preventDefault(); }} > ); }); TabBar.isTabBar = true; export default TabBar;