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

@joshuarileydev/whatsappui

v0.1.5

Published

ui for whatsapp

Readme

@joshuarileydev/whatsappui

A React Native WhatsApp UI component library that provides an authentic WhatsApp interface with chat list, search functionality, and navigation.

Installation

npm install @joshuarileydev/whatsappui

Dependencies:

  • react-native-svg (>=13.0.0) - Required for icons
  • react-native-safe-area-context (>=3.0.0) - Required for safe area handling
npm install react-native-svg react-native-safe-area-context

Usage

Basic Usage

import { WhatsApp } from '@joshuarileydev/whatsappui';
import { SafeAreaProvider } from 'react-native-safe-area-context';

export default function App() {
  return (
    <SafeAreaProvider>
      <WhatsApp
        onChatPress={(chat) => console.log('Chat pressed:', chat.name)}
        onSearchChange={(text) => console.log('Search:', text)}
        onTabPress={(tab) => console.log('Tab pressed:', tab)}
      />
    </SafeAreaProvider>
  );
}

Advanced Usage with Custom Props

import { WhatsApp } from '@joshuarileydev/whatsappui';
import { useState } from 'react';

export default function App() {
  const [searchText, setSearchText] = useState('');
  const [filteredChats, setFilteredChats] = useState([]);

  const customChats = [
    {
      id: '1',
      name: 'John Doe',
      message: 'Hey, how are you?',
      time: '12:30',
      avatarColor: '#FF6B9D',
      avatarInitials: 'JD',
      hasNotification: true,
      notificationCount: 2,
    },
    // ... more chats
  ];

  const handleSearchChange = (text) => {
    setSearchText(text);
    const filtered = customChats.filter((chat) =>
      chat.name.toLowerCase().includes(text.toLowerCase())
    );
    setFilteredChats(filtered);
  };

  return (
    <WhatsApp
      searchText={searchText}
      onSearchChange={handleSearchChange}
      defaultChats={searchText ? filteredChats : customChats}
      showNoResults={searchText.length > 0 && filteredChats.length === 0}
      onChatPress={(chat) => {
        // Navigate to chat details
        console.log('Opening chat with:', chat.name);
      }}
    />
  );
}

API Reference

WhatsApp Component Props

| Prop | Type | Default | Description | | ---------------- | --------------------------- | ----------- | ----------------------------------------------------------------------------------------- | | onSearchChange | (text: string) => void | undefined | Callback fired when search text changes | | onTabPress | (tabName: string) => void | undefined | Callback fired when tab is pressed | | onChatPress | (chat: ChatItem) => void | undefined | Callback fired when chat item is pressed | | showNoResults | boolean | false | Whether to show "No chats found" when defaultChats is empty | | searchText | string | undefined | External control of search text (controlled mode) | | defaultChats | ChatItem[] | mockChats | Array of chat items to display | | searchMode | 'filter' \| 'callback' | 'filter' | Controls search behavior: 'filter' filters chats, 'callback' only triggers onSearchChange |

ChatItem Interface

interface ChatItem {
  id: string;
  name: string;
  message: string;
  time: string;
  avatarColor: string;
  avatarInitials: string;
  hasUpdate?: boolean;
  hasNotification?: boolean;
  notificationCount?: number;
  isPinned?: boolean;
  isTyping?: boolean;
  messageType?: 'text' | 'reaction' | 'location' | 'voice' | 'deleted';
  hasCheckmark?: boolean;
  isMentioned?: boolean;
}

Features

  • Full Screen UI: Takes up the entire screen for an immersive experience
  • Authentic WhatsApp UI: Pixel-perfect recreation of WhatsApp's interface
  • Flexible Search: Built-in filtering or custom search handling via callbacks
  • Chat Navigation: Smooth animations between chat list and individual chats
  • Gesture Navigation: Two-finger swipe down to go back from chat view
  • Customizable Chat Data: Pass your own chat data or use built-in mock data
  • No Results State: Optional display of empty state when no chats match
  • TypeScript Support: Full TypeScript definitions included
  • Tab Navigation: Bottom tab bar with Updates, Calls, Communities, Chats, and Settings
  • Status Indicators: Support for typing indicators, notifications, pins, and more

Search Modes

The component supports two search modes via the searchMode prop:

'filter' (Default)

  • The component automatically filters the provided chats based on search text
  • Searches through chat names and messages
  • Perfect for simple use cases where you want built-in search functionality

'callback'

  • Only triggers the onSearchChange callback without filtering
  • Useful when you need custom search logic (e.g., backend search, complex filters)
  • You control the filtering by updating defaultChats based on search results

Examples

Built-in Search Filtering (Default)

const [searchQuery, setSearchQuery] = useState('');

<WhatsApp
  searchText={searchQuery}
  onSearchChange={setSearchQuery}
  searchMode="filter" // Default - automatically filters chats
  defaultChats={allChats}
  showNoResults={true}
/>;

Custom Search Handling

const [searchQuery, setSearchQuery] = useState('');
const [filteredChats, setFilteredChats] = useState(allChats);

const handleSearch = (text) => {
  setSearchQuery(text);
  // Custom search logic - search backend, multiple fields, etc.
  const filtered = performCustomSearch(text, allChats);
  setFilteredChats(filtered);
};

<WhatsApp
  searchText={searchQuery}
  onSearchChange={handleSearch}
  searchMode="callback" // Only triggers callback, no automatic filtering
  defaultChats={filteredChats}
  showNoResults={searchQuery.length > 0 && filteredChats.length === 0}
/>;

Empty State

<WhatsApp defaultChats={[]} showNoResults={true} />

Full Screen Usage

The component automatically takes up the full screen. To use it properly:

import { WhatsApp } from '@joshuarileydev/whatsappui';

export default function App() {
  return (
    <WhatsApp
      onChatPress={(chat) => {
        // Handle chat selection
        // Use two-finger swipe down gesture to go back
      }}
    />
  );
}

Gestures

  • Two-finger swipe down: When viewing an individual chat, swipe down with two fingers to go back to the chat list
  • Single tap: Tap on any chat item to open the chat view
  • Search: Tap the search bar to start searching

Empty State

<WhatsApp defaultChats={[]} showNoResults={true} />

Contributing

License

MIT


Made with create-react-native-library