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