'react native svg onPress event not working on real device
I'm using react native svg and facing issue that it's onPress event is not working on real device but working fine on emulator. I search for solution but none of them worked for me.
Here is my code
const Labels: FC<labelProps> = ({
slices,
images,
onPress,
isClicked,
selectedIndex,
budgetScreen,
totalAmount,
}) => {
return (
<>
{slices?.map((slice, index) => {
const {labelCentroid} = slice;
return (
<G
onPress={() => onPress(index)}
key={index}
x={labelCentroid[0]}
y={labelCentroid[1]}>
<Image
x={-10}
y={-10}
width={20}
height={20}
href={images.pieImages[index]}
/>
<Rect
rx={4}
ry={4}
y={-60}
x={budgetScreen ? -75 : -55}
height={budgetScreen ? 49 : 45}
width={budgetScreen ? 149 : 115}
fill={colors.whiteColor}
strokeWidth={0.5}
stroke={colors.blackOpacity10}
/>
<SvgText
fill={colors.blackColor}
fontSize="12"
fontFamily={fonts.MEDIUM}
fontWeight="500"
y="-40"
x={budgetScreen ? '-1' : '5'}
textAnchor="middle">
{slice?.data?.category}
</SvgText>
</>
)}
</G>
);
})}
</>
);
};
export default Labels;
Can anyone tell me how can I fix that please.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
