Simple emoji picker for react-native
Go to file
Eric Dvorsak 4f34652c86 fix prop-types 2017-10-27 15:04:50 +02:00
Example fix example 2016-08-17 10:57:13 +02:00
.gitignore first commit 2016-06-13 00:52:18 +02:00
.npmignore update example 2016-07-31 19:12:19 +02:00
LICENSE first commit 2016-06-13 00:52:18 +02:00
README.md Update README.md 2016-08-17 11:01:37 +02:00
animated-example.gif update example gif 2016-08-17 11:00:35 +02:00
index.js fix prop-types 2017-10-27 15:04:50 +02:00
package.json cleanup. fix building example. bump 2016-08-01 15:32:05 +02:00

README.md

Emoji picker for react-native

Powered by the awesome emoji-datasource

AnimatedExample

Installation

npm install react-native-emoji-picker

EmojiPicker component

const EmojiPicker = require('react-native-emoji-picker');

class Main extends React.Component {
  _emojiSelected(emoji) {
    console.log(emoji)
  }

  render() {
    return (
      <View style={styles.container}>
        <EmojiPicker 
          style={styles.emojiPicker} 
          onEmojiSelected={this._emojiSelected}/>
      </View>
    );
  }
}

Component props

  • onEmojiSelected (Function) - Required. Called when the user taps on an emoji.
  • style (Object) - Optional. Standard view style for the enclosing component.
  • clearButtonText (String) - Optional. Alternate text for the clear button. Defaults to 'Clear'.
  • hideClearButton (Bool) - Optional. Hide the clear button.
  • rows (Number) - Optional. Number of rows used to show all emojis. Defaults to 7.

EmojiOverlay component

Optional overlay which wraps the picker in a modal-like component

const { EmojiOverlay } = require('react-native-emoji-picker');

class Main extends React.Component {
  state = {
    showPicker: false,
  }

  _emojiSelected(emoji) {
    this.setState({showPicker: false})
    console.log(emoji)
  }

  render() {
    return (
      <View style={styles.container}>

        <TouchableHighlight
          onPress={() => this.setState({showPicker: true})}>
          <Text> Show picker </Text>
        </TouchableHighlight>

        <EmojiOverlay 
          style={styles.emojiPicker} 
          visible={this.state.showPicker}
          onTapOutsize={() => this.setState({showPicker: false})}
          horizontal={true}
          onEmojiSelected={this._emojiSelected}/>

      </View>
    );
  }
}

Component props

  • (...all EmojiPicker props)
  • visible (Bool) - Required. Is the overlay visible
  • onTapOutsize (Function) - Required. Callback for when user taps outside the EmojiPicker area. Should set visible to false