mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-02 06:35:04 +00:00
feat: strokeDasharray with Animated (#2089)
PR adding the proper handling of strokeDasharray prop for when used with Animated and Reanimated. Code based on #1464 by @bardliu, but with the newest state of the repository.
This commit is contained in:
@@ -128,8 +128,20 @@ RCT_ENUM_CONVERTER(
|
||||
return lengths;
|
||||
} else if ([json isKindOfClass:[NSString class]]) {
|
||||
NSString *stringValue = (NSString *)json;
|
||||
RNSVGLength *length = [RNSVGLength lengthWithString:stringValue];
|
||||
return [NSArray arrayWithObject:length];
|
||||
stringValue = [stringValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
stringValue = [stringValue stringByReplacingOccurrencesOfString:@","
|
||||
withString:@" "
|
||||
options:NSRegularExpressionSearch
|
||||
range:NSMakeRange(0, stringValue.length)];
|
||||
NSArray<NSString *> *array = [stringValue componentsSeparatedByString:@" "];
|
||||
NSMutableArray<RNSVGLength *> *svgLengthArray = [NSMutableArray array];
|
||||
|
||||
for (NSString *string in array) {
|
||||
RNSVGLength *length = [RNSVGLength lengthWithString:string];
|
||||
[svgLengthArray addObject:length];
|
||||
}
|
||||
|
||||
return svgLengthArray;
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user