New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-simple-emoji

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-emoji

Simple emoji picker.

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
2
-88.24%
Maintainers
1
Weekly downloads
 
Created
Source

react-simple-emoji

Build Status Coverage Status Dependency Status

A simple emoji picker component. :wink:

Install

$ npm install react-simple-emoji

How to Use

If you have main component, and you want to add emoji picker:

import React, { Component } from 'react';
import EmojiPicker from 'react-simple-emoji';

export default class App extends Component {
  constructor() {
    super();
    this.state = { text: '', showSelector: false };
    this.handleEmoji = this.handleEmoji.bind(this);
    this.selectEmoji = this.selectEmoji.bind(this);
    this.handleInputChange = this.handleInputChange.bind(this);
    this.handleKeyDown = this.handleKeyDown.bind(this);
  }

  selectEmoji() {
    this.setState({ showSelector: !this.state.showSelector });
  }

  handleInputChange(e) {
    const text = e.target.value;
    this.setState({ text });
  }

  handleKeyDown(e) {
    if (e.keyCode === 13) return this.setState({ text: '' });
  }

  handleEmoji(emojiText) {
    const inpuText = this.state.text;
    this.setState({ text: `${inpuText}:${emojiText}:` });
  }

  render() {
    return (
      <div>
		<input
		  value={this.state.text}
		  type="text"
		  onChange={this.handleInputChange}
		  onKeyDown={this.handleKeyDown}
		/>
		<EmojiPicker
		  show={this.state.showSelector}
		  selector={this.selectEmoji}
		  handleEmoji={this.handleEmoji}
		/>
      </div>
    );
  }
}

API

props

show

Required Type: boolean

Showing emoji picker state.

selector

Required Type: function

Change emoji picker showing state.

handleEmoji

Required Type: function

Handle input text and emoji.

emojiSearchInputStyle

Type: object

Custom your emoji search input style.

selectorStyle

Type: object

Custom your selector box style.

Test

$ npm test

Lint

$ npm run lint

LICENSE

MIT © Peng Jie

Keywords

react

FAQs

Package last updated on 21 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts