2

In my app I have the following:

axios.get( '/game' ).then( ({ data }) => this.setState( { game:data } ) )
...
render() {
  const { game } = this.state
    
  return <View>
    {game && <SvgXml xml={game}/>}
  </View>
}

That works like a charm so far.

Now I want to add stuff like onPress-listeners to certain elements of the SVG and also to analyze the content of the XMl, for example, to count the specific items.

Is there a way to accomplish that out-of-box?

injecteer
  • 20,038
  • 4
  • 45
  • 89
  • Not out of the box, but you could use a library like fast-xml-parser. Then either map through the xml and create it piece-by-piece or use it to create Pressables in the right spots and render the whole svg the way you are now. – Abe Apr 21 '23 at 15:27
  • yeah, that's the only other option. – injecteer Apr 21 '23 at 16:11

0 Answers0