P粉4028061752023-09-07 00:20:57
So far, "react-native-svg": "~13.4.0"
Custom fonts are not supported, or I can't find a documented way to use them.
So I found a very simple solution based on
:
render() { const { countdown } = this.state return <> <ForeignObject x={85} y={94} height={14} key={countdown}> <Text style={{ fontFamily:'Robo Numbers' }}>{countdown}</Text> </ForeignObject> <> }
The CRITICAL here is the ForeignObject@key
attribute. It must be present to force the ForeignObject to re-render its children.
In my case I increment the countdown variable in setInterval()
but the text never updates until I add the ForeignObject@key
with the changing value ! p>
Hope this helps someone...