How to use the react-emoji-render.toArray function in react-emoji-render

To help you get started, we’ve selected a few react-emoji-render examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / hubs / src / react-components / chat-message.js View on Github external
function renderChatMessage(body, from, allowEmojiRender, lowResolution) {
  const isOneLine = body.split("\n").length === 1;
  const context = messageCanvas.getContext("2d");
  const emoji = toEmojis(body);
  const isEmoji =
    allowEmojiRender &&
    emoji.length === 1 &&
    emoji[0].props &&
    emoji[0].props.children.match &&
    emoji[0].props.children.match(emojiRegex);

  const el = document.createElement("div");
  el.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
  el.setAttribute("class", `${styles.presenceLog} ${styles.presenceLogSpawn}`);

  // The element is added to the DOM in order to have layout compute the width & height,
  // and then it is removed after being rendered.
  document.body.appendChild(el);

  const entryDom = (
github jitsi / jitsi-meet / react / features / chat / components / web / ChatMessage.js View on Github external
render() {
        const { message } = this.props;
        const processedMessage = [];

        // content is an array of text and emoji components
        const content = toArray(this._getMessageText(), { className: 'smiley' });

        content.forEach(i => {
            if (typeof i === 'string') {
                processedMessage.push({ i });
            } else {
                processedMessage.push(i);
            }
        });

        return (
            <div>
                <div>
                    <div>
                        <div>
                            { this.props.showDisplayName &amp;&amp; this._renderDisplayName() }
                            <div></div></div></div></div></div>
github meedan / check-web / src / app / components / ParsedText.js View on Github external
const emojified = lines.map(line =>
    toArray(line, {
      protocol: '',
      baseUrl: '//cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/png/',
      size: '',
      ext: 'png',
    }));
github mdyna / mdyna-app / app / components / MarkdownEditor.jsx View on Github external
const parseEmojis = (value) => {
  const emojisArray = toArray(value);
  const newValue = emojisArray.reduce((previous, current) => {
    if (typeof current === 'string') return previous + current;
    return previous + current.props.children;
  }, '');
  return newValue !== value ? newValue : null;
};
github enzoferey / slate-instant-replace / examples / multiple-transforms-example / src / Slate.js View on Github external
const parseEmojis = value => {
  const emojisArray = toArray(value);
  const newValue = emojisArray.reduce((previous, current) => {
    if (typeof current === "string") return previous + current;
    return previous + current.props.children;
  }, "");
  return newValue;
};
github meedan / check-web / src / app / helpers.js View on Github external
function emojify(text) {
  try {
    return toArray(text).map(e => typeof e === 'string' ? e : e.props.children).join('');
  } catch (e) {
    return text;
  }
}
github mozilla / hubs / src / react-components / chat-message.js View on Github external
}

  const cleanedBody = (mono ? body.substring(1, body.length - 1) : body).trim();

  return (
    <div>
      {from &amp;&amp; (
        <div>
          {from}:
        </div>
      )}
      <div>
        {toEmojis(cleanedBody)}
      </div>
    </div>
  );
};
github enzoferey / slate-instant-replace / examples / emojis-example / src / Slate.js View on Github external
const parseEmojis = value => {
  const emojisArray = toArray(value);
  const newValue = emojisArray.reduce((previous, current) => {
    if (typeof current === "string") return previous + current;
    return previous + current.props.children;
  }, "");
  return newValue;
};

react-emoji-render

Render emoji's the way your users expect.

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis

Popular react-emoji-render functions