Skip to content

Adding handling for different Mouse Buttons to Pressable like Middle Mouse Button #831

Open
@Amir-A-M

Description

@Amir-A-M

Hello

Wouldn't it be good to have the ability to determine more events for web?

Like for Pressable if the Platform.OS === 'web' onPress event returned a value containing the key
Like

const onPressHandler = (e) => {
  if(Platform.OS === 'web' && e.key === 'Middle Mouse Button' ) {
   // do something...
  }
}

<Pressable
  onPress={onPressHandler}
/>

my specific use case was to use Pressable from react-native-gesture-handler instead of Link so items wouldn't get dragged by mouse in a carousel in web. but be able to open links in new tab. but there was no Middle Mouse Button handler
I finally used

Platform.OS === 'web' ? (
<a
  href={item.url}
  className='select-none [user-drag:none]'
  draggable='false'
>
) : 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions