All Projects → sskhandek → react-native-emoji-input

sskhandek / react-native-emoji-input

Licence: MIT license
A fully-featured emoji keyboard ⌨️ for React Native ⚛️

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-emoji-input

Android Slidingemojikeyboard
Our Sliding Emoji Keyboard app.
Stars: ✭ 286 (+326.87%)
Mutual labels:  emoji, keyboard
Keyboardkit
KeyboardKit is a Swift library that helps you create custom keyboard extensions for iOS and ipadOS.
Stars: ✭ 438 (+553.73%)
Mutual labels:  emoji, keyboard
EasyEmoji
Help developers to quickly realize the expression of the keyboard
Stars: ✭ 24 (-64.18%)
Mutual labels:  emoji, keyboard
EmojiKeyBoard
自定义表情键盘(支持系统表情, 图片表情),仅供参考学习~
Stars: ✭ 36 (-46.27%)
Mutual labels:  emoji, keyboard
Android Keyboard
Android Keyboard with 180+ dictionaries. Support swipe input (sliding input), Emoji keyboard, AI predictions, dictionaries downloading, and keyboard themes.
Stars: ✭ 108 (+61.19%)
Mutual labels:  emoji, keyboard
Agemojikeyboard
Emoji Keyboard for iOS
Stars: ✭ 686 (+923.88%)
Mutual labels:  emoji, keyboard
Ppstickerkeyboard
iOS 表情键盘
Stars: ✭ 377 (+462.69%)
Mutual labels:  emoji, keyboard
EmoticonsBoard
Function keyboard and emotions. Android表情键盘,可动态更新表情。
Stars: ✭ 31 (-53.73%)
Mutual labels:  emoji, keyboard
Emojikeyboard
自定义表情键盘(支持系统表情, 图片表情),仅供参考学习~
Stars: ✭ 33 (-50.75%)
Mutual labels:  emoji, keyboard
Sodieremojikeyboardplus
支持自定义emoji表情,icon font , FontAwesome,斜体,超链接,粗体,下划线,字体,颜色,镂空字体等富文本
Stars: ✭ 14 (-79.1%)
Mutual labels:  emoji, keyboard
React Native Emoticons
react native emoticons(表情), including emoji😁
Stars: ✭ 119 (+77.61%)
Mutual labels:  emoji, keyboard
KeyboardKitPro
KeyboardKit Pro extends KeyboardKit with pro features.
Stars: ✭ 42 (-37.31%)
Mutual labels:  emoji, keyboard
react-keyevent
An easy-to-use keyboard event react component, Package size less than 3kb
Stars: ✭ 38 (-43.28%)
Mutual labels:  keyboard
aframe-keyboard
An Aframe component that renders a fully functional 3D keyboard, that works on mobile, desktop browers, and VR headsets!
Stars: ✭ 23 (-65.67%)
Mutual labels:  keyboard
Emojions
Embeddable Emoji Bar
Stars: ✭ 15 (-77.61%)
Mutual labels:  emoji
keyboard-layouter
Footprint auto placement plugin for keyboard layout
Stars: ✭ 73 (+8.96%)
Mutual labels:  keyboard
waffle microdox
Microdox Keyboard Build Guides
Stars: ✭ 19 (-71.64%)
Mutual labels:  keyboard
react-native-custom-keyboard-kit
React Native Custom Keyboard - Use your own custom keyboard instead of the system keyboard with React Native Custom Keyboard Kit. Its working on Android and iOS.
Stars: ✭ 83 (+23.88%)
Mutual labels:  keyboard
uchroma
An advanced driver for Razer Chroma hardware in Linux
Stars: ✭ 45 (-32.84%)
Mutual labels:  keyboard
keynavish
Control the mouse with the keyboard, on Windows.
Stars: ✭ 59 (-11.94%)
Mutual labels:  keyboard

React Native Emoji Input

npm version

A performant, customizable keyboard input for React Native. Built for and used in Opico.

Emoji Input Example

Installation

npm install --save react-native-emoji-input

or

yarn add react-native-emoji-input

If you make changes to the emoji synonyms files, you need to recompile the data sources. To compile the emoji dataset, run:

npx babel-node scripts/compile.js

Default Props

Prop Description type
onEmojiSelected A handler for the selected emoji function

Optional Props

