0.1.1-beta.0 • Published 4 years ago

@jake7/react-native-emoji-keyboard v0.1.1-beta.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

react-native-emoji-keyboard

Preview

Usage

import EmojiPicker from '{package-name}';

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",
      },
    */
  };

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

Installation

yarn add {package-name}

or

npm install {package-name}

Full Example

TODO

Accepted props (current implemented)

NameTypeDefault ValueRequiredDescription
onEmojiSelectedfunctionundefinedyesCallback on emoji selected
openbooleanfalseyesOpens modal picker
onClosefunctionundefinedyesRequest close modal runs when onEmojiSelected or backdrop pressed
emojiSizenumber28noCustom emoji size
headerStylesTextStyle{}noOverride category name styles
knobStylesViewStyle{}noOverride knob styles
containerStylesViewStyle{}noOverride container styles
hideHeaderbooleanfalsenoHide category names
expandablebooleantruenoShow knob and enable expand on swipe up
defaultHeightnumber | string"40%"noSpecify collapsed container height (number is points, string is a percentage of the screen height)
expandedHeightnumber | string"80%"noSpecify expanded container height (number is points, string is a percentage of the screen height) works only if expandable is true
backdropColorstring"#00000055"noChange backdrop color and alpha
categoryColorstring"#000000"noChange category item color
activeCategoryColorstring"#005b96"noChange active category item color
categoryContainerColorstring"#e3dbcd"noChange category container color
onCategoryChangeFailedfunctionwarn(info)noCallback on category change failed (info: {index, highestMeasuredFrameIndex, averageItemLength})
translationCategoryTranslationennoTranslation object see translation section
disabledCategoryCategoryTypes[][]noHide categories by passing their slugs

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

First import lang and use it as translation prop.

import { pl } from '{package-name}';

// ...

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.

License

MIT

0.1.1-beta.1

4 years ago

0.1.1-beta.0

4 years ago