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

@impulse-ui-native/scroll-view

v17.0.0

Published

Native ScrollView and a small hook to reveal an initially selected child.

Readme

@impulse-ui-native/scroll-view

Native React Native ScrollView and a small hook to reveal an initially selected child with its actual measured size.

Installation

pnpm add @impulse-ui-native/scroll-view

React and React Native are peer dependencies. No theme provider is required. The toolkit also exports this package.

Usage

import { useRef } from "react";
import { Pressable, Text } from "react-native";

import {
  ScrollView,
  useScrollViewInitialScroll,
} from "@impulse-ui-native/scroll-view";

function Options({ items, selectedValue }) {
  const initialValue = useRef(selectedValue).current;
  const scroll = useScrollViewInitialScroll({ horizontal: true });

  return (
    <ScrollView
      ref={scroll.scrollViewRef}
      horizontal
      onLayout={scroll.onLayout}
      onContentSizeChange={scroll.onContentSizeChange}
      onScrollBeginDrag={scroll.onScrollBeginDrag}
    >
      {items.map((item) => (
        <Pressable
          key={item.value}
          ref={item.value === initialValue ? scroll.targetRef : undefined}
          onLayout={
            item.value === initialValue ? scroll.onTargetLayout : undefined
          }
        >
          <Text>{item.label}</Text>
        </Pressable>
      ))}
    </ScrollView>
  );
}

The hook waits for viewport, content, and target layout, then measures the target relative to the native ScrollView with measureLayout. This uses layout coordinates rather than the current visual scroll position. Nested native wrappers, padding, gaps, and variable item sizes are included. Attach targetRef to one native View or a component forwarding its native View ref. Compose onTargetLayout with any existing item layout callback.

It scrolls only far enough to reveal the target, without animation. Already visible items retain the initial position; oversized items align at their leading edge. The default axis is vertical; pass horizontal: true to the hook and ScrollView for horizontal content.

Pass enabled: false to skip positioning. Pass native contentOffset to both the hook and ScrollView to preserve an explicit starting position. Existing onLayout, onContentSizeChange, and onScrollBeginDrag callbacks can be passed to the hook; its returned handlers invoke them with the original arguments. Other native props remain available because ScrollView is the native component.

Positioning happens once per mount. A user drag cancels pending positioning. Later selection and layout changes do not scroll again. Mount with the initial selection and content available, and remount when a fresh initial position is needed. This hook is for ordinary, unzoomed ScrollViews without automatic/custom content insets or snapping.

Exports: ScrollView, ScrollViewProps, useScrollViewInitialScroll, and UseScrollViewInitialScrollOptions.

Agent and design reference

Start with the capability guide for supported exports, props, defaults, composition rules, setup, and recipes. Use the component chooser to select a package. These references describe the repository source; verify your installed package version before copying examples.