mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-29 13:21:50 +00:00
add accessibility and testId props and virtual nodes to support e2e tests tools (#2001)
PR adding accessibility and testId props and virtual nodes to support e2e tests tools and provide general accessibility support. Co-authored-by: yonatan.altaraz <yonatan.altaraz@khealth.ai> Co-authored-by: galkahana <gal.kahana@hotmail.com>
This commit is contained in:
@@ -49,6 +49,9 @@ export default function extractProps(
|
||||
display?: string;
|
||||
opacity?: NumberProp;
|
||||
onLayout?: () => void;
|
||||
testID?: string;
|
||||
accessibilityLabel?: string;
|
||||
accessible?: boolean;
|
||||
} & TransformProps &
|
||||
ResponderProps &
|
||||
StrokeProps &
|
||||
@@ -68,6 +71,9 @@ export default function extractProps(
|
||||
markerStart = marker,
|
||||
markerMid = marker,
|
||||
markerEnd = marker,
|
||||
testID,
|
||||
accessibilityLabel,
|
||||
accessible,
|
||||
} = props;
|
||||
const extracted: extractedProps = {};
|
||||
|
||||
@@ -111,6 +117,18 @@ export default function extractProps(
|
||||
extracted.name = String(id);
|
||||
}
|
||||
|
||||
if (testID) {
|
||||
extracted.testID = String(testID);
|
||||
}
|
||||
|
||||
if (accessibilityLabel) {
|
||||
extracted.accessibilityLabel = String(accessibilityLabel);
|
||||
}
|
||||
|
||||
if (accessible) {
|
||||
extracted.accessible = Boolean(accessible);
|
||||
}
|
||||
|
||||
if (clipRule) {
|
||||
extracted.clipRule = clipRules[clipRule] === 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -276,6 +276,9 @@ export type extractedProps = {
|
||||
clipPath?: string;
|
||||
clipRule?: number;
|
||||
display?: string;
|
||||
testID?: string;
|
||||
accessibilityLabel?: string;
|
||||
accessible?: boolean;
|
||||
[touchableProperty: string]: unknown;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user