Files
HKSingleParty/99_references/voyager-main/src/routes/tabs/buttons/SearchTabButton.tsx
2025-05-28 09:55:51 +08:00

35 lines
860 B
TypeScript

import { IonIcon, IonLabel } from "@ionic/react";
import SharedTabButton, { TabButtonProps } from "./shared";
import { search } from "ionicons/icons";
import { focusSearchBar } from "../../pages/search/SearchPage";
function SearchTabButton(props: TabButtonProps) {
return (
<SharedTabButton
{...props}
onBeforeBackAction={focusSearchBar}
onLongPressExtraAction={onLongPressExtraAction}
>
<IonIcon aria-hidden="true" icon={search} />
<IonLabel>Search</IonLabel>
</SharedTabButton>
);
}
function onLongPressExtraAction() {
requestAnimationFrame(() => {
requestAnimationFrame(() => {
requestAnimationFrame(() => {
focusSearchBar();
});
});
});
}
/**
* Signal to Ionic that this is a tab bar button component
*/
SearchTabButton.isTabButton = true;
export default SearchTabButton;