-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: transfer specs to ts and remove unnecessary props #1865
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments regarding changes so it does not get lost.
@@ -20,7 +20,6 @@ - (RNSVGRenderable *)node | |||
return [RNSVGText new]; | |||
} | |||
|
|||
RCT_EXPORT_VIEW_PROPERTY(textAnchor, RNSVGTextAnchor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used anywhere on both platforms
{ | ||
view.tintColor = [RCTConvert UIColor:json]; | ||
} | ||
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those were treated in a custom way for some reason, but this works on both ios
and macos
.
@@ -35,7 +33,7 @@ - (RNSVGRenderable *)node | |||
{ | |||
view.imageheight = [RCTConvert RNSVGLength:json]; | |||
} | |||
RCT_EXPORT_VIEW_PROPERTY(src, id) | |||
RCT_EXPORT_VIEW_PROPERTY(src, RCTImageSource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This simplifies the handling of src
.
@@ -6,8 +6,8 @@ | |||
* LICENSE file in the root directory of this source tree. | |||
*/ | |||
|
|||
#import "RNSVGNodeManager.h" | |||
#import "RNSVGGroupManager.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes unify the inheritance hierarchy with Android
.
@@ -18,7 +18,7 @@ | |||
@interface RNSVGImage : RNSVGRenderable | |||
|
|||
@property (nonatomic, weak) RCTBridge *bridge; | |||
@property (nonatomic, assign) id src; | |||
@property (nonatomic, assign) RCTImageSource *src; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This simplifies handling of src
prop
@@ -240,68 +239,57 @@ void restoreCanvas(Canvas canvas, int count) { | |||
canvas.restoreToCount(count); | |||
} | |||
|
|||
@ReactProp(name = "name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those @ReactProp
annotations in components are already done in RenderableViewManager.java
.
@@ -87,13 +87,15 @@ public boolean needsCustomLayoutForChildren() { | |||
return true; | |||
} | |||
|
|||
@ReactProp(name = "tintColor") | |||
public void setTintColor(SvgView node, @Nullable Dynamic tintColor) { | |||
@ReactProp(name = "tintColor", customType = "Color") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also simplifies the parsing of color so we don't need to use ColorPropConverter
for the Dynamic
type that could have been provided.
@@ -1024,7 +1014,7 @@ public void setHeight(ImageView view, @Nullable String value) { | |||
view.setHeight(value); | |||
} | |||
|
|||
@ReactProp(name = "src") | |||
@ReactProp(name = "src", customType = "ImageSource") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't change implementation on Android
but aligns it with iOS
.
PR transfering Fabric specs to TS, removing unnecessary
@ReactProp
adnotations, unifying inheritance hierarchy across platforms, adding custom types for color and image source props so they are parsed byreact-native
.