react-native-svg
react-native-svg copied to clipboard
[Bug] the hitSlop value should use float on android like on ios
Description
On IOS, the hitSlop attribute of Svg supports the direct use of hitSlope={4}, but it can cause crashes on Android. The native view is also compatible with this writing style, so I think we should add compatibility in this area, otherwise it may lead to hidden cross end compatibility issues.
Steps to reproduce
On any android deviced use the code like
<Svg hitSlop={4}/>
- open the snack link, the device can not been open with
hitSlop={40} - change the code to
hitSlop={{top:40,bottom:40,left:40,right:40}}, the device can run success.
Snack or a link to a repository
https://snack.expo.dev/@bugyaluwang/react-native-svg-hit
SVG version
15.3.0
React Native version
0.74.2
Platforms
Android
JavaScript runtime
Hermes
Workflow
Expo Go
Architecture
Fabric (New Architecture)
Build type
Debug app & dev bundle
Device
Real device
Device model
MEIZU 20 Pro
Acknowledgements
Yes
this PR is ready for this issues: https://github.com/software-mansion/react-native-svg/pull/2323
Hi @GrinZero, I've made a PR solving this issue https://github.com/software-mansion/react-native-svg/pull/2407 with iOS and Android support. Thank you!