Prop Description type default value
keyboardBackgroundColor Set the background color of the main keyboard pane string '#E3E1EC'
categoryUnhighlightedColor Set the default color of the category icons string 'lightgray'
categoryHighlightColor Set the color of a higlighted category icon string 'black'
width Width of the keyboard, number in px number window width
numColumns Number of emoji columns to display number 6
categoryLabelHeight The height of category title number 40
categoryLabelTextStyle The text size of the category title object {fontSize: 25}
emojiFontSize The default size of the emojis number 40
categoryFontSize The default size of the category icons number 40
numFrequentlyUsedEmoji Max number of frequently used emojis in the section number 18
showCategoryTab Whether the categories should be shown or not boolean true
enableSearch Whether the search bar should be shown or not boolean true
showCategoryTitleInSearchResults Whether the search title should be shown or not in search results boolean false
enableFrequentlyUsedEmoji Whether the frequently used category should be shown or not boolean true
defaultFrequentlyUsedEmoji An array of keys for emojis that will always render in the frequently used category Array(string) []
resetSearch Pass this in if you want to clear the the search boolean false
loggingFunction Logging function to be called when applicable.* function none
verboseLoggingFunction Same as loggingFunction but also provides strategy used to determine failed search boolean false
filterFunctions Array of functions that are used to limit which emojis should be rendered. Each of this function will be invoked with single parameter being emoji data and if every function returns true for emoji then this emoji will be included and displayed. Array(function) []
renderAheadOffset Specify how many pixels in advance you want views to be rendered. Increasing this value can help reduce blanks (if any). However, making this low can improve performance if you're having issues with it (see #36). Higher values also increase re-render compute number 1500

* When the search function yields this function is called. Additionally when the user clears the query box this function is called with the previous longest query since the last time the query box was empty. By default the function is called with one parameter, a string representing the query. If the verbose logging function parameter is set to true the function is called with a second parameter that is a string specifying why the function was called (either 'emptySearchResult' or 'longestPreviousQuery').

Usage

<EmojiInput
	onEmojiSelected={(emoji) => {console.log(emoji)}}
	/>

Compile emoji-data from source

The project is using iamcal/emoji-data. We only use the emoji.json that contains all the Unicode characters, short names, keywords, and categories. To embrace the latest version of Emoji, we suggest to compile the json file from source.

# You need first check out the `emoji-data` repo. We will use the compile tool provided in the repo.
git clone https://github.com/iamcal/emoji-data.git
cd emoji-data/build

# Pull data from Unicode standard
sh download_spec_files.sh

# Add new shortnames. Here're some examples in current dir, check out data_emoji_names.txt, data_emoji_names_v4.txt
vim data_emoji_names_vxx.txt # xx should be version of emoji, e.g. 11

# Compile from spec files into json
php build_map.php

Then copy the emoji-data/emoji.json to src/emoji-data/emoji-data.json and make sure the entry point is point to this json file.

// src/emoji-data/index.js
import emoji from './emoji-data.json';

Finally compile the data file that used in the keyboard.

node-babel ./scripts/compile.js

Missing Emojis on some devices

So why Emojis are displayed as X / other characters insetad of actual Emojis for some of your users?
That is because this library renders Emojis based on Font and Font need to support Emoji character in order to render it. And those fonts are updated with every system release, but because there is a lot of Android device manufacturers who are actually using Android as a base to come up with their own UI layer then it is harder for them to keep up with system updates.
You can read more about it here Emojipedia article link

So what can you do?
Apps such as Slack / WhatsApp are actually providing Emojis as little images so that they can be render regardless of operating system on mobile phone. The problem in React-Native is that there is no support for placing images in Input element at time of writing this.
Other solution is to limit number of possible emojis to most basic ones which are supported on most devices. Choosing emojis from Unicode 6.0 seems like solid solution: Unicode 6.0 Emojis List - you get tons of Emojis that are most likely to be correctly rendered across most of the devices.

In React-Native-Emoji-Input you can limit emojis displayed by using filterFunctions prop and passing array of functions. Each of this function takes emoji as an single parameter and if every function passed in filterFunctions prop returns true then emoji will be included in final list.
We can use that to show only emojis which are part of Unicode 6.0 or Unicode 6.1 like so:

	filterFunctionByUnicode = emoji => {
		return emoji.lib.added_in === "6.0" || emoji.lib.added_in === "6.1"
	}

	<EmojiInput
		onEmojiSelected={this.handleEmojiSelected}
		ref={emojiInput => this._emojiInput = emojiInput}
		resetSearch={this.state.reset}
		loggingFunction={this.verboseLoggingFunction.bind(this)}
		verboseLoggingFunction={true}
		filterFunctions={[this.filterFunctionByUnicode]}
	/>

This will render only emojis from Unicode 6.0 and Unicode 6.1 in input.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].