mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 15:44:24 +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:
@@ -74,6 +74,9 @@ extern CGFloat const RNSVG_DEFAULT_FONT_SIZE;
|
||||
@property (nonatomic, assign) CGRect markerBounds;
|
||||
@property (nonatomic, copy) RCTDirectEventBlock onLayout;
|
||||
|
||||
@property (nonatomic, copy) NSString *testID;
|
||||
@property (nonatomic, assign) BOOL accessible;
|
||||
|
||||
/**
|
||||
* RNSVGSvgView which ownes current RNSVGNode
|
||||
*/
|
||||
|
||||
@@ -190,6 +190,18 @@ CGFloat const RNSVG_DEFAULT_FONT_SIZE = 12;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
- (void)setTestID:(NSString *)testID
|
||||
{
|
||||
self.accessibilityIdentifier = testID;
|
||||
[self invalidate];
|
||||
}
|
||||
|
||||
- (void)setAccessible:(BOOL)accessible
|
||||
{
|
||||
self.isAccessibilityElement = accessible;
|
||||
[self invalidate];
|
||||
}
|
||||
|
||||
- (void)setDisplay:(NSString *)display
|
||||
{
|
||||
if ([display isEqualToString:_display]) {
|
||||
|
||||
@@ -45,6 +45,10 @@ RCT_EXPORT_VIEW_PROPERTY(clipRule, RNSVGCGFCRule)
|
||||
RCT_EXPORT_VIEW_PROPERTY(responsible, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(onLayout, RCTDirectEventBlock)
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(testID, NSString)
|
||||
RCT_EXPORT_VIEW_PROPERTY(accessibilityLabel, NSString)
|
||||
RCT_EXPORT_VIEW_PROPERTY(accessible, BOOL)
|
||||
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(top, id, RNSVGNode) {}
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(right, id, RNSVGNode) {}
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(start, id, RNSVGNode) {}
|
||||
|
||||
Reference in New Issue
Block a user