Skip to content
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

Fallback doesn't fire if the emoji name isn't recognised #199

Closed
andrewhillcode opened this issue Jul 2, 2018 · 4 comments
Closed

Fallback doesn't fire if the emoji name isn't recognised #199

andrewhillcode opened this issue Jul 2, 2018 · 4 comments

Comments

@andrewhillcode
Copy link

andrewhillcode commented Jul 2, 2018

I'm wrapping everything that matches my colon regex like :crocodile: and making them Emoji components.

The fallback only triggers when a recognised emoji name (like :shrug:) is not supported in certain sets (like Messenger). Using something like :shrugtest: won't trigger the fallback and the Emoji component will render nothing instead of a string: :shrugtest:

@darklightblue
Copy link

I am actually facing the same issue, Upon checking the source code it seems that this is where the bug is:


(there should be a fallback here)

  let data = _getData(props)
  if (!data) {
    return null
  }

And:

return null

   if (data.emojis.hasOwnProperty(emoji)) {
      emojiData = data.emojis[emoji]
    } else {
      return null
    }

@vivaldi-va
Copy link

definitely feel that the fallback callback should fire in this case. Perhaps with an additional argument returning the value you added to the emoji prop.

For instance emoji=":foo:" should have the callback arguments of null and :foo:, which would allow rendering a string fallback, for example.

@EtienneLem
Copy link
Member

Of course! Made it so fallback always receive the emoji object (if found) and the props. It’s up to the developer to use whatever props they want to handle the fallback. Example in README.

@tuomohopia
Copy link

The fallback still appears not to fire if the emoji={..} is an object instead of a string. For example:

emoji={{ id, skin: 1 }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants