Handle native change in shouldComponentUpdate

release
Etienne Lemay 2017-02-17 10:48:57 -05:00
parent fc14f939c1
commit 1f88be1e8b
3 changed files with 6 additions and 3 deletions

View File

@ -16,9 +16,9 @@ export default class Category extends React.Component {
}
shouldComponentUpdate(nextProps, nextState) {
var { name, perLine, hasStickyPosition, emojis, emojiProps } = this.props,
var { name, perLine, native, hasStickyPosition, emojis, emojiProps } = this.props,
{ skin, size, set } = emojiProps,
{ perLine: nextPerLine, hasStickyPosition: nextHasStickyPosition, emojis: nextEmojis, emojiProps: nextEmojiProps } = nextProps,
{ perLine: nextPerLine, native: nextNative, hasStickyPosition: nextHasStickyPosition, emojis: nextEmojis, emojiProps: nextEmojiProps } = nextProps,
{ skin: nextSkin, size: nextSize, set: nextSet } = nextEmojiProps,
shouldUpdate = false
@ -30,7 +30,7 @@ export default class Category extends React.Component {
shouldUpdate = !(emojis == nextEmojis)
}
if (skin != nextSkin || size != nextSize || set != nextSet || hasStickyPosition != nextHasStickyPosition) {
if (skin != nextSkin || size != nextSize || native != nextNative || set != nextSet || hasStickyPosition != nextHasStickyPosition) {
shouldUpdate = true
}
@ -152,6 +152,7 @@ Category.propTypes = {
emojis: React.PropTypes.array,
hasStickyPosition: React.PropTypes.bool,
name: React.PropTypes.string.isRequired,
native: React.PropTypes.bool.isRequired,
perLine: React.PropTypes.number.isRequired,
emojiProps: React.PropTypes.object.isRequired,
}

View File

@ -16,6 +16,7 @@ export default class Emoji extends React.Component {
return (
this.hasSkinVariations && nextProps.skin != this.props.skin ||
nextProps.size != this.props.size ||
nextProps.native != this.props.native ||
nextProps.set != this.props.set ||
nextProps.emoji != this.props.emoji
)

View File

@ -291,6 +291,7 @@ export default class Picker extends React.Component {
name={category.name}
emojis={category.emojis}
perLine={perLine}
native={native}
hasStickyPosition={this.hasStickyPosition}
i18n={this.i18n}
emojiProps={{