-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to display the emoji list with react #15
Comments
Hey @omaijdot so you should be able to use this library with React, but jQuery is a peer dependency meaning that you'll also have to have jQuery installed as an NPM dependency. Also, make sure that you're instantiating the picker inside of import React from "react"
import EmojiPicker from "rm-emoji-picker"
class EmojiContainer extends React.Component {
render () {
return (
<div className="emoji-container" ref="emoji_container">
<pre className="input-area" contenteditable="true" ref="editor"></pre>
<img src="/your/emoji-icon.something" ref="icon" />
</div>
)
}
componentDidMount () {
const container = this.refs.emoji_container
const editor = this.refs.editor
const icon = this.refs.icon
const picker = new EmojiPicker()
picker.listenOn(icon, container, editor)
}
} Hope this helps. In summary, make sure you have jQuery installed and make sure that the DOM nodes you're passing to the picker are instances of HTMLElement. |
Thanks it works. now the emoji selection is shown. now, i just need to play around with css to fix the cosmetic. and could you please explain to me regards callback function below code callback : (emoji, category, node) => { because i want to show the emoji as symbol in text area, and translate it when i posting it. really appreciate your help 👍 |
oops, nevermind, it able to translate into the textarea anyway. Thank you 👍 |
Hi, may i know how to use this emoji with react? i tried using this emoji in my JSX file, and the emoji button not able to display the emoji selection. do i miss something?
The text was updated successfully, but these errors were encountered: