1.0.1 • Published 1 year ago

react-native-rn-emojikeyboard v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

React Native Emoji Board

npm version

React Native Emoji Board is a customizable component similar to native keyboard but only with emoji for both iOS and Android. You can use this component as a keyboard input or emoji picker.

Emoji Board

Installation

  1. yarn add react-native-emoji-board
  2. yarn add react-native-vector-icons if you don't have it
  3. yarn add @react-native-community/viewpager if you don't have it

Linking

>= 0.60 Autolinking will just do the job.

< 0.60

react-native link react-native-vector-icons

react-native link @react-native-community/viewpager

Props

Required Props

PropDescriptiontype
onClickCall back function when you clciked on emojifunction

Optional Props

PropDescriptiontypedefault value
showBoardShow or hide Emoji board with animationbooleanfalse
customEmojiSee Custom Emojiarray[]
categoriesDefault full categories from emoji-datasourcearraySee defaultProps.categories
blackListExclude emojis based on short_namearray[]
numRowsNumber of emoji rows to display per slidenumber8
numColsNumber of emoji columns to display per slidenumber5
emojiSizeDefault emoji sizenumber24
tabBarPositionDefault category nav positionstring'bottom'
hideBackSpaceShow or hide backspace iconbooleanfalse
categoryDefautColorDefault category icon colorstring'#aaa'
categoryHighlightColorDefault category icon highlight colorstring'#000'
categoryIconSizeDefault category icon sizestring20
containerStyleMain container style, same as Layout Propsobject{}
tabBarStyleCategory bar style, same as Layout Propsobject{}
labelStyleCategory label style, same as Text Propsobject{}
onRemoveCall back function when backspace get clickedfunctionnull

If you want to support less category or modify the icon, here is the categories props:

PropDescriptiontype
nameCategory namestring
iconTypeOnly support MaterialCommunityIcons and FontAwesome, you can use defined iconTypestring
iconIcon/Font name, you can find list from herestring

Example Code

import EmojiBoard from 'react-native-emoji-board'

const App: () => React$Node = () => {
    const [show, setShow] = useState(false);
    const onClick = emoji => {
        console.log(emoji);
    };

    return (
        <>
            <StatusBar barStyle="dark-content" />
            <TouchableOpacity onPress={() => setShow(!show)}>
                <Text>click here</Text>
            </TouchableOpacity>
            <EmojiBoard showBoard={show} onClick={onClick} />
        </>
    );
};

Custom Emojis

Example:

const customEmojis = [
    {
        code: '🎅🏼',
        img: 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/160/apple/237/father-christmas_1f385.png',
        name: 'santa',
        category: 'Smileys & Emotion',
        sort_order: 1,
        skins: [
            {
                img: 'https://github.githubassets.com/images/icons/emoji/octocat.png',
                name: 'octocat',
            }
        ]
        
    }
]
PropDescriptiontype
codeNative emoji(optional, fallback to image)string
imgIf you would like to have custom image instead, don't set codestring
nameEmoji/image namestring
categoryEmoji category, need to match with what you have in categories propsstring
sort_orderSort ordernumber
skinsSkin support, same props with abovearray

Credit

Inspired by xiewang/react-native-emoticons