Essential React Native hooks and utilities for building better mobile apps. Zero dependencies, TypeScript-first, works on iOS and Android.
npm install react-native-developer-toolkit
# or
yarn add react-native-developer-toolkitTrack whether your app is in the foreground or background.
import { useAppState } from 'react-native-developer-toolkit';
function MyComponent() {
const appState = useAppState();
useEffect(() => {
if (appState === 'active') {
refreshData();
}
}, [appState]);
return <Text>App is {appState}</Text>;
}Returns: 'active' | 'background' | 'inactive' | 'unknown'
Monitor network connectivity in real-time.
import { useNetworkStatus } from 'react-native-developer-toolkit';
function MyComponent() {
const { isConnected, type } = useNetworkStatus();
if (!isConnected) {
return <Text>You are offline</Text>;
}
return <Text>Connected via {type}</Text>;
}Returns: { isConnected: boolean, type: 'wifi' | 'cellular' | 'none' | 'unknown' }
Respect the user's accessibility preference for reduced motion.
import { useReduceMotion } from 'react-native-developer-toolkit';
function AnimatedCard({ children }) {
const prefersReducedMotion = useReduceMotion();
return (
<Animated.View
style={{
transform: [{ scale: prefersReducedMotion ? 1 : animatedScale }],
}}
>
{children}
</Animated.View>
);
}Returns: boolean
Track keyboard visibility and height for proper layout adjustments.
import { useKeyboard } from 'react-native-developer-toolkit';
function ChatInput() {
const { isVisible, height } = useKeyboard();
return (
<View style={{ paddingBottom: isVisible ? height : 0 }}>
<TextInput placeholder="Type a message..." />
</View>
);
}Returns: { isVisible: boolean, height: number }
Keep a reference to the previous value of a prop or state.
import { usePrevious } from 'react-native-developer-toolkit';
function Counter({ count }) {
const prevCount = usePrevious(count);
return (
<Text>
Current: {count}, Previous: {prevCount ?? 'none'}
</Text>
);
}Returns: T | undefined
Debounce a value - useful for search inputs.
import { useDebounce } from 'react-native-developer-toolkit';
function SearchScreen() {
const [query, setQuery] = useState('');
const debouncedQuery = useDebounce(query, 300);
useEffect(() => {
if (debouncedQuery) {
searchAPI(debouncedQuery);
}
}, [debouncedQuery]);
return <TextInput value={query} onChangeText={setQuery} />;
}Returns: T (the debounced value)
Predefined vibration patterns for common feedback scenarios.
import { vibrate } from 'react-native-developer-toolkit';
vibrate('success'); // Short double tap
vibrate('error'); // Long buzz
vibrate('warning'); // Medium pulse
vibrate('tap'); // Single light tap
vibrate('notify'); // Notification patternHuman-readable file size formatting.
import { formatBytes } from 'react-native-developer-toolkit';
formatBytes(1024); // '1 KB'
formatBytes(1234567); // '1.18 MB'
formatBytes(0); // '0 Bytes'Detect if the device has a notch/dynamic island for safe area handling.
import { isIphoneWithNotch } from 'react-native-developer-toolkit';
const statusBarHeight = isIphoneWithNotch() ? 44 : 20;- Zero dependencies - Only uses React Native built-in APIs
- TypeScript-first - Full type safety out of the box
- Lightweight - Each hook is under 30 lines, tree-shakeable
- Cross-platform - Works on both iOS and Android
- Production-ready - Used in real apps, properly handles cleanup and edge cases
Contributions are welcome! Please open an issue or submit a PR.
MIT