In react-native-svg text is not showing in ios but it's working on android.
You can see my code and ScreenShot.
const Labels = ({slices, height, width}) => {
return slices.map((slice, index) => {
const {labelCentroid, pieCentroid, data} = slice;
return (
<View>
{data.totalCount !== "0.00" ?
<Text
key={index}
x={pieCentroid[0]}
y={pieCentroid[1]}
fill={'white'}
textAnchor={'middle'}
alignmentBaseline={'text-bottom'}
fontSize={13}
stroke={'black'}
strokeWidth={0.1}>
{data.totalCount}
{/* {data.description} */}
</Text>
:null }
{data.totalCount !== "0.00" ?
<Text
// key={index}
x={pieCentroid[0]}
y={pieCentroid[1]}
fill={'white'}
textAnchor={'middle'}
alignmentBaseline={'text-top'}
fontSize={13}
stroke={'black'}
strokeWidth={0.1}>
{data.description}
</Text> :null }
</View>
);
});
};
return (
<View style={styles.container}>
<PieChart
animate={true}
animationDuration={300}
style={{height: 290}}
valueAccessor={({item}) => item.totalCount}
data={newArray}
padAngle={0.02}
// spacing={10}
outerRadius={'95%'}
innerRadius={'50%'}>
<Labels />
</PieChart>
</View>
);
}
}
Do we have any solution for it , I am facing exactly similar issue
Do we have any solution for it, I am facing exactly similar issue
I solved this issue by wrap both the text in singal svg text and remove the view like this:
<Text>
<Text
key={index}
x={pieCentroid[0]}
y={pieCentroid[1]}
fill={'white'}
textAnchor={'middle'}
alignmentBaseline={'text-bottom'}
fontSize={13}
stroke={'black'}
strokeWidth={0.1}>
{data.totalCount}
</Text>
<Text
// key={index}
x={pieCentroid[0]}
y={pieCentroid[1]}
fill={'white'}
textAnchor={'middle'}
alignmentBaseline={'text-top'}
fontSize={13}
stroke={'black'}
strokeWidth={0.1}>
{data.description}
</Text>
</Text>
@SyedShahbazHussain thank you very much! Such an incredible guess. I was debugging that similar stuff since 2 hours 馃槚
Most helpful comment