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

expo-year-month-picker

v1.0.5

Published

A simple year and month picker for React Native.

Readme

expo-year-month-picker

A smooth, high-performance Year and Month picker for React Native, optimized for Expo.

https://github.com/user-attachments/assets/9109c3c1-4b0e-488b-a830-02071ccd3681

Features

  • 🚀 High Performance: Built with react-native-reanimated and react-native-gesture-handler for butter-smooth 60 FPS interactions.
  • Beautiful Design: Features built-in glassmorphism (BlurView) and gradient masking for a premium aesthetic.
  • 📱 Native Interactions: Supports drag-to-dismiss gestures and elastic scrolling.
  • 🎨 Highly Customizable: Fully controlled component, easy to integrate into any design system.
  • 🧩 Isolated & Clean: ZERO dependencies on specific UI frameworks or global states.

Installation

# Using pnpm
pnpm add expo-year-month-picker

# Using npm
npm install expo-year-month-picker

### Peer Dependencies

This package requires the following libraries. Ensure they are installed in your project:

- `react-native-reanimated`
- `react-native-gesture-handler`
- `react-native-safe-area-context`
- `react-native-screens`
- `expo-blur`
- `expo-haptics`
- `expo-symbols`
- `expo-linear-gradient`
- `nativewind`
- `tailwindcss`
- `@react-native-masked-view/masked-view`

## NativeWind Configuration

Since this component uses NativeWind for styling, you **MUST** add the package's source path to your `tailwind.config.js` for styles to be compiled correctly:

```js
// tailwind.config.js
module.exports = {
  content: [
    "./App.{js,jsx,ts,tsx}",
    "./src/**/*.{js,jsx,ts,tsx}",
    // ADD THIS LINE
    "./node_modules/expo-year-month-picker/src/**/*.{js,jsx,ts,tsx}",
  ],
  presets: [require("nativewind/preset")],
  // ... other configs
};

Quick Start

import * as Haptics from 'expo-haptics';
import React, { useMemo, useState } from 'react';
import { Pressable, Text, View } from 'react-native';
import {
  getMonthName,
  type MonthInfo,
  YearMonthPicker,
} from 'expo-year-month-picker';

const Example = () => {
  const [isVisible, setIsVisible] = useState(false);
  const [selectedDate, setSelectedDate] = useState({
    year: new Date().getFullYear(),
    month: new Date().getMonth() + 1,
  });

  // Generate available years (e.g., from 1970 to now)
  const availableYears = useMemo(() => {
    const years = [];
    const currentYear = new Date().getFullYear();
    for (let i = currentYear; i >= 1970; i--) {
      years.push(i);
    }
    return years;
  }, []);

  // Generate months for each year
  const availableMonthsByYear = useMemo(() => {
    const map = new Map<number, MonthInfo[]>();
    availableYears.forEach((year) => {
      const months: MonthInfo[] = [];
      for (let m = 1; m <= 12; m++) {
        months.push({
          month: m,
          name: getMonthName(m, true), // Short names: Jan, Feb, etc.
        });
      }
      map.set(year, months);
    });
    return map;
  }, [availableYears]);

  const handleConfirm = (year: number, month: number) => {
    setSelectedDate({ year, month });
    // not need to close the picker manually, the component will close it by 'onClose' callback after animation
  };

  const fireHaptic = () => {
    Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
  };

  return (
    <View className='flex-1 items-center justify-center'>
      <Pressable
        onPress={() => setIsVisible(true)}
        className='px-8 py-4 bg-black dark:bg-white rounded-full active:opacity-70'
      >
        <Text className='text-white dark:text-black font-bold text-xl'>
          {selectedDate.year} . {selectedDate.month.toString().padStart(2, '0')}
        </Text>
      </Pressable>

      {isVisible && (
        <YearMonthPicker
          isVisible={isVisible}
          onClose={() => setIsVisible(false)}
          initialYear={selectedDate.year}
          initialMonth={selectedDate.month}
          availableYears={availableYears}
          availableMonthsByYear={availableMonthsByYear}
          onConfirm={handleConfirm}
          fireHaptic={fireHaptic}
        />
      )}
    </View>
  );
};

export default Example;

API Reference

YearMonthPicker Props

| Prop | Type | Description | | :---------------------- | :-------------------------------------- | :----------------------------------------------------------------------- | | isVisible | boolean | Controls the visibility of the picker. | | onClose | () => void | Triggered when the picker requests to close (backdrop tap or pull down). | | initialYear | number | The initially selected year. | | initialMonth | number \| null | The initially selected month (1-12). | | availableYears | number[] | List of years available for selection. | | availableMonthsByYear | Map<number, MonthInfo[]> | Map of available months for each year. | | onConfirm | (year: number, month: number) => void | Callback triggered when the confirm button is pressed. | | fireHaptic | () => void | (Optional) Callback triggered during scroll for haptic feedback. |

Helper Functions

  • getMonthName(month: number, short?: boolean): Get the English month name.

License

MIT License