Registry / http-networking / react-native-react-query-devtools

react-native-react-query-devtools

JSON →
library1.5.1jsnpmunverified

The `react-native-react-query-devtools` package provides a dedicated debugging interface for applications utilizing TanStack React Query within a React Native environment. It offers functionalities analogous to its web counterpart, including an online/offline network toggle, comprehensive cache management for clearing queries and mutations, and a movable, resizable modal interface. The package aims to enhance the debugging experience on mobile platforms with a modern UI, improved query and mutation inspectors, and a copy-to-clipboard feature (which requires a platform-specific `onCopy` implementation). While the current npm metadata indicates version 1.5.1, recent changelogs from `@buoy-gg` (potentially a related project or monorepo by the same author) show versions up to 2.1.10, suggesting ongoing, active development, though the direct versioning for this specific package is ambiguous. Its key differentiator is adapting the well-known React Query Dev Tools experience specifically for React Native, addressing mobile-specific interaction patterns and environmental requirements.

npm install react-native-react-query-devtools
INSTALL
IMPORT
SIG · REACT-NATIVE-REACT
R
react-native-react-query-devtools
http-networkingjavascriptv1.5.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DevToolsBubble
import { DevToolsBubble } from 'react-native-react-query-devtools';
import DevToolsBubble from 'react-native-react-query-devtools';
DevToolsBubble is a named export, not a default export.
QueryClientProvider
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
Required to provide the `QueryClient` instance to the DevToolsBubble component.
Clipboard
import * as Clipboard from 'expo-clipboard'; // For Expo // OR import { Clipboard } from 'react-native'; // For React Native CLI
The `onCopy` prop requires a platform-specific Clipboard API. Ensure you import and use the correct one for your environment.

This quickstart demonstrates how to integrate `DevToolsBubble` into a React Native application, providing a `QueryClient` and a platform-specific `onCopy` function for clipboard functionality. It assumes an Expo or React Native CLI setup with navigation.

import { DevToolsBubble } from "react-native-react-query-devtools"; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import React from 'react'; import { useColorScheme } from 'react-native'; import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'; // Assuming @react-navigation/native for theming, adjust as needed import { Stack } from 'expo-router'; // Assuming Expo Router, adjust as needed import * as Clipboard from 'expo-clipboard'; // For Expo; use 'react-native' for bare React Native CLI function RootLayoutNav() { const colorScheme = useColorScheme(); const queryClient = new QueryClient(); // Define your copy function based on your platform (Expo or React Native CLI) const onCopy = async (text: string) => { try { // For Expo: await Clipboard.setStringAsync(text); // OR for React Native CLI (uncomment and adjust if not using Expo): // await Clipboard.setString(text); return true; } catch (e) { console.error("Failed to copy to clipboard:", e); return false; } }; return ( <QueryClientProvider client={queryClient}> <ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}> {/* Your app's navigation stack or main components go here */} <Stack> <Stack.Screen name="(tabs)" options={{ headerShown: false }} /> <Stack.Screen name="modal" options={{ presentation: "modal" }} /> </Stack> </ThemeProvider> {/* DevToolsBubble should be placed outside the main app views to float on top */} <DevToolsBubble onCopy={onCopy} queryClient={queryClient} /> </QueryClientProvider> ); } export default RootLayoutNav;
Debug
Known issues
breakingThe README explicitly states prerequisites of React version 19.1.0 or above and React Native 0.78.0 or above (for React 19 support). This can be more restrictive than the peer dependency range `^18 || ^19` for React, potentially breaking applications on older React versions.
fix
Ensure your project uses React 19.1.0+ and React Native 0.78.0+ for full compatibility, especially if you are using React 19.
affects: >=1.0.0
gotchaThe `react-native-svg` package is a mandatory peer dependency. Failure to install and link it correctly will result in runtime errors related to UI rendering within the dev tools.
fix
Install `react-native-svg` via `npm install react-native-svg` or `yarn add react-native-svg` and follow its installation instructions, particularly for bare React Native projects requiring native module linking.
affects: >=1.0.0
gotchaThe `onCopy` prop is required by `DevToolsBubble` and must provide a function that handles copying text to the clipboard using a platform-specific API (e.g., `expo-clipboard` for Expo or `react-native/Libraries/Components/Clipboard/Clipboard` for React Native CLI). Omitting or incorrectly implementing this prop will disable copy functionality and may cause errors.
fix
Provide a correct `onCopy` function that utilizes either `Clipboard.setStringAsync` (Expo) or `Clipboard.setString` (React Native CLI), ensuring the respective clipboard module is imported and available.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `RootLayoutNav`.
This error often occurs if `react-native-svg` is not installed or properly linked, as `DevToolsBubble` relies on it for its internal components.
fix
Ensure `react-native-svg` is installed (`npm install react-native-svg`) and, for bare React Native projects, native modules are linked (`npx react-native autolink-android-app` and `cd ios && pod install`).
TypeError: Cannot read property 'setStringAsync' of undefined
The `onCopy` function attempts to use `Clipboard.setStringAsync` (for Expo) but `expo-clipboard` is not installed or imported correctly.
fix
For Expo, install `expo-clipboard` (`npx expo install expo-clipboard`) and import it as `import * as Clipboard from 'expo-clipboard';`. For React Native CLI, ensure `import { Clipboard } from 'react-native';` and use `Clipboard.setString(text)`.
Invariant Violation: `DevToolsBubble` uses `QueryClient` context but no `QueryClientProvider` was found. Did you forget to add `QueryClientProvider` to your app?
`DevToolsBubble` is rendered without being wrapped by a `QueryClientProvider` from `@tanstack/react-query`, which is necessary to provide the `QueryClient` instance.
fix
Ensure `DevToolsBubble` is a child of `QueryClientProvider` and that `QueryClientProvider` is initialized with a `new QueryClient()` instance, as shown in the quickstart.
Upgrade
Version history
1.5.1latest on npm
Audit
Dependencies
@tanstack/react-queryrequiredCore state management library that the dev tools inspect.
reactrequiredReact framework is required for all React Native applications.
react-nativerequiredCore React Native framework.
react-native-svgrequiredRequired for rendering UI elements within the dev tools.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
2
Resources
react-native-react-query-devtools — npm install react-native-react-query-devtools · libregistry