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.
3 Replies
correct-apricot•9mo ago
I couldn't tell since the stack trace isn't from Query.
broad-brown•9mo ago
Hello, @TkDodo 🔮
How are you?
wise-whiteOP•9mo ago
@TkDodo 🔮 thank you for responding. Generally will there be any relation between useQuery and NavigationContainer?
or any trace or something that you are looking for so that ill try to provide the same.
@TkDodo 🔮 Could you please help me on this thank you.