### Install the package Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/README.md Run this command to install the core library. ```bash npm install @hiraku-ai/react-native-emoji-picker ``` -------------------------------- ### Installation Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/README.md Install the package and its peer dependencies using npm. ```APIDOC ## Installation ### Install Package ```bash npm install @hiraku-ai/react-native-emoji-picker ``` ### Install Peer Dependencies ```bash npm install @react-native-async-storage/async-storage react-native-svg ``` ``` -------------------------------- ### Install peer dependencies Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/README.md Install the required peer dependencies for storage and SVG rendering. ```bash npm install @react-native-async-storage/async-storage react-native-svg ``` -------------------------------- ### Basic EmojiTabs usage Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/EmojiTabs.md Minimal example rendering EmojiTabs with two categories and a console log on press. ```jsx import { EmojiTabs } from '@hiraku-ai/react-native-emoji-picker'; console.log('tab:', category)} /> ``` -------------------------------- ### EmojiTabs Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/api-reference.md Documentation for the EmojiTabs component, including its props and usage example. ```APIDOC ## EmojiTabs ### Description Standalone category tabs component that displays a list of emoji categories and allows selection. It supports custom styling and per-category icon colors. ### Props - **categories** (`string[]`) - Required - Array of category names. - **activeCategory** (`string | null`) - Required - Currently active category. - **onCategoryPress** (`(category: string) => void`) - Required - Called when a tab is pressed. - **tabIconColors** (`Record`) - Optional - Custom colors per category. - **tabsContainerStyle** (`ViewStyle`) - Optional - Style for the container. - **tabStyle** (`ViewStyle`) - Optional - Style for inactive tabs. - **activeTabStyle** (`ViewStyle`) - Optional - Style for the active tab. ### Example ```jsx import { EmojiTabs } from '@hiraku-ai/react-native-emoji-picker'; console.log(category)} /> ``` ``` -------------------------------- ### Implement TypeSafeApp with EmojiPickerModal Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/typescript-guide.md A complete example demonstrating how to use EmojiPickerModal with TypeScript, including theme overrides and state management for visibility and emoji selection. ```typescript import React, { useState, useCallback } from 'react'; import EmojiPickerModal, { emojiData, EmojiPickerThemeProvider, lightTheme, darkTheme, } from '@hiraku-ai/react-native-emoji-picker'; import type { EmojiPickerModalProps, EmojiData, EmojiPickerTheme, PartialTheme, } from '@hiraku-ai/react-native-emoji-picker'; interface AppState { visible: boolean; selectedEmoji: string | null; isDarkMode: boolean; } function TypeSafeApp() { const [state, setState] = useState({ visible: false, selectedEmoji: null, isDarkMode: false, }); const handleEmojiSelect = useCallback((emoji: string): void => { setState(prev => ({ ...prev, selectedEmoji: emoji, visible: false, })); }, []); const theme: EmojiPickerTheme = state.isDarkMode ? darkTheme : lightTheme; const themeOverride: PartialTheme = { colors: { accent: '#ff6b6b', } }; const pickerProps: EmojiPickerModalProps = { visible: state.visible, onClose: () => setState(prev => ({ ...prev, visible: false })), onEmojiSelect: handleEmojiSelect, emojis: emojiData, theme: themeOverride, showHistoryTab: true, maxRecentEmojis: 30, }; return ( ); } ``` -------------------------------- ### EmojiTabs usage example Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/api-reference.md Import and render the EmojiTabs component. Provide an array of category names, the active category, and a callback for when a tab is pressed. ```jsx import { EmojiTabs } from '@hiraku-ai/react-native-emoji-picker'; console.log(category)} /> ``` -------------------------------- ### Define EmojiData interface and example Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/typescript-guide.md Defines the `EmojiData` interface and provides a concrete example object. The `skin_tones` property is optional and indicates whether the emoji supports skin tone variations. ```typescript import type { EmojiData } from '@hiraku-ai/react-native-emoji-picker'; interface EmojiData { emoji: string; // The emoji character 'πŸ˜€' description: string; // Human-readable description category: string; // Category name aliases: string[]; // Alternative names tags: string[]; // Related keywords unicode_version: string; // Unicode version added ios_version: string; // iOS version with support skin_tones?: boolean; // Whether supports skin tones } // Example const example: EmojiData = { emoji: 'πŸ˜€', description: 'grinning face', category: 'Smileys & Emotion', aliases: ['grinning'], tags: ['smile', 'happy'], unicode_version: '6.1', ios_version: '6.0', skin_tones: false, }; ``` -------------------------------- ### useEmojiPicker Hook Usage Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/headless-mode.md Example of importing and using the useEmojiPicker hook to build a custom emoji picker UI. ```APIDOC ## useEmojiPicker ### Description Initializes the emoji picker logic for headless mode, providing search, filtering, recent emojis, and skin tone management. ### Usage ```jsx import { useEmojiPicker, emojiData } from '@hiraku-ai/react-native-emoji-picker'; function CustomPicker() { const pickerState = useEmojiPicker({ emojis: emojiData, }); // Build your UI with pickerState } ``` ### Configuration - **emojis** (EmojiData[]) - Required - The emoji dataset. - **showHistoryTab** (boolean) - Optional - Default: true. Whether to show the history tab. - **maxRecentEmojis** (number) - Optional - Default: 6. Maximum number of recent emojis to track. - **defaultSkinTone** (string) - Optional - Default: ''. Default skin tone for emojis. - **columns** (number) - Optional - Default: 6. Number of columns for flatListData. - **categoryOrder** (string[]) - Optional - Custom category ordering. ### Return Values The hook returns an object with the following properties: - **searchQuery** (string) - Current search query. - **setSearchQuery** (function) - Sets the search query. - **activeCategory** (string | null) - Currently active category. - **setActiveCategory** (function) - Sets the active category. - **recentEmojis** (EmojiData[]) - List of recent emojis. - **selectedSkinTone** (string) - Currently selected skin tone. - **setSelectedSkinTone** (function) - Sets the selected skin tone. - **emojiSections** (Array<{ title: string; data: EmojiData[] }>) - Emojis organized by category. - **flatListData** (Array) - Data formatted for a FlatList. - **updateRecentEmojis** (function) - Updates the recent emojis list with a given emoji. - **getModifiedEmoji** (function) - Returns the modified emoji string based on skin tone. ``` -------------------------------- ### Basic headless usage of useEmojiPicker Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/useEmojiPicker.md Use this example to set up a headless picker with the useEmojiPicker hook. It uses the flatListData, searchQuery, setSearchQuery, updateRecentEmojis, and getModifiedEmoji from the returned object to render a FlatList with header and row items. ```jsx import { useEmojiPicker, emojiData } from '@hiraku-ai/react-native-emoji-picker'; function MyPicker() { const { flatListData, searchQuery, setSearchQuery, updateRecentEmojis, getModifiedEmoji, } = useEmojiPicker({ emojis: emojiData }); return ( item.id} renderItem={({ item }) => (item.type === 'header' ?
: )} /> ); } ``` -------------------------------- ### EmojiPicker usage example Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/api-reference.md Shows how to import and render the EmojiPicker component with required props. The component is placed inside a View with a fixed height of 400. The onEmojiSelect callback logs the selected emoji. ```jsx import { EmojiPicker, emojiData } from '@hiraku-ai/react-native-emoji-picker'; console.log(emoji)} /> ``` -------------------------------- ### EmojiSearch Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/api-reference.md Documentation for the EmojiSearch component, including its props and usage example. ```APIDOC ## EmojiSearch ### Description Standalone search component that allows users to search for emojis. It provides a debounced search input and customizable styling. ### Props - **onSearch** (`(text: string) => void`) - Required - Called with search query. - **debounceMs** (`number`) - Default: `150` - Debounce delay in milliseconds. - **minChars** (`number`) - Default: `2` - Minimum characters to trigger search. - **placeholderText** (`string`) - Default: `"Search emojis..."` - Placeholder text for the input. - **searchBarStyle** (`ViewStyle`) - Optional - Style for the search bar. - **searchInputStyle** (`TextStyle`) - Optional - Style for the input field. - **showSearchIcon** (`boolean`) - Default: `true` - Whether to show the search icon. - **containerStyle** (`ViewStyle`) - Optional - Style for the container. ### Example ```jsx import { EmojiSearch } from '@hiraku-ai/react-native-emoji-picker'; console.log(text)} debounceMs={150} minChars={2} /> ``` ``` -------------------------------- ### Import and use useEmojiPicker hook Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/headless-mode.md Import the hook and emojiData, then call useEmojiPicker with the emojis prop to get pickerState for building a custom UI. ```jsx import { useEmojiPicker, emojiData } from '@hiraku-ai/react-native-emoji-picker'; function CustomPicker() { const pickerState = useEmojiPicker({ emojis: emojiData, }); // Build your UI with pickerState } ``` -------------------------------- ### Using Built-in Dark Theme with EmojiPickerThemeProvider Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/theming.md Use the built-in dark theme by wrapping the modal in EmojiPickerThemeProvider with the darkTheme prop. The example imports emojiData and EmojiPickerModal from the package and passes visible, onClose, onEmojiSelect, and emojis props. ```jsx import EmojiPickerModal, { emojiData, EmojiPickerThemeProvider, darkTheme } from '@hiraku-ai/react-native-emoji-picker'; function App() { return ( {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} /> ); } ``` -------------------------------- ### EmojiPickerModal usage example Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/api-reference.md Shows how to import and render the EmojiPickerModal component with required props: visible, onClose, onEmojiSelect, and emojis. The emojis prop uses the emojiData export. ```jsx import EmojiPickerModal, { emojiData } from '@hiraku-ai/react-native-emoji-picker'; {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} /> ``` -------------------------------- ### Define EmojiPickerTheme and PartialTheme with usage Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/typescript-guide.md Defines the full `EmojiPickerTheme` interface and the `PartialTheme` type for overriding specific theme properties. The usage example shows how to create a custom theme with only a few color overrides. ```typescript import type { EmojiPickerTheme, PartialTheme, } from '@hiraku-ai/react-native-emoji-picker'; // Full theme interface interface EmojiPickerTheme { colors: { // Backgrounds background: string; backgroundSecondary: string; modalBackground: string; headerBackground: string; searchBackground: string; tabBackground: string; tabActiveBackground: string; emojiButtonBackground: string; skinToneButtonBorder: string; // Text colors text: string; textSecondary: string; textTertiary: string; headerTitle: string; categoryTitle: string; placeholder: string; noResults: string; // Borders border: string; borderLight: string; headerBorder: string; tabsBorder: string; categoryDivider: string; // Interactive accent: string; accentSecondary: string; // Icons icon: string; iconActive: string; closeIcon: string; // Overlay modalOverlay: string; }; opacity: { modalOverlay: number; }; } // Partial theme for overrides type PartialTheme = { colors?: Partial; opacity?: Partial; }; // Usage const customTheme: PartialTheme = { colors: { accent: '#ff6b6b', background: '#ffffff', } }; ``` -------------------------------- ### Advanced EmojiTabs usage with custom colors and icon overrides Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/EmojiTabs.md Non-trivial example using custom tab icon colors, an active tab style, a BottomSheetFlatList as the list component, and a custom icon override for the Flags category. ```jsx import { EmojiTabs, PizzaIcon } from '@hiraku-ai/react-native-emoji-picker'; import { BottomSheetFlatList } from '@gorhom/bottom-sheet'; s.title)} activeCategory={active} onCategoryPress={setActive} tabIconColors={{ 'Smileys & Emotion': '#ef4444', Flags: '#22c55e' }} activeTabStyle={{ transform: [{ scale: 1.1 }] }} FlatListComponent={BottomSheetFlatList} categoryIconComponents={{ Flags: PizzaIcon }} /> ``` -------------------------------- ### EmojiPicker Component Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/EmojiPicker.md Documentation for the EmojiPicker React Native component, including its props, return type, side effects, and usage examples. ```APIDOC ## EmojiPicker Component ### Description A React Native component that renders an emoji picker with a grid of emojis, category tabs, search, skin tone selector, and recent emojis. It supports theming, custom flat lists, and flexible configuration. ### Props #### Required Props - **emojis** (EmojiData) - Required - The emoji data to display. - **onEmojiSelect** (function) - Required - Callback invoked when an emoji is selected. Receives the selected emoji object. - **onClose** (function) - Required - Callback invoked when the picker is closed. #### Optional Props - **showSkinToneSelector** (boolean) - Optional - Whether to show the skin tone selector. - **showSearchIcon** (boolean) - Optional - Whether to show the search icon. Defaults to `true`. - **includeCategories** (string[]) - Optional - Array of category names to include. Only these categories will be displayed. - **categoryOrder** (string[]) - Optional - Array of category names in the order they should appear. - **categoryNameMap** (object) - Optional - Mapping of original category names to display names. - **excludeEmojis** (string[]) - Optional - Array of emoji characters to exclude from the picker. - **columns** (number) - Optional - Number of columns in the emoji grid. - **maxRecentEmojis** (number) - Optional - Maximum number of recent emojis to store. - **darkMode** (boolean) - Optional - Whether to use dark mode styling. - **theme** (object) - Optional - Theme overrides, e.g., `{ colors: { accent: '#FF5722' } }`. - **FlatListComponent** (component) - Optional - Custom FlatList component to use for the main emoji list. - **TabFlatListComponent** (component) - Optional - Custom FlatList component to use for the category tabs. - **renderCategoryHeader** (function) - Optional - Custom render function for category headers. Receives `{ category, displayName }`. - **initialNumToRender** (number) - Optional - Initial number of items to render. - **windowSize** (number) - Optional - Window size for the FlatList. ### Return Type Renderable React tree (`React.ReactNode`); no value. ### Side Effects - Theme provider context - AsyncStorage writes through `updateRecentEmojis` ### Throws / Rejects None defined. Errors are not thrown by this component; AsyncStorage failures inside `useEmojiPicker` are caught and logged via `console.error`. Custom `FlatListComponent`s may surface their own AsyncStorage/scroll errors. ### Examples #### Basic Inline Usage ```jsx import { EmojiPicker, emojiData } from '@hiraku-ai/react-native-emoji-picker'; console.log('picked:', emoji)} onClose={() => {}} /> ``` #### Advanced Usage ```jsx import { EmojiPicker, emojiData } from '@hiraku-ai/react-native-emoji-picker'; import { BottomSheetFlatList } from '@gorhom/bottom-sheet'; setMessage(message + emoji)} showSkinToneSelector showSearchIcon={false} includeCategories={['Smileys & Emotion', 'Flags']} categoryOrder={['Flags', 'Smileys & Emotion']} categoryNameMap={{ 'Smileys & Emotion': 'Faces' }} excludeEmojis={['πŸ˜€']} columns={8} maxRecentEmojis={5} darkMode theme={{ colors: { accent: '#FF5722' } }} FlatListComponent={BottomSheetFlatList} TabFlatListComponent={BottomSheetFlatList} renderCategoryHeader={({ category, displayName }) => ( {displayName} )} initialNumToRender={14} windowSize={12} /> ``` ``` -------------------------------- ### EmojiSearch usage example Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/api-reference.md Import and render the EmojiSearch component. The onSearch callback receives the search text, debounceMs sets the debounce delay, and minChars sets the minimum characters to trigger the search. ```jsx import { EmojiSearch } from '@hiraku-ai/react-native-emoji-picker'; console.log(text)} debounceMs={150} minChars={2} /> ``` -------------------------------- ### Include Only Specific Categories with includeCategories Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/advanced-features.md Use the includeCategories prop to show only the specified categories. In this example, only 'Smileys & Emotion' and 'People & Body' are included. ```jsx {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} includeCategories={['Smileys & Emotion', 'People & Body']} /> ``` -------------------------------- ### Advanced EmojiPicker with filtering and skin tones Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/DataAndConstants.md Demonstrates type-safe filtering using the Category enum and skin-tone awareness with SKIN_TONES. The example filters emojis to flags only and enables the skin tone selector with a default medium tone. ```jsx import { emojiData, Category, SKIN_TONES } from '@hiraku-ai/react-native-emoji-picker'; const flagsOnly = emojiData.filter((e) => e.category === Category.FLAGS); ``` -------------------------------- ### Icon component signature pattern (XIcon example) Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/Icons.md Shows the defaulted signature pattern used by every icon component, rendering a 24Γ—24 react-native-svg Svg with stroke color, strokeWidth 2, round line caps/joins, and fill none. ```tsx export const XIcon = ({ size = 24, color = '#000', style }: IconProps) => ( {/* shape paths */} ); ``` -------------------------------- ### Basic inline usage of EmojiPicker Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/EmojiPicker.md Minimal example rendering EmojiPicker inside a View with a fixed height. Requires importing EmojiPicker and emojiData from '@hiraku-ai/react-native-emoji-picker'. The onEmojiSelect callback logs the selected emoji; onClose is a no-op. ```jsx import { EmojiPicker, emojiData } from '@hiraku-ai/react-native-emoji-picker'; console.log('picked:', emoji)} onClose={() => {}} /> ``` -------------------------------- ### Simple Dark Mode Toggle with lightTheme and darkTheme Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/theming.md Toggle between light and dark themes by conditionally passing darkTheme or lightTheme to EmojiPickerThemeProvider based on a state variable. The example uses useState to manage the isDark flag and wraps YourApp inside the provider. ```jsx import { lightTheme, darkTheme } from '@hiraku-ai/react-native-emoji-picker'; function App() { const [isDark, setIsDark] = useState(false); return ( ); } ``` -------------------------------- ### lightTheme Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/Theme.md Documentation for the lightTheme prebuilt theme object. ```APIDOC ## lightTheme ### Description Prebuilt light theme object that can be used as a base or override. ### Type `EmojiPickerTheme` ``` -------------------------------- ### Implement Headless Mode Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/README.md Use the useEmojiPicker and useEmojiPickerRenderer hooks to build a fully custom UI. ```jsx import { useEmojiPicker, useEmojiPickerRenderer, EmojiPickerThemeProvider, emojiData } from '@hiraku-ai/react-native-emoji-picker'; function CustomPickerContent() { const { flatListData, emojiSections, selectedSkinTone, searchQuery, getModifiedEmoji, updateRecentEmojis } = useEmojiPicker({ emojis: emojiData }); const { renderItem, renderEmptyComponent } = useEmojiPickerRenderer({ onEmojiSelect: (emoji) => console.log(emoji), getModifiedEmoji, updateRecentEmojis, selectedSkinTone, emojiSections, searchQuery, }); // Bring your own scroll component return ( item.id} /> ); } function CustomPicker() { return ( ); } ``` -------------------------------- ### Exclude Categories with excludeCategories Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/advanced-features.md Use the excludeCategories prop to hide specific categories from the picker. In this example, 'Flags' and 'Symbols' are excluded. ```jsx {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} excludeCategories={['Flags', 'Symbols']} /> ``` -------------------------------- ### Render XIcon with size and color Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/Icons.md Basic usage: import an icon from the package entry point and render it with custom size and color props. ```jsx import { XIcon } from '@hiraku-ai/react-native-emoji-picker'; ``` -------------------------------- ### darkTheme Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/Theme.md Documentation for the darkTheme prebuilt theme object. ```APIDOC ## darkTheme ### Description Prebuilt dark theme object that can be used as a base or override. ### Type `EmojiPickerTheme` ``` -------------------------------- ### useEmojiPicker Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/useEmojiPicker.md Documentation for the useEmojiPicker hook, including its parameters and return object. ```APIDOC ## useEmojiPicker ### Description Headless hook containing all picker logic: search state, category grouping (`Section[]`), recent-emojis persistence, skin-tone selection, category ordering, and FlatList-flattened data. Export path: `@hiraku-ai/react-native-emoji-picker` β†’ `useEmojiPicker` (named export from `src/index.ts:16`). ### Signature ```ts export function useEmojiPicker({ emojis = [], showHistoryTab = true, maxRecentEmojis = 6, defaultSkinTone = '', columns = 6, categoryOrder, }: UseEmojiPickerProps) ``` ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `emojis` | `EmojiData[]` | yes | `[]` | Input dataset (already include/exclude-filtered when called from `EmojiPicker`) | | `showHistoryTab` | `boolean` | no | `true` | When `true`: loads persisted recents on mount, prepends a `'Recently Used'` section, and records selections. When `false`: recents are never loaded or persisted and `updateRecentEmojis` is a no-op | | `maxRecentEmojis` | `number` | no | `6` | Cap on the recents list (both on load β€” `parsed.slice(0, maxRecentEmojis)` β€” and on save) | | `defaultSkinTone` | `string` | no | `''` | Initial `selectedSkinTone` state | | `columns` | `number` | no | `6` | `EMOJIS_PER_ROW` used when chunking `emojiSections` into `flatListData` rows | | `categoryOrder` | `string[]` | no | β€” | Section order: named categories move to the front (in listed order); any unlisted sections keep their relative order afterwards | ### Return Object Returns an object with 11 members: ```ts { searchQuery, // string setSearchQuery, // (query: string) => void activeCategory, // string | null setActiveCategory, // (category: string) => void recentEmojis, // EmojiData[] selectedSkinTone, // string setSelectedSkinTone, // (tone: string) => void emojiSections, // Section[] flatListData, // FlatListItem[] updateRecentEmojis, // (emoji: string) => void getModifiedEmoji, // (emoji: string) => string } ``` | Member | Type | Description | |--------|------|-------------| | `searchQuery` | `string` | Current search query (updates only via `setSearchQuery`) | | `setSearchQuery` | `(query: string) => void` | Setter (internal `handleSearch`; sets state only β€” filtering happens in the `rawEmojiSections` memo) | | `activeCategory` | `string \| null` | Active category title | | `setActiveCategory` | `(category: string) => void` | Setter | | `recentEmojis` | `EmojiData[]` | Currently tracked recents (most-recent first) | | `selectedSkinTone` | `string` | Current skin-tone modifier (`''` = default) | | `setSelectedSkinTone` | `(tone: string) => void` | Setter (internal `handleSkinToneChange`) | | `emojiSections` | `Section[]` | Category-grouped sections, re-ordered per `categoryOrder`, with optional leading `{ title: 'Recently Used', data: recentEmojis }` | | `flatListData` | `FlatListItem[]` | FlatList-ready items: one `{ type: 'header', category, id: 'header-…' }` per section, then `{ type: 'emojiRow', emojis, id: 'row-…' }` chunks of `columns` | | `updateRecentEmojis` | `(emoji: string) => void` | Records a selection: finds its `EmojiData` in `emojis`, de-dupes, prepends, slices to `maxRecentEmojis`, persists via `AsyncStorage.setItem`, updates state | | `getModifiedEmoji` | `(emoji: string) => string` | Returns `emoji + selectedSkinTone` when the matched `EmojiData` has `skin_tones: true` and a tone is selected; otherwise returns the emoji unchanged | ``` -------------------------------- ### Rename Categories with categoryNameMap Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/advanced-features.md Use the categoryNameMap prop to rename category display names. The example maps original names to custom labels with emojis. ```jsx {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} categoryNameMap={{ 'Smileys & Emotion': 'πŸ˜€ Faces', 'People & Body': 'πŸ‘€ People', 'Animals & Nature': '🌿 Nature', 'Food & Drink': 'πŸ• Food', 'Travel & Places': '✈️ Travel', 'Activities': '⚽ Sports', 'Objects': 'πŸ’‘ Things', 'Symbols': '#️⃣ Symbols', 'Flags': '🏳️ Flags', }} /> ``` -------------------------------- ### PartialTheme Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/Theme.md Documentation for the PartialTheme type. ```APIDOC ## PartialTheme ### Description Type representing a partial theme, allowing overrides of `colors` and `opacity` groups. ### Type `PartialTheme` ``` -------------------------------- ### useEmojiPickerTheme Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/Theme.md Documentation for the useEmojiPickerTheme hook, which provides access to the theme context. ```APIDOC ## useEmojiPickerTheme ### Description Consumer hook that returns the current theme context value, including the merged theme and dark mode flag. ### Method Hook ### Endpoint `useEmojiPickerTheme` ### Returns - `theme` (EmojiPickerTheme) - The current merged theme - `isDarkMode` (boolean) - Whether dark mode is active ``` -------------------------------- ### Full Custom Theme with EmojiPickerThemeProvider Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/theming.md Defines a complete custom theme object with all color and opacity properties, then wraps the app in EmojiPickerThemeProvider to apply it. Use this when you need full control over the picker's appearance. ```jsx import { EmojiPickerThemeProvider } from '@hiraku-ai/react-native-emoji-picker'; const brandTheme = { colors: { // Backgrounds background: '#ffffff', backgroundSecondary: '#f8f9fa', modalBackground: '#ffffff', headerBackground: '#8b5cf6', searchBackground: '#f3f4f6', tabBackground: 'transparent', tabActiveBackground: '#ede9fe', emojiButtonBackground: 'transparent', skinToneButtonBorder: '#e5e7eb', // Text text: '#1f2937', textSecondary: '#6b7280', textTertiary: '#9ca3af', headerTitle: '#ffffff', categoryTitle: '#8b5cf6', placeholder: '#9ca3af', noResults: '#6b7280', // Borders border: '#e5e7eb', borderLight: '#f3f4f6', headerBorder: 'transparent', tabsBorder: '#e5e7eb', categoryDivider: '#f3f4f6', // Interactive accent: '#8b5cf6', accentSecondary: '#7c3aed', // Icons icon: '#9ca3af', iconActive: '#8b5cf6', closeIcon: '#ffffff', // Overlay modalOverlay: 'rgba(139, 92, 246, 0.15)', }, opacity: { modalOverlay: 1, }, }; function App() { return ( ); } ``` -------------------------------- ### Reuse PizzaIcon in custom tabs renderer Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/Icons.md Non-trivial example: reuse a category icon inside a custom tabs renderer, using the theme hook to color the icon and handling category press. ```jsx import { useEmojiPickerTheme, PizzaIcon } from '@hiraku-ai/react-native-emoji-picker'; function FoodOnlyTab(props) { const { theme } = useEmojiPickerTheme(); return ( props.onCategoryPress('Food & Drink')}> ); } ``` -------------------------------- ### Bottom Sheet Example with useEmojiPickerRenderer and BottomSheetFlatList Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/headless-mode.md Shows how to use useEmojiPickerRenderer with @gorhom/bottom-sheet's BottomSheetFlatList. The hook provides renderItem and renderEmptyComponent that are passed to the FlatList-compatible component. The component must be wrapped in EmojiPickerThemeProvider for theming. ```jsx import { BottomSheetFlatList } from '@gorhom/bottom-sheet'; import { useEmojiPicker, useEmojiPickerRenderer, EmojiPickerThemeProvider, emojiData, } from '@hiraku-ai/react-native-emoji-picker'; function BottomSheetPickerContent({ onEmojiSelect }) { const { flatListData, emojiSections, selectedSkinTone, searchQuery, getModifiedEmoji, updateRecentEmojis, } = useEmojiPicker({ emojis: emojiData }); const { renderItem, renderEmptyComponent } = useEmojiPickerRenderer({ onEmojiSelect, getModifiedEmoji, updateRecentEmojis, selectedSkinTone, emojiSections, searchQuery, }); return ( item.id} /> ); } function BottomSheetPicker({ onEmojiSelect }) { return ( ); } ``` -------------------------------- ### renderCustomSearch: Custom Search Bar Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/advanced-features.md Replace the default search bar with a custom component. The render function receives an object with onSearch and searchQuery props. The example shows a TextInput styled with padding, borderRadius, and backgroundColor. ```jsx {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} renderCustomSearch={({ onSearch, searchQuery }) => ( )} /> ``` -------------------------------- ### Full Custom Picker with useEmojiPicker and Standalone Components Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/headless-mode.md Shows how to combine useEmojiPicker with standalone components (EmojiSearch, EmojiTabs, SkinToneSelector) to build a fully custom emoji picker. The hook provides state and data, while the standalone components handle search, tabs, and skin tone selection. ```jsx import { useEmojiPicker, emojiData, EmojiSearch, EmojiTabs, SkinToneSelector, } from '@hiraku-ai/react-native-emoji-picker'; function FullCustomPicker() { const { searchQuery, setSearchQuery, activeCategory, setActiveCategory, selectedSkinTone, setSelectedSkinTone, emojiSections, updateRecentEmojis, getModifiedEmoji, } = useEmojiPicker({ emojis: emojiData }); const categories = emojiSections.map(s => s.title); return ( {/* Use standalone search */} {/* Use standalone tabs */} {/* Use standalone skin tone selector */} {/* Your custom emoji grid */} { const modified = getModifiedEmoji(emoji); updateRecentEmojis(modified); }} /> ); } ``` -------------------------------- ### Create a BrandedPicker wrapper component Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/typescript-guide.md Demonstrates how to wrap EmojiPickerModal to provide custom themes based on a variant prop. Uses Omit to exclude the original theme prop while allowing other EmojiPickerModalProps. ```typescript import React from 'react'; import EmojiPickerModal from '@hiraku-ai/react-native-emoji-picker'; import type { EmojiPickerModalProps, PartialTheme } from '@hiraku-ai/react-native-emoji-picker'; interface BrandedPickerProps extends Omit { variant?: 'primary' | 'secondary'; } const brandThemes: Record<'primary' | 'secondary', PartialTheme> = { primary: { colors: { accent: '#007AFF', headerBackground: '#007AFF', } }, secondary: { colors: { accent: '#34C759', headerBackground: '#34C759', } }, }; export function BrandedPicker({ variant = 'primary', ...props }: BrandedPickerProps) { return ( ); } ``` -------------------------------- ### Basic EmojiPickerModal usage Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/DataAndConstants.md Shows the simplest way to use the emoji picker by passing the emojiData dataset to EmojiPickerModal. The modal is controlled via visible, onClose, and onEmojiSelect props. ```jsx import EmojiPickerModal, { emojiData } from '@hiraku-ai/react-native-emoji-picker'; ``` -------------------------------- ### Non-trivial configuration with sizing, animation, custom title, icon override, and theme Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/EmojiPickerModal.md Shows a more advanced usage of EmojiPickerModal with custom modal dimensions, slide animation, custom title, skin tone selector, dark mode, custom close icon, theme accent color, and a custom search render prop. ```jsx import EmojiPickerModal, { emojiData, PizzaIcon } from '@hiraku-ai/react-native-emoji-picker'; ( )} /> ``` -------------------------------- ### renderCustomTabs: Custom Category Tabs Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/advanced-features.md Replace the default category tabs with a custom horizontal ScrollView. The render function receives categories, activeCategory, and onCategoryPress. The example maps over categories and renders TouchableOpacity buttons with dynamic styling based on the active category. ```jsx {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} renderCustomTabs={({ categories, activeCategory, onCategoryPress }) => ( {categories.map((category) => ( onCategoryPress(category)} style={{ padding: 12, marginHorizontal: 4, borderRadius: 8, backgroundColor: activeCategory === category ? '#007AFF' : '#f0f0f0', }} > {category} ))} )} /> ``` -------------------------------- ### Implement Performance Optimized Grid with FlatList Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/headless-mode.md Utilizes FlatList for efficient rendering of large emoji datasets by configuring columns and rendering performance props. ```jsx function OptimizedGrid() { const { flatListData, updateRecentEmojis, getModifiedEmoji, } = useEmojiPicker({ emojis: emojiData, columns: 8, }); const renderItem = ({ item }) => { if (item.type === 'header') { return ( {item.category} ); } return ( {item.emojis.map((emoji) => ( { const modified = getModifiedEmoji(emoji.emoji); updateRecentEmojis(modified); console.log(modified); }} style={{ flex: 1, padding: 8, alignItems: 'center' }} > {emoji.emoji} ))} ); }; return ( item.id} initialNumToRender={10} maxToRenderPerBatch={10} windowSize={5} /> ); } ``` -------------------------------- ### renderCustomSkinToneSelector: Custom Skin Tone Selector Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/documentation/advanced-features.md Replace the default skin tone selector with a custom row of color swatches. The render function receives selectedSkinTone, onSkinToneChange, and skinTones. The example maps over skinTones and renders TouchableOpacity buttons with dynamic border styling based on the selected tone. ```jsx {}} onEmojiSelect={(emoji) => console.log(emoji)} emojis={emojiData} showSkinToneSelector={true} renderCustomSkinToneSelector={({ selectedSkinTone, onSkinToneChange, skinTones }) => ( {skinTones.map((tone) => ( onSkinToneChange(tone.modifier)} style={{ width: 32, height: 32, borderRadius: 16, backgroundColor: tone.color, marginHorizontal: 4, borderWidth: selectedSkinTone === tone.modifier ? 3 : 1, borderColor: selectedSkinTone === tone.modifier ? '#007AFF' : '#cccccc', }} /> ))} )} /> ``` -------------------------------- ### Error-aware usage with custom ordering for useEmojiPicker Source: https://github.com/hirakudotai/react-native-emoji-picker/blob/main/_autodocs/api-reference/useEmojiPicker.md Use this example when you need to guard against AsyncStorage failures and customize the category order. It configures the hook with showHistoryTab, maxRecentEmojis, defaultSkinTone, and categoryOrder. updateRecentEmojis never throws; failures are logged to console.error. The getModifiedEmoji appends the skin-tone modifier. The try/catch is only reachable if onEmojiSelect itself throws. ```jsx import { useEmojiPicker, emojiData, Category } from '@hiraku-ai/react-native-emoji-picker'; const { emojiSections, activeCategory, setActiveCategory, selectedSkinTone, setSelectedSkinTone, updateRecentEmojis, getModifiedEmoji, } = useEmojiPicker({ emojis: emojiData, showHistoryTab: true, maxRecentEmojis: 10, // independent of the EmojiPicker default of 20 defaultSkinTone: '\u{1F3FD}', // 'Medium' tone categoryOrder: [Category.FLAGS, Category.SMILEYS_EMOTION], }); function onPick(emoji) { try { updateRecentEmojis(emoji); // never throws; failures log to console.error onEmojiSelect(getModifiedEmoji(emoji)); // appends the skin-tone modifier } catch (e) { // Only reachable if onEmojiSelect itself throws rollbackSelection(); } } ```