import { useNavigation } from '@react-navigation/native' import { NativeStackNavigationProp } from '@react-navigation/native-stack' import { useSelector } from 'react-redux' import { TypedUseSelectorHook, useDispatch } from 'react-redux' import { RootStackParamList } from '~/@types/navigation' import { AppDispatch, RootState } from '~/store' /* Add and export all hooks in this folder. Separate the ones inside the hooks folder, export them as default, import them here and then export them again. So that all imports are centered '~/hooks' */ export const useAppDispatch = () => useDispatch() export const useAppSelector: TypedUseSelectorHook = useSelector export const useAppNavigation = () => { const navigation = useNavigation>() if (navigation === undefined) { throw new Error( 'useAppNavigation must be used within a AppNavigationProvider', ) } return navigation }