mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor BaseProps.resolveborderMetrics method (#45554)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45554 In this diff I'm extracting the creation of borderWidth into its own method, this is necessary for next diffs of the stack. Nh behavior change is introduced here changelog: [internal] internal Reviewed By: NickGerleman Differential Revision: D59942306 fbshipit-source-id: 85d39b64deaa4e8a8632d6f4aab72f626e594b5d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6d08d3af93
commit
a052e1eefd
@@ -432,12 +432,8 @@ static BorderRadii radiiPercentToPoint(
|
||||
};
|
||||
}
|
||||
|
||||
BorderMetrics BaseViewProps::resolveBorderMetrics(
|
||||
const LayoutMetrics& layoutMetrics) const {
|
||||
auto isRTL =
|
||||
bool{layoutMetrics.layoutDirection == LayoutDirection::RightToLeft};
|
||||
|
||||
auto borderWidths = CascadedBorderWidths{
|
||||
CascadedBorderWidths BaseViewProps::getBorderWidths() const {
|
||||
return CascadedBorderWidths{
|
||||
/* .left = */ optionalFloatFromYogaValue(
|
||||
yogaStyle.border(yoga::Edge::Left)),
|
||||
/* .top = */
|
||||
@@ -457,6 +453,14 @@ BorderMetrics BaseViewProps::resolveBorderMetrics(
|
||||
/* .all = */
|
||||
optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::All)),
|
||||
};
|
||||
}
|
||||
|
||||
BorderMetrics BaseViewProps::resolveBorderMetrics(
|
||||
const LayoutMetrics& layoutMetrics) const {
|
||||
auto isRTL =
|
||||
bool{layoutMetrics.layoutDirection == LayoutDirection::RightToLeft};
|
||||
|
||||
auto borderWidths = getBorderWidths();
|
||||
|
||||
BorderRadii radii = radiiPercentToPoint(
|
||||
borderRadii.resolve(isRTL, ValueUnit{0.0f, UnitType::Point}),
|
||||
|
||||
@@ -96,6 +96,7 @@ class BaseViewProps : public YogaStylableProps, public AccessibilityProps {
|
||||
|
||||
#pragma mark - Convenience Methods
|
||||
|
||||
CascadedBorderWidths getBorderWidths() const;
|
||||
BorderMetrics resolveBorderMetrics(const LayoutMetrics& layoutMetrics) const;
|
||||
Transform resolveTransform(const LayoutMetrics& layoutMetrics) const;
|
||||
bool getClipsContentToBounds() const;
|
||||
|
||||
Reference in New Issue
Block a user