
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
react-native-react-query-devtools
Advanced tools
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;
}
};
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.
FAQs
React Query Dev Tools for React Native
The npm package react-native-react-query-devtools receives a total of 8,230 weekly downloads. As such, react-native-react-query-devtools popularity was classified as popular.
We found that react-native-react-query-devtools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.