import { create } from 'zustand'; interface AppStore { hideTabsNav: Record; setHideTabsNavKey: (key: string, hide: boolean) => void; } export const useAppStore = create((set) => ({ hideTabsNav: {}, // Writing the value a key already has would still allocate a new map and // wake every subscriber (the tab navigator included), so bail out instead. setHideTabsNavKey: (key: string, hide: boolean) => set((state) => state.hideTabsNav[key] === hide ? state : { hideTabsNav: { ...state.hideTabsNav, [key]: hide } } ), }));