i’m new to react native, so please bear with me.
i used react-native-chart-kit to make a line chart.
i have found the way to add accessibility label on the data point of my line chart, which looks like this:
...
chartConfig={{
backgroundGradientFrom: 'rgb(255, 255, 255)',
backgroundGradientTo: 'rgb(255, 255, 255)',
color: () => `rgb(204, 204, 204)`,
labelColor: () => `rgb(122, 122, 122)`,
propsForDots: {
r: 3,
accessibilityLabel: (_, index) => `data point ${index}`
}
}}
...
and i want to make a test case where the user press on the data point and make the modal visible. but i failed at finding the element by accessibility label, which i tried by doing
const dataPointZero = screen.getByLabelText('data point 0');
i got the error saying that there’s no element with label data point 0
. i have tried using await screen.findByLabelText()
and still got the error.
any idea why? thank you.
user14769900 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.