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 🙏

© 2025 – Pkg Stats / Ryan Hefner

expo-horizontal-picker

v0.1.6

Published

A performant horizontal picker component for React Native and Expo apps

Downloads

53

Readme

expo-horizontal-picker

npm version npm downloads

A performant horizontal picker component for React Native and Expo apps.

  • Smooth Horizontal Scrolling
    Optimized with react-native-reanimated for buttery-smooth, performant scroll animations.

  • Snapping Behavior
    Automatically snaps to the closest item to give users a precise and polished interaction.

  • Fully Customizable
    Style any part of the picker — container, text, selected item styles — to fit your design system.

  • Initial Index Support
    Set the starting index to highlight a default item.

  • Built-in Haptic Feedback Support
    Easily integrate with expo-haptics to give subtle tactile feedback when items change.

  • TypeScript Support
    Fully typed API for a better developer experience.

  • Works with Expo and Bare React Native
    Supports both managed and bare workflows out of the box.

📦 Installation

1. Install the package

This package requires react-native-reanimated to work:

npm install expo-horizontal-picker react-native-reanimated

Make sure to follow the additional setup instructions for Reanimated in the official docs.

2. (Optional) Install expo-haptics for haptic feedback

npm install expo-haptics

If you want to enable haptic feedback on item change, pass the onHapticFeedback prop and handle it using Expo Haptics:

🎬 Demo

Example

import * as Haptics from 'expo-haptics';
import { HorizontalPicker } from 'expo-horizontal-picker';
import { SafeAreaView } from 'react-native';

export default function App() {
  return (
    <SafeAreaView style={styles.container}>
      <View>
        <HorizontalPicker
          items={Array.from({ length: 100 }, (_, i) => ({
            label: `${i + 1}`,
            value: i + 1,
          }))}
          initialIndex={49}
          visibleItemCount={7}
          onHapticFeedback={() => Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)}
        />

        <HorizontalPicker
          items={Array.from({ length: 20 }, (_, i) => ({
            label: `${i + 1}k`,
            value: i + 1,
          }))}
          initialIndex={9}
          visibleItemCount={5}
          selectedItemTextStyle={{ color: 'orange', fontSize: 24 }}
          onHapticFeedback={() => Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Rigid)}
        />

        <HorizontalPicker
          items={Array.from({ length: 24 }, (_, i) => ({
            label: `${i + 1}h`,
            value: i + 1,
          }))}
          initialIndex={11}
          visibleItemCount={3}
          itemTextStyle={{ fontSize: 20 }}
          selectedItemTextStyle={{ fontSize: 40 }}
          onHapticFeedback={() => Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy)}
        />

        <HorizontalPicker
          items={Array.from({ length: 5 }, (_, i) => ({
            label: `${(i + 1) * 10000}`,
            value: (i + 1) * 10000,
          }))}
          initialIndex={2}
          visibleItemCount={1}
          itemTextStyle={{ fontSize: 60 }}
          selectedItemTextStyle={{ fontSize: 60 }}
          onHapticFeedback={() => Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy)}
        />
      </View>
    </SafeAreaView>
  );
}

const styles = {
  container: {
    flex: 1,
    backgroundColor: '#eee',
  },
};

🧩 Props

| Prop | Type | Default | Description | |-------------------------|--------------------------------------------------------|---------|---------------------------------------------------------------------------------| | items | PickerOption[] | – | Array of options to display. Each option is an object with label and value. | | initialIndex | number | 0 | Index of the item initially selected. | | visibleItemCount | number | 7 | Number of items visible on screen at once. | | onChange | (value: string \| number, index: number) => void | – | Callback triggered when the selected item changes. | | onHapticFeedback | () => void | – | Optional callback for haptic feedback when selection changes. | | containerStyle | AnimatedScrollViewProps['style'] | – | Style applied to the scroll container. | | itemContainerStyle | StyleProp<ViewStyle> | – | Style applied to each item container. | | itemTextStyle | StyleProp<TextStyle> | – | Style for unselected item text. | | selectedItemTextStyle | StyleProp<TextStyle> | – | Style for selected item text. | | ...props | AnimatedScrollViewProps | – | Additional props passed to Animated.ScrollView. |