react-native-svg-transformer icon indicating copy to clipboard operation
react-native-svg-transformer copied to clipboard

How to support accessibility?

Open sonicvision opened this issue 5 years ago • 3 comments

Hello,

I am using this library, and would like to mention some accessibility text for the svg. Is there a way to do the same?

sonicvision avatar May 14 '20 12:05 sonicvision

Thanks @sonicvision, that's a good question.

This library takes regular SVG images and transforms them into a format that React Native can use. As far as I know, React Native has it's own built-in accessibility features. That means that if the text inside the SVG image is not readable by iOS' VoiceOver or Android's TalkBack, then you could try to add the accessibilityLabel prop to the elements inside the SVG image (https://reactnative.dev/docs/accessibility.html), or alternatively use react-native-svg directly to get the elements to be accessible (https://github.com/react-native-community/react-native-svg#usage).

kristerkari avatar May 14 '20 14:05 kristerkari

Hi, I'd like to refer to the filename itself from the component to uniquely identify the <SvgComponent/> is there a way to do so?

import Logo from 'logo.svg';

<Logo accessibilityLabel={Logo.getFilenameFuncOrSomethingRatherThanHardcodeLogoDotSvg()}

JiboStore avatar Sep 08 '20 07:09 JiboStore

@JiboStore not at least directly using this library. You would need to come up with a custom solution.

kristerkari avatar Oct 15 '20 09:10 kristerkari