npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-use-responsive

v2.0.0

Published

Production-ready React Native hooks — useBreakpoint, useResponsive, useKeyboard, useDebounce, useAppState, and more. Zero dependencies, TypeScript-first.

Readme

react-native-use-responsive

Production-ready React Native hooks — zero dependencies, TypeScript-first.

npm install react-native-use-responsive

Hooks

📱 Layout & Responsive

useBreakpoint(customBreakpoints?)

Detects screen size breakpoint (sm/md/lg/xl). Updates on rotation.

const bp = useBreakpoint();
const cols = bp === 'sm' ? 1 : bp === 'md' ? 2 : 3;

useResponsive(value)

Returns a breakpoint-aware value. Falls back to nearest smaller breakpoint.

const cols = useResponsive({ sm: 1, md: 2, lg: 3, xl: 4 });

useOrientation()

Returns 'portrait' or 'landscape'.

const orientation = useOrientation();

⌨️ Keyboard

useKeyboard()

Tracks keyboard visibility and height. iOS: keyboardWillShow/Hide, Android: keyboardDidShow/Hide.

const { visible, height } = useKeyboard();
return <View style={{ paddingBottom: visible ? height : 0 }} />;

📡 App State

useAppState()

Returns 'active' | 'background' | 'inactive'.

const state = useAppState();
if (state === 'background') pauseVideo();

useIsForeground()

Boolean — true when app is active.

const isActive = useIsForeground();

useOnForeground(callback)

Runs callback when app returns to foreground.

useOnForeground(() => refetchData());

⏱️ Timing

useDebounce(value, delay)

Debounces a value — updates after delay ms of inactivity.

const debouncedQuery = useDebounce(searchQuery, 300);

useThrottle(value, delay)

Throttles a value — updates at most once per delay ms.

const throttledY = useThrottle(scrollY, 100);

useInterval(callback, delay)

Declarative setInterval. Pass null to pause.

useInterval(() => setSeconds(s => s + 1), 1000);

🔧 Utilities

usePrevious(value)

Returns the previous value of a variable.

const prevCount = usePrevious(count);

useToggle(initial?)

Boolean toggle with [value, toggle, setValue].

const [isOn, toggle] = useToggle(false);

useMount(callback)

Runs once on mount.

useMount(() => analytics.track('screen_viewed'));

useUnmount(callback)

Runs once on unmount.

useUnmount(() => subscription.unsubscribe());

Full API

| Hook | Returns | Description | |------|---------|-------------| | useBreakpoint(cfg?) | 'sm' \| 'md' \| 'lg' \| 'xl' | Screen size breakpoint | | useResponsive(value, cfg?) | T | Breakpoint-aware value | | useOrientation() | 'portrait' \| 'landscape' | Device orientation | | useKeyboard() | { visible, height, duration } | Keyboard state | | useAppState() | AppStateStatus | App lifecycle state | | useIsForeground() | boolean | App is active | | useOnForeground(fn) | void | Callback on foreground | | useDebounce(value, ms) | T | Debounced value | | useThrottle(value, ms) | T | Throttled value | | usePrevious(value) | T \| undefined | Previous render value | | useInterval(fn, ms) | void | Declarative interval | | useToggle(initial?) | [bool, toggle, set] | Boolean toggle | | useMount(fn) | void | On mount callback | | useUnmount(fn) | void | On unmount callback |


License

MIT © Muhammad Suleman