React Query Dev Tools The same tool you know and love! Now available for React Native with enhanced features and modern UI!
To integrate React Query Dev Tools into your React Native project, follow these simple installation steps. Open your terminal, navigate to your project directory, and execute:
npm install react-native-react-query-devtools
This command adds the react-native-react-query-devtools package to your project dependencies, making the Dev Tools available for use.
Incorporating React Query Dev Tools into your application is straightforward. Begin by importing the DevToolsBubble component.
import { DevToolsBubble } from "react-native-react-query-devtools";
Next, integrate the DevToolsBubble component into your app. To enable object copying functionality, you must provide a custom copy function that works with your platform (Expo or React Native CLI).
function RootLayoutNav() { const colorScheme = useColorScheme(); const queryClient = new QueryClient(); // Define your copy function based on your platform const onCopy = async (text: string) => { try { // For Expo: await Clipboard.setStringAsync(text); // OR for React Native CLI: // await Clipboard.setString(text); return true; } catch { return false; } }; return ( <QueryClientProvider client={queryClient}> <ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}> <Stack> <Stack.Screen name="(tabs)" options={{ headerShown: false }} /> <Stack.Screen name="modal" options={{ presentation: "modal" }} /> </Stack> </ThemeProvider> <DevToolsBubble onCopy={onCopy} queryClient={queryClient} /> </QueryClientProvider> ); }
The onCopy
prop is required to enable copying functionality in the dev tools. This function should:
Example implementations:
For Expo:
import * as Clipboard from "expo-clipboard"; const onCopy = async (text: string) => { try { await Clipboard.setStringAsync(text); return true; } catch { return false; } };
For React Native CLI:
import Clipboard from "@react-native-clipboard/clipboard"; const onCopy = async (text: string) => { try { await Clipboard.setString(text); return true; } catch { return false; } };🔧 Advanced Configuration
The DevToolsBubble component accepts additional props for customization:
interface DevToolsBubbleProps { queryClient: QueryClient; // Required: The QueryClient instance to use onCopy: (text: string) => Promise<boolean>; // Optional: Callback when selection state changes onSelectionChange?: (hasSelection: boolean) => void; // Optional: Custom pan responder for advanced gesture handling panResponder?: PanResponderInstance; }
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please open an issue on GitHub.
Take a shortcut from web developer to mobile development fluency with guided learning
Enjoyed this project? Learn to use React Native to build production-ready, native mobile apps for both iOS and Android based on your existing web development skills.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4