Search code examples
react-nativetouchableopacity

React Native : Prevent touch outside the body image


I have an Image of the body I am using a <Image> Component for that, and I have to mark wound on the body Image, but the thing is I have used <TouchableOpacity> for gain touch on the Image. Please Help me out on this. Thanks in advance.Wrong OneRight one


Solution

  • I'd suggest you use react-native-svg to render a path instead .. which will allow you to handle onPress event for the path

      <Svg {/**props */}>
       <Path
          d="..." /** Path */
          onPress={() => alert('Pressed!')}
        />
      </Svg>
    

    It'll also give you sharper looking image...