From 8e74b656eca59c4d19c45522caad0b2e99cd64c3 Mon Sep 17 00:00:00 2001 From: matthova Date: Sun, 6 Oct 2019 02:51:16 -0700 Subject: [PATCH] enable modifier click events --- src/Link.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Link.js b/src/Link.js index 3ec19e0..ef5d36c 100644 --- a/src/Link.js +++ b/src/Link.js @@ -2,6 +2,9 @@ import React, { Component } from 'react'; import { withNavigation, NavigationActions } from '@react-navigation/core'; import queryString from 'query-string'; +const isModifierClickEvent = e => + !!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey); + const getTopNavigation = navigation => { const parent = navigation.dangerouslyGetParent(); if (parent) { @@ -58,8 +61,10 @@ class LinkWithNavigation extends Component { { - navigation.dispatch(navAction); - e.preventDefault(); + if (!isModifierClickEvent(e)) { + navigation.dispatch(navAction); + e.preventDefault(); + } }} > {children}