Skip to content
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

Merged
merged 12 commits into from
Sep 14, 2022

Conversation

WoLewicki
Copy link
Member

@WoLewicki WoLewicki commented Sep 13, 2022

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 by react-native.

@WoLewicki WoLewicki marked this pull request as ready for review September 13, 2022 14:55
Copy link
Member Author

@WoLewicki WoLewicki left a 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)
Copy link
Member Author

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)
Copy link
Member Author

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)
Copy link
Member Author

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"
Copy link
Member Author

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;
Copy link
Member Author

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")
Copy link
Member Author

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")
Copy link
Member Author

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")
Copy link
Member Author

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.

@WoLewicki WoLewicki merged commit ee6e5da into main Sep 14, 2022
@WoLewicki WoLewicki deleted the @wolewicki/transfer-specs-to-ts branch September 14, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant