Get Name of the Picker?
See original GitHub issueI saw the merge where you can now pass up the event with the onChange handler, so I’m just having trouble actually getting the name of the picker I want to see. This is what I currently have for the Picker right now (which is mainly taken from docs):
{ (this.state.displayColorPicker) ?
<div style={ styles.popover }>
<div style={ styles.cover } onClick={ this.handleClose }></div>
<SketchPicker color={ this.state.color } label="bgColor" onChange={ this.props.onChange } name={this.props.name} />
</div> : null }
And my onChange is as such:
handleColorChange(color, event) {
const target = event.target;
const name = target.name;
console.log("NAME: " + name)
console.log("COLOR CHANGING:" + JSON.stringify(color))
// this.setState({ color: color.hex })
};
I can succesfully get the color information, I’m just stuck on trying to get which color should go where. Feeling like I’m probably missing a very basic step here. 😕
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Pick a random name / winner - Comment Picker
Name Picker is an easy-to-use online tool to quickly draw a random name from a list of names and instantly pick a winner....
Read more >Random Name Picker | Spin The Wheel to Pick The Winner
This Free & ᴇᴀsʏ⁻ᵗᵒ⁻ᵘˢᵉ tool allows you to pick a random name (winner) from a list of names (it supports up to 200k...
Read more >Wheel of Names | Random name picker
Free and easy to use spinner. Used by teachers and for raffles. Enter names and spin the wheel to pick a random winner....
Read more >Easy Random Name Picker - Random Word Generator
The Random Name Generator creates random names including girl names, boy names, baby names and last names. Use this random name picker to...
Read more >Random Name Picker - Microsoft Apps
Description. Picks a random name from a list of names. The App supports custom backgrounds so you can show it to your audience...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have thought about this and I don’t think adding this complexity to the library makes sense. What I propose is just using a curry function like below to pass the names of multiple pickers:
and then you would use it like this:
The
handleColorChange
would take the name as the first argument and then retuns the traditional change information, along with the name.Not sure if anyone is still following this but doesn’t currying a function like that create copies of the handleColorChange function? so if you are mapping say 1000 things that could have a color changing option you’ll start to have performance issues.