Closed darekg11 closed 5 years ago
Seems like Your Travis is broken currently?
I don't think we have an effective travis.
I like the idea, but could you make it more general. Can we pass an array of filter functions to the component instead of specifying only the unicode version?
How would you see implementation? The filter function would take an param that is an emoji
entry in lib and upon returning true
it would be included in rendered list?
Like (example of changing my unicode only implementation to external filter function):
Let's assume that this is part of my component and state.unicode
is an array containing such entries: ["6.0", "6.1"]
And emoji
param is passed from EmojiInput
component
filterFunction = emoji => {
return this.state.unicode.indexOf(emoji.lib.added_in) !== -1
}
And pass it to EmojiInput
via prop like:
<EmojiInput filterFunction={this.filterFunction} />
And component calls the external filter function like so:
this.filtered =
this.props.filterFunction
? _.pickBy(emoji, value => this.props.filterFunction(value))
: emoji
Am I on track with what you have in mind?
Yeah that's just my thought. I think this approach can bring more flexibility to the component. You can even use an array of filter functions.
<EmojiInput filterFunctions={[ this.filterFunction ]} />
defaultProps = {
filterFunctions: []
}
this.filtered = _.filter(emojis, emoji => _.every(this.props.filterFunctions, fn => fn(emoji)));
@rijn Nice idea, I will push change with that around end of the week. :+1:
Have to close this one in favor of:
https://github.com/sskhandek/react-native-emoji-input/pull/34
Since I don't have access anymore to organization account from which I have created original PR and I can't push there.
Relate to any issue?
https://github.com/sskhandek/react-native-emoji-input/issues/5
It is a temporary workaround that would allow user of this library to avoid missing emojis being render as
X
Breaking change?
Nope, by default all emojis will be rendered as before.
What this PR does?
Adds new
includeOnlySubsets
prop allowing user to pass an array of strings being Unicode versions and filters possible emojis by that Unicode Versions.Example of usage:
Change Preview:
Before on my Huawei P8Lite running Android 6.0:
![before](https://user-images.githubusercontent.com/11317951/53982863-41c49900-4116-11e9-985b-83044d0ded04.png)
After enabling only 6.0 Unicode:
![after](https://user-images.githubusercontent.com/11317951/53982900-543ed280-4116-11e9-9ade-6363a4858b03.png)