taro-hooks
Version:
为 Taro 而设计的 Hooks Library
22 lines (21 loc) • 1.04 kB
TypeScript
import type { PromiseOptionalAction, PromiseWithoutOptionAction, ExcludeOption } from '../type';
export type SetNavigationBarTitleOption = ExcludeOption<Taro.setNavigationBarTitle.Option>;
export type SetNavigationBarColorOption = ExcludeOption<Taro.setNavigationBarColor.Option>;
export type ToggleNavigationBarLoadingOption = {
loading: boolean;
};
export type ToggleHomeButtonOption = {
hideButton: boolean;
};
export type NavigationBarOption = Partial<SetNavigationBarColorOption & SetNavigationBarTitleOption & ToggleNavigationBarLoadingOption & ToggleHomeButtonOption>;
export type SetTitle = PromiseOptionalAction<string>;
export type SetColor = PromiseOptionalAction<SetNavigationBarColorOption>;
export type ToggleLoading = PromiseOptionalAction<boolean>;
export type HideButton = PromiseWithoutOptionAction;
declare function useNavigationBar(option?: NavigationBarOption): {
setTitle: SetTitle;
setColor: SetColor;
toggleLoading: ToggleLoading;
hideButton: HideButton;
};
export default useNavigationBar;