missive / emoji-mart

🏪 One component to pick them all
https://missiveapp.com/open/emoji-mart
MIT License
8.59k stars 826 forks source link

Picker errors when onSelect is missing #195

Closed dtweedle closed 6 years ago

dtweedle commented 6 years ago

Description

When using the picker component, if the onSelect prop is not provided the picker will error out when the user makes a selection.

Partial Stack Trace Log

nimble-picker.js:251 Uncaught TypeError: this.props.onSelect is not a function
    at NimblePicker.handleEmojiSelect (nimble-picker.js:251)
    at NimblePicker.handleEmojiClick (nimble-picker.js:244)
    at _handleClick (nimble-emoji.js:45)
    at onClick (nimble-emoji.js:170)

Suggested fix

The docs very clearly show that onSelect is not a required prop, either make it required or add in a conditional gate to prevent the call from being made unless the prop is provided.

EtienneLem commented 6 years ago

Any chance you’re using v6.2.0? This bug was fixed in v2.6.1: https://github.com/missive/emoji-mart/releases/tag/v2.6.1

dtweedle commented 6 years ago

After having a look it seems like the package version installed is version 2.6.0 but the lock file and package was both looking for version 2.6.1, not sure how I landed up in that state. But yes. Looks to be fixed.

Sorry about the erroneous report.

EtienneLem commented 6 years ago

No worries, thanks for the report 👍