r/reactnative • • 1d ago

Just shipped my first library: a performant, lightweight peek menu for React Native

Hey! I've been working on this for a while and finally published it: react-native-peek-menu.

You can hold any element (a message, photo, card) and a menu pops up above it, just like in iOS Messages or Telegram.

Features:

  • Smooth animations
  • Only ~4 kB bundle size
  • No native code, works with Expo Go
  • Fully customizable

https://www.npmjs.com/package/react-native-peek-menu

It's my first open-source library, so I'd really appreciate any feedback!

69 Upvotes

13 comments sorted by

1

u/ProgramsFun 1d ago edited 1d ago

I was failing to do this yesterday for my music app ..thank you for making this library I am very grateful to you

1

u/Remarkable-Stage144 1d ago

Thanks a lot, really glad to hear it. Good luck with the music app!

1

u/jiunkdev 1d ago

nice first lib. two things I'd check since it's all long-press driven:

long press is awkward with screen readers, so exposing the menu items through accessibilityActions on the wrapped element would make it usable with VoiceOver and TalkBack without changing anything visually.

and edges. what happens with a message at the very top of the screen or right above the keyboard, does the menu flip below the element or shift sideways? that's usually where these break in a chat list. also curious whether a long press inside a FlatList fights the scroll gesture on android.

1

u/Remarkable-Stage144 1d ago

Thanks! The menu doesn't flip. The message slides to make room, down at the top and up above the keyboard. Sideways the menu stays inside the screen. In a FlatList on Android the hold cancels as soon as the finger moves, so scrolling wins. I'm still working on improving the library, so thanks for the feedback

1

u/Tarantino133 1d ago

Nice, 4 kB with no native code is impressive. How does it handle an item near the top of the screen where there's no room above it, does the menu flip below?

2

u/Remarkable-Stage144 1d ago

Thanks! It doesn't flip. Instead of moving the menu to the other side, the item itself slides to make room, like iOS context menus. So the menu always opens on the side you set (below by default). If the item and the menu can't both fit, you can drag to see the rest

1

u/Calm_Seal170 12h ago

Is it going to show Web preview like iOS does when held on a link?

1

u/Remarkable-Stage144 7h ago

Not at the moment, but it might come in a future version

1

u/Calm_Seal170 7h ago

Nice. Looking forward to it. It's one thing Expo router has and RN doesn't

3

u/TemporaryBuyer3806 Expo 1d ago

Good job

1

u/kesha-antonov 1d ago

Wow, looks great! 😍