Fabric: Using Size instead of Point as textShadowOffset's type
Summary: The current implementation of React Native uses `Size` as the underlying type of `textShadowOffset` which is clearly terribly wrong (especially because negative size values makes no sense). This mistake was borrowed from `NSShadow`, I believe. I don't have time to fix this in every implementation of RN now, so let's use `Size` in Fabric as well. Reviewed By: fkgozali Differential Revision: D8246714 fbshipit-source-id: 1f0bf9b9dfa83802ef3faef2971fed5510494bfd
This commit is contained in:
parent
078d6e3a9d
commit
8b62e7a550
|
@ -57,7 +57,8 @@ public:
|
|||
folly::Optional<TextDecorationLinePattern> textDecorationLinePattern {};
|
||||
|
||||
// Shadow
|
||||
folly::Optional<Point> textShadowOffset {};
|
||||
// TODO: Use `Point` type instead of `Size` for `textShadowOffset` attribute.
|
||||
folly::Optional<Size> textShadowOffset {};
|
||||
Float textShadowRadius {std::numeric_limits<Float>::quiet_NaN()};
|
||||
SharedColor textShadowColor {nullptr};
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ static NSDictionary<NSAttributedStringKey, id> *RCTNSTextAttributesFromTextAttri
|
|||
if (textAttributes.textShadowOffset.hasValue()) {
|
||||
auto textShadowOffset = textAttributes.textShadowOffset.value();
|
||||
NSShadow *shadow = [NSShadow new];
|
||||
shadow.shadowOffset = CGSize {textShadowOffset.x, textShadowOffset.y};
|
||||
shadow.shadowOffset = CGSize {textShadowOffset.width, textShadowOffset.height};
|
||||
shadow.shadowBlurRadius = textAttributes.textShadowRadius;
|
||||
shadow.shadowColor = RCTUIColorFromSharedColor(textAttributes.textShadowColor);
|
||||
attributes[NSShadowAttributeName] = shadow;
|
||||
|
|
Loading…
Reference in New Issue