call onClick from metaItem when have to

This commit is contained in:
NikolaBorislavovHristov 2019-12-09 00:23:41 +02:00
parent 251b7e6f5e
commit 4ac390eafb

View file

@ -20,10 +20,14 @@ const ICON_FOR_TYPE = new Map([
const MetaItem = React.memo(({ className, type, name, poster, posterShape, playIcon, progress, options, dataset, optionOnSelect, ...props }) => {
const [menuOpen, onMenuOpen, onMenuClose] = useBinaryState(false);
const metaItemOnClick = React.useCallback((event) => {
if (typeof props.onClick === 'function') {
props.onClick(event);
}
if (event.nativeEvent.selectPrevented) {
event.preventDefault();
}
}, []);
}, [props.onClick]);
const menuOnClick = React.useCallback((event) => {
event.nativeEvent.selectPrevented = true;
}, []);