software-mansion / software-mansion/react-native-svg

Web: onClick property not respected

Open
#2,865 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Repro provided
Dominant language
TypeScript
Stars
8k
Forks
1.2k
Avg merge
10d 9h
Merged PRs (30d)
2

Description

Description

My project is a web application.

I use onClick for Svg icons in my app and it worked on 14.1.0, but when i upgraded to 15.12 the onClick callback never gets triggered when i click the Svg (web). Changing it to onPress fixes the issue, and now i know that onClick is not idiomatic for react-native libs, but:

  • I would expect onClick to be also respected in web environment
  • if this is the intended behavior, the component should now allow onClick and there should be type errors

If i understood correctly this is introduced in 15.5 (issue not present in 15.4).

Steps to reproduce
  1. usereact-native-svg version 15.5 or later
  2. Create Svg with onClick property
  3. That onClick is not respected and there are no type errors
Snack or a link to a repository

https://snack.expo.dev/@jiojosbg/isnored-onclick-15-5-0

SVG version

15.12.0

React Native version

0.81.5

Platforms

Web

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Snack reproduction and compare react-native-svg 15.4 with 15.5 or later on the web. Trace the SVG onClick handling and its TypeScript types; done when the behavior matches the intended contract, either by triggering the callback or reporting a type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.