TanStackT
TanStack14mo ago
6 replies
hurt-tomato

isLoading relation with React native navigation context

Hi Guys, need your help on this one.

Issue: when using query.isLoading in one of components during the initial load and on hot reload im getting the below error:
"Couldn't register the navigator. Have you wrapped your app with 'NavigationContainer'?"

Versions:
"expo": "~51.0.28",
"@react-navigation/native": "^6.0.2",
"@tanstack/react-query": "^5.59.15",

import { useQuery } from "@tanstack/react-query"; import { getAppointments } from "../api/api"; export const useGetAppointments = () => { return useQuery({ queryKey: ["getAppointments"], queryFn: getAppointments, retry: 3, retryDelay: 3000 }) };

export default function UpcomingAppointments() { const getAppointmentsQuery = useGetAppointments(); .... return ( {getAppointmentsQuery.isLoading || loading ? ( <ActivityIndicator size={"large"} color={theme.colors.primary} /> ) : ( mainComponent() )});

if i remove "getAppointmentsQuery.isLoading" im not getting any errors. Could you please help me regarding this.

thanks in advance.
Screenshot_1733077593.png
Was this page helpful?