I have a component to represent a tab header like the following :
import Svg, { G, Path } from 'react-native-svg';
const Tab = ({ height = "57.8", width="104", children, fill='#D1D3D4' }) => (
<Svg height={height} width={width} viewBox="0 0 104 57.8">
<G>
<Path d="M-0.1,57.8h85c19.1,0,19.5-13.9,19.1-17.9L97.8,0H0.1L-0.1,57.8z" fill={fill}/>
{ children }
</G>
</Svg>
)
The children is to be svg Text that will have multiple text segments with different font size to be baseline aligned between each other. This text also need to be vertically AND horizontally centered inside it's parent.
I have tried different things, but I can't seem to find the proper configuration. This is my latest which centers the inside text baseline with the center of it's parent.
import { Text, TSpan } from 'react-native-svg';
...
return (<Tab><Text x={52} y={28.9} textAnchor={'middle'} alignmentBaseline={'central'}>
<TSpan alignmentBaseline={"baseline"}>
<TSpan fontSize={44}>{text.charAt(0)}</TSpan>
<TSpan fontSize={32}>{text.substring(1)}</TSpan>
</TSpan>
</Text></Tab>)
Any help is greatly appreciated.