mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
feat: invalidate on color change (#2470)
# Summary Invalidate element when `color` prop changes.
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
@property (nonatomic, assign) CGPathRef hitArea;
|
||||
@property (nonatomic, strong) NSString *filter;
|
||||
|
||||
- (void)setColor:(RNSVGColor *)color;
|
||||
|
||||
- (void)setHitArea:(CGPathRef)path;
|
||||
|
||||
- (NSArray<NSString *> *)getAttributeList;
|
||||
|
||||
@@ -59,6 +59,15 @@ static RNSVGRenderable *_contextElement;
|
||||
self.dirty = true;
|
||||
}
|
||||
|
||||
- (void)setColor:(RNSVGColor *)color
|
||||
{
|
||||
if (color == self.tintColor) {
|
||||
return;
|
||||
}
|
||||
[self invalidate];
|
||||
self.tintColor = color;
|
||||
}
|
||||
|
||||
- (void)setFill:(RNSVGBrush *)fill
|
||||
{
|
||||
if (fill == _fill) {
|
||||
|
||||
@@ -141,7 +141,7 @@ void setCommonRenderableProps(const T &renderableProps, RNSVGRenderable *rendera
|
||||
{
|
||||
setCommonNodeProps(renderableProps, renderableNode);
|
||||
if (RCTUIColorFromSharedColor(renderableProps.color)) {
|
||||
renderableNode.tintColor = RCTUIColorFromSharedColor(renderableProps.color);
|
||||
[renderableNode setColor:RCTUIColorFromSharedColor(renderableProps.color)];
|
||||
}
|
||||
renderableNode.fill = brushFromColorStruct(renderableProps.fill);
|
||||
renderableNode.fillOpacity = renderableProps.fillOpacity;
|
||||
|
||||
Reference in New Issue
Block a user