[pay 2021-09-17] Add skin-tone support for Emojis
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
NA
Expected Result:
- Tabbed view for Emoji Picker
- Skin tone support for Emojis
- Larger set for Emoji

Actual Result:
- Single searchable dropdown
- Less user friendly
- No skin tone support

Workaround:
Yes
Platform:
Where is this issue occurring?
- Web
- iOS
- Android
- Desktop App
- Mobile Web
Version Number: Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL:
Proposed Solution
Replace the current component with an external library
https://github.com/missive/emoji-mart
Triggered auto assignment to @conorpendergrast (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.
Big fan in particular of supporting skin tones rather than the single current skin tone.
For the solution, I think we can do this without implementing an external library, right? We can just use the unicode modifiers. Passing to engineering to review and confirm that solution would work
Triggered auto assignment to @TomatoToaster (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
@conorpendergrast Sure that can be done too. We can extend the current list by storing their unicodes.
The picker UI could look something like this (with a picker for skin-tone):

Ah TIL how skin tones work with emoji sets like this! I think that modifier part will work ππΎ .
I'm not sure how you'll save the modifier. I'm thinking that you might have to store it in an NVP for the user, but maybe there's another solution I'm not aware of. For the proposal, if it's concluded that there needs to be some internal work done to store that information for a user, I'm happy to help out.
Triggered auto assignment to @puneetlath (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
@TomatoToaster Currently what we are doing is storing the rendered emoji as is.
Storing the skin tone for user as NVP should help.
Iβve raised a separate issue for typing the emoji code too. https://github.com/Expensify/App/issues/4324
Weβve got two approaches to solve this.
-
Always store the Unicode in the text like :thumbs_up:skin-tone-2: and render to and fro from Markdown and HTML.
-
We can render the Emoji when the user chooses from the Emoji picker based on the skin tone nvp and store the rendered emoji in the chat
2 things to mention here:
- WRT the original solution, the suggested library is written in react, not react native, so I don't think it would work for our purposes
- We already have skin tones saved for all emojis that support skin tone in the types field. My plan for skin tones was to just create a new NVP something like
preferredUserSkinTonethat stores the index of the skin tone they chose. Then for every emoji, ifemoji.typeexists, just insertemoji.type[x]instead ofemoji.code. What do you think of that solution?
Additionally, (and I know you couldn't have known this @mananjadhav) we already have a mockup for what we want the emoji picker to look like including the skin tone picker :smile:

@stitesExpensify I did check the emoji array and the types that we store. My second approach is exactly what youβve mentioned, picking the emojis based on skinTone types should work.
As I also mentioned earlier would need an nvp to be stored on the backend.
Checked the mock-up. Those look great. One open issue I saw somewhere was that the current emoji picker doesnβt work well in the landscape mode, hence I didnβt put the picker at the bottom like slack.
Gotcha. I think we'll stick to the mockups here, and fix the picker in landscape mode if necessary.
This doesn't actually require any backend changes though. You can just create a new NVP with the name expensify_emojiSkinToneIndex from the front end :smile:
@stitesExpensify I've managed to get some pieces working and send in a Proposal
Approach
- Add
const skinTones = ['ππΏ', 'ππΎ', 'ππ½', 'ππΌ', 'ππ»'];to the emojis.js - Maximum changes are in EmojiPickerMenu/index.js
// Add flags in the state
this.state = {
preferredSkinTone: undefined,
highlightedSkinToneIndex: -1,
... // old state vars
};
// Add preferredSkinTone to props and defaultProps as preferredSkinTone: PropTypes.number and preferredSkinTone: null,
// Set state from Props
componentDidMount() {
// Other code before this
this.state.preferredSkinTone = this.props.preferredSkinTone;
}
// Update preferred skin tone
setPreferredSkinTone(skinToneIndex) {
this.setState({preferredSkinTone: skinToneIndex});
if (this.props.updateSelectedSkinTone) {
this.props.updateSelectedSkinTone(skinToneIndex); // Onyx call will come here
}
}
// renderItem
renderItem({item, index}) {
const {code, header, types} = item;
if (code === CONST.EMOJI_SPACER) {
return null;
}
let emojiCode = code;
if (types && this.state.preferredSkinTone && types[this.state.preferredSkinTone]) {
emojiCode = types[this.state.preferredSkinTone];
}
return (
<EmojiPickerMenuItem
onPress={this.props.onEmojiSelected}
onHover={() => this.setState({highlightedIndex: index})}
emoji={`${code}\uFE0F`}
emoji={`${emojiCode}\uFE0F`}
isHighlighted={index === this.state.highlightedIndex}
emojiSize={this.emojiSize}
/>
}
// Update FlatList to render on preferredSkinTone : wip
// Add to FlatList
extraData={[this.state.filteredEmojis, this.state.highlightedIndex, this.state.preferredSkinTone]}
// Skin tone picker: Needs design work
<View style={[styles.flexRow]}>
{
skinTones.map((skinTone, index) => (
<EmojiPickerMenuItem
onPress={() => this.setPreferredSkinTone(index)}
onHover={() => this.setState({highlightedSkinToneIndex: index})}
emoji={`${skinTone}\uFE0F`}
isHighlighted={index === this.state.highlightedSkinToneIndex}
emojiSize={this.emojiSize}
/>
))
}
</View>
- Onyx related changes
// Add to ONYXKEYS.js
PREFERRED_SKIN_TONE: 'expensify_emojiSkinToneIndex',
// ReportActionCompose
withOnyx({
// other keys,
preferredSkinTone: {
key: ONYXKEYS.PREFERRED_SKIN_TONE
}
});
<EmojiPickerMenu
onEmojiSelected={this.addEmojiToTextBox}
preferredSkinTone={this.props.preferredSkinTone}
updateSelectedSkinTone={this.updateSelectedSkinTone}
ref={el => this.emojiSearchInput = el}
/>
updateSelectedSkinTone(skinToneIndex) {
Onyx.set(ONYXKEYS.PREFERRED_SKIN_TONE, skinToneIndex);
}
Caveats:
- Assumption is that length and the order of the skin-tones and types array are the same.
- Need the proper design to implement the picker. I can see that the picker mockup also has category icons. I haven't factored those in this one.
Phew... Turns out a changes are a little more lines than I expected.
@puneetlath Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Hi @mananjadhav that looks good to me! @puneetlath can we make an upwork job for this and hire @mananjadhav ?
Add const skinTones = ['ππΏ', 'ππΎ', 'ππ½', 'ππΌ', 'ππ»']; to the emojis.js
What is the purpose of this?
Assumption is that length and the order of the skin-tones and types array are the same.
AFAICT they are. We can fix the emojis that aren't later if necessary.
Need the proper design to implement the picker. I can see that the picker mockup also has category icons. I haven't factored those in this one.
Can you just use the design I posted before, while ignoring the categories section?
@stitesExpensify skinTones array is to populate the skin tone list at the bottom of the picker
Ah, totally makes sense. Thanks for the clarification
While @puneetlath creates a job and sends an invite, I'll get started.
btw @stitesExpensify I am guessing the Emojipicker by itself works responsive on all devices and I don't have to worry about the container?
Apart from what we've discussed anything else you think I should be taking care of?
btw @stitesExpensify I am guessing the Emojipicker by itself works responsive on all devices and I don't have to worry about the container?
emojiPickerMenu.js has both an index and index.native so we'll need to update both.
Apart from what we've discussed anything else you think I should be taking care of?
The only thing I can think of is that your code doesn't include any server-side saving of the emoji preference. We are going to want to store that in a new NVP (by calling NameValuePair.set) called preferredUserSkinTone. We can then get that on app load and save it in onyx to be used by the emoji picker.
Thanks for the note. I'll check these and test.
Just chatting internally about what the job size should be. Will create the Upwork job in the next day or two.
@mananjadhav do you need any design assets? Or do you have everything you need from a design perspective?
@puneetlath I don't think I need any. Because the skin tones are already available in the emoji list. If there's something specific you guys already have, then do share. Being a bigger task, I'll be taking the weekend to complete this.