You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Dropdown takes an array of plain objects via the options prop. These objects are used to create the <Dropdown.Item /> children. Each object is spread as props on each item:
We should also accept an array of strings or elements. An array of strings would be used as the item text and value. Whereas, an array of elements would be cloned.
We created src/factories for this exact purpose. They handle mapping a primitive value to props, spreading props objects, and cloning elements while merging className and spreading props. We should then use createFactory to create a createDropdownItem factory, see src/factories/index.js. We would then use the createDropdownItem factory in place of the _.map() callback used above.
The text was updated successfully, but these errors were encountered:
The docs state that Dropdown.Item onClick event is supposed to trigger func(event, value, text) but I see the text value as undefined and only ever see value. Is this incomplete or part of this request to enhance Dropdown? (I was trying to get the name and value of selected item but only ever get the value)
handleItemClick = (e, value, text) => {
console.log(value);
console.log(text);
} // displays value but text is `undefined`
<Dropdown
trigger={<Icon name='settings'/>}
pointing='top right'
icon={null}>
<Dropdown.Menu>
<Dropdown.Item text='View' name='view' value={key} onClick={this.handleItemClick} />
<Dropdown.Item text='Delete' name='delete' value={key} onClick={this.handleItemClick} />
</Dropdown.Menu>
</Dropdown>
Closing this for housekeeping. Per my notes in the PR, I'm not sure this work is worth it. The gains are minor and the repercussions are major. We've also not had hardly any community interest here.
Currently, the Dropdown takes an array of plain objects via the
options
prop. These objects are used to create the<Dropdown.Item />
children. Each object is spread as props on each item:We should also accept an array of strings or elements. An array of strings would be used as the item text and value. Whereas, an array of elements would be cloned.
We created
src/factories
for this exact purpose. They handle mapping a primitive value to props, spreading props objects, and cloning elements while merging className and spreading props. We should then usecreateFactory
to create acreateDropdownItem
factory, seesrc/factories/index.js
. We would then use thecreateDropdownItem
factory in place of the_.map()
callback used above.The text was updated successfully, but these errors were encountered: