mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
Don’t handle click with modifier keys. (#10)
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
|
||||
const isModifiedEvent = (event) =>
|
||||
!!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
||||
|
||||
const Linkable = (Inner) => {
|
||||
class LinkableWrapped extends Component {
|
||||
render() {
|
||||
@@ -29,7 +32,7 @@ const Linkable = (Inner) => {
|
||||
}
|
||||
onClick = e => {
|
||||
const action = this.getAction();
|
||||
if (action) {
|
||||
if (!isModifiedEvent(e) && action) {
|
||||
this.context.dispatch(action);
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user