0.5.3 • Published 1 year ago

react-jdtwemoji v0.5.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-twemoji

A simple React wrapper for Twemoji.

All code orginally made by manyoushen, but now updated to support community-driven fork of Twemoji. It calls twemoji.parse() to convert emoji characters to Twemoji images.

Install

yarn add react-twemoji

or, if you use npm,

npm install react-twemoji

Usage

Simply use it to wrap your emotional content. Set the options prop to pass options to twemoji.parse.

import Twemoji from 'react-jdtwemoji';

<Twemoji options={{ className: 'twemoji' }}>
  <p>😂<span>😉</span></p>
</Twemoji>

It outputs the following HTML to DOM,

<div>
  <p>
    <img draggable="false" class="twemoji" alt="😂" src="https://twemoji.maxcdn.com/2/72x72/1f602.png">
    <span>
      <img draggable="false" class="twemoji" alt="😉" src="https://twemoji.maxcdn.com/2/72x72/1f609.png">
    </span>
  </p>
</div>

Props

NameTypeDefaultDescription
optionsobjectundefinedtwemoji.parse options.
noWrapperbooleanfalseWhen it is true, Twemoji will not render a wrapping element (with tag) to contain its children. Note that since twemoji.parse needs a DOM element reference, any direct pure text child of Twemoji is not parsed when noWrapper is true. E.g. foo in <Twemoji noWrapper={true}>foo<p>bar</p></Twemoji> is not parsed.
tagstringdivThe tag of the wrapping element. This option is ignored when noWrapper is true.

Run example

Building and Testing seems to be off. Test at your own will!

yarn run example

then open http://localhost:8080/

Development

Lint

yarn run lint

Test

yarn run test

Build

yarn run build
0.5.3

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.0

1 year ago