Merge pull request #33140 from erik-beus/menuitem-value

Allow any for value prop on MenuItem in react-aria-menubutton
This commit is contained in:
Andrew Casey
2019-02-19 18:18:26 -08:00
committed by GitHub
2 changed files with 17 additions and 2 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for react-aria-menubutton 6.1
// Type definitions for react-aria-menubutton 6.2
// Project: https://github.com/davidtheclark/react-aria-menubutton
// Definitions by: Muhammad Fawwaz Orabi <https://github.com/forabi>
// Chris Rohlfs <https://github.com/crohlfs>
@@ -100,7 +100,7 @@ export interface MenuItemProps<T extends HTMLElement>
* If value has a value, it will be passed to the onSelection handler
* when the `MenuItem` is selected
*/
value?: string | boolean | number;
value?: any;
/**
* If `text` has a value, its first letter will be the letter a user can
@@ -121,3 +121,18 @@ closeMenu("", { focusMenu: true });
openMenu("");
openMenu("", { focusMenu: true });
class ObjectMenuItem extends React.Component {
render() {
const itemValue = { name: "Test name", label: "Only item to select" };
return (
<Wrapper onSelection={(value) => console.log(value.name)}>
<li>
<MenuItem value={itemValue} >{itemValue.label}</MenuItem>
</li>
</Wrapper>
);
}
}
ReactDOM.render(<ObjectMenuItem />, document.body);