Git Product home page Git Product logo

rn-emoji-keyboard's Introduction

๐Ÿš€ rn-emoji-keyboard

A lightweight, fully customizable emoji picker, written as React Native component (without native elements). Designated to be user and developer friendly! ๐Ÿ’–

Preview

๐Ÿช„ Installation

yarn add rn-emoji-keyboard

or

npm install rn-emoji-keyboard

โšก๏ธ Usage

import EmojiPicker from 'rn-emoji-keyboard';

export default function App() {
  const [isOpen, setIsOpen] = React.useState<boolean>(false);

  const handlePick = (emojiObject: EmojiType) => {
    console.log(emojiObject);
    /* example emojiObject = {
        "emoji": "โค๏ธ",
        "name": "red heart",
        "slug": "red_heart",
        "unicode_version": "0.6",
      }
    */
  };

  return (
    <EmojiPicker
      onEmojiSelected={handlePick}
      open={isOpen}
      onClose={() => setIsOpen(false)} />
  )
}

โš™๏ธ Accepted props (current implemented)

Name Type Default Value Required Description
onEmojiSelected function undefined yes Callback on emoji selected
open boolean false yes Opens modal picker
onClose function undefined yes Request close modal runs when onEmojiSelected or backdrop pressed
emojiSize number 28 no Custom emoji size
enableRecentlyUsed boolean false no Enable recently used emojis in categories
categoryPosition 'floating' | 'top' | 'bottom' 'floating' no Specify category container position
enableSearchBar boolean false no Enable search bar
closeSearchColor string "#00000055" no Change button (cross) color for close/cancel search
searchBarStyles ViewStyle {} no Override search bar container styles
searchBarTextStyles ViewStyle {} no Override search bar text styles
searchBarPlaceholderColor string "#00000055" no Override search bar placeholder color
headerStyles TextStyle {} no Override category name styles
knobStyles ViewStyle {} no Override knob styles
containerStyles ViewStyle {} no Override container styles
hideHeader boolean false no Hide category names
expandable boolean true no Show knob and enable expand on swipe up
defaultHeight number | string "40%" no Specify collapsed container height (number is points, string is a percentage of the screen height)
expandedHeight number | string "80%" no Specify expanded container height (number is points, string is a percentage of the screen height) works only if expandable is true
backdropColor string "#00000055" no Change backdrop color and alpha
categoryColor string "#000000" no Change category item color
activeCategoryColor string "#005b96" no Change active category item color
categoryContainerColor string "#e3dbcd" no Change category container color
activeCategoryContainerColor string "#ffffff" no Change selected category container color
onCategoryChangeFailed function warn(info) no Callback on category change failed (info: {index, highestMeasuredFrameIndex, averageItemLength})
translation CategoryTranslation en no Translation object see translation section
disabledCategories CategoryTypes[] [] no Hide categories by passing their slugs
categoryOrder CategoryTypes[] [] no Set category sequence
onRequestClose function undefined no Handle onRequestClose in modal
categoryContainerStyles ViewStyle {} no Override category container styles
disableSafeArea boolean false no Disable safe area inside modal

๐Ÿ“Š Comparison

comparison table

๐Ÿ–ผ Usage as static

import { EmojiKeyboard } from 'rn-emoji-keyboard';

// ...

<EmojiKeyboard onEmojiSelected={handlePick} />

Example about serving as static keyboard you can find here.

๐Ÿ‡บ๐Ÿ‡ธ Internationalization

Pre-defined

Due to the limited translation possibilities, we only provide a few pre-defined translations into the following languages:

  • en - English ๐Ÿ‡บ๐Ÿ‡ธ
  • pl - Polish ๐Ÿ‡ต๐Ÿ‡ฑ
  • fr - French ๐Ÿ‡ซ๐Ÿ‡ท
  • it - Italian ๐Ÿ‡ฎ๐Ÿ‡น
  • ko - Korean ๐Ÿ‡ฐ๐Ÿ‡ท
  • id - Indonesian ๐Ÿ‡ฒ๐Ÿ‡จ
  • es - Spanish ๐Ÿ‡ช๐Ÿ‡ธ
  • de - German ๐Ÿ‡ฉ๐Ÿ‡ช

First import lang and use it as translation prop.

import { pl } from 'rn-emoji-keyboard';

// ...

translation={pl}

๐Ÿ Own

There is possibility to pass own translation to library with the prop called translation like this

translation={{
  smileys_emotion: 'Smileys & Emotion',
  people_body: 'People & Body',
  animals_nature: 'Animals & Nature',
  food_drink: 'Food & Drink',
  travel_places: 'Travel & Places',
  activities: 'Activities',
  objects: 'Objects',
  symbols: 'Symbols',
  flags: 'Flags',
}}

If you have written a translation into your language, we strongly encourage you to create a Pull Request and add your language to the package, following the example of other langs.

๐ŸŽ‰ Examples

You can clone the repo and run yarn example ios or yarn example android to preview app with this examples.

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

๐Ÿ“ˆ Future plans

  • Skin tone palette selector.
  • Write native module to display forbidden emojis on android.

โš–๏ธ License

MIT

๐Ÿ“ Contribute

If you want to contribute read the CONTRIBUTING.md guide.

rn-emoji-keyboard's People

Contributors

arunim2405 avatar jakex7 avatar kacper-mikolajczak avatar kiminjoong avatar mateki0 avatar mjaskowska avatar pierre275 avatar rikkyarisendi avatar sebdott avatar wojtus7 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.