mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 23:54:53 +00:00
fix: compatibility with reanimated color, fixes #1241
This commit is contained in:
@@ -116,7 +116,9 @@ abstract public class RenderableView extends VirtualView {
|
||||
return;
|
||||
}
|
||||
ReadableType type = fill.getType();
|
||||
if (type.equals(ReadableType.Array)) {
|
||||
if (type.equals(ReadableType.Number)) {
|
||||
this.fill = JavaOnlyArray.of(0, fill.asInt());
|
||||
} else if (type.equals(ReadableType.Array)) {
|
||||
this.fill = fill.asArray();
|
||||
} else {
|
||||
JavaOnlyArray arr = new JavaOnlyArray();
|
||||
@@ -162,7 +164,9 @@ abstract public class RenderableView extends VirtualView {
|
||||
return;
|
||||
}
|
||||
ReadableType type = strokeColors.getType();
|
||||
if (type.equals(ReadableType.Array)) {
|
||||
if (type.equals(ReadableType.Number)) {
|
||||
stroke = JavaOnlyArray.of(0, strokeColors.asInt());
|
||||
} else if (type.equals(ReadableType.Array)) {
|
||||
stroke = strokeColors.asArray();
|
||||
} else {
|
||||
JavaOnlyArray arr = new JavaOnlyArray();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
@property (nonatomic, strong) NSString* brushRef;
|
||||
|
||||
/* @abstract */
|
||||
- (instancetype)initWithArray:(NSArray *)data NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithArray:(NSArray *)data;
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
return [super init];
|
||||
}
|
||||
|
||||
RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
|
||||
- (void)paint:(CGContextRef)context opacity:(CGFloat)opacity painter:(RNSVGPainter *)painter bounds:(CGRect)bounds
|
||||
{
|
||||
|
||||
|
||||
@@ -10,4 +10,6 @@
|
||||
|
||||
@interface RNSVGSolidColorBrush : RNSVGBrush
|
||||
|
||||
- (instancetype)initWithNumber:(NSNumber *)number;
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,6 +24,14 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNumber:(NSNumber *)number
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_color = CGColorRetain([RCTConvert CGColor:number]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
CGColorRelease(_color);
|
||||
|
||||
@@ -36,6 +36,9 @@ RCT_ENUM_CONVERTER(RNSVGUnits, (@{
|
||||
|
||||
+ (RNSVGBrush *)RNSVGBrush:(id)json
|
||||
{
|
||||
if ([json isKindOfClass:[NSNumber class]]) {
|
||||
return [[RNSVGSolidColorBrush alloc] initWithNumber:json];
|
||||
}
|
||||
if ([json isKindOfClass:[NSString class]]) {
|
||||
NSString *value = [self NSString:json];
|
||||
if (!RNSVGDigitRegEx) {
|
||||
|
||||
Reference in New Issue
Block a user