PEZ
PEZ

Reputation: 17004

How to grow the touchable area on React Native SVG elements on Android?

As part of a SVG sketch, I use a quite small dot as a slider control. To grow the touchable area I have added a thick, transparent border. This works on iOS, but not on Android. What can I do on Android to fix this? I've tried adding hitSlop and padding, but none of those seem to work on SVG elements.

Upvotes: 0

Views: 910

Answers (1)

Joshua Obritsch
Joshua Obritsch

Reputation: 1293

Add a transparent container around the Svg and handle your touches on that instead of on the Svg.

For example:

<TouchableWithoutFeedback>
  <MySVGComponent />
</TouchableWithoutFeedback>

Upvotes: 1

Related Questions