Skip to content

Commit

Permalink
Force border with default brush for borderWidth (#11062)
Browse files Browse the repository at this point in the history
* Force border with default brush for borderWidth

On iOS, Android, and Web, a border is drawn with the default brush if the
borderWidth prop is set, not only if a borderColor is also set.

This changes react-native-windows to draw a border with the default
brush if the borderWidth is set only.

* Change files

* Update snapshots
  • Loading branch information
rozele committed Jan 10, 2023
1 parent d22844e commit 6bb0ecd
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Force border with default brush for borderWidth",
"packageName": "react-native-windows",
"email": "erozell@outlook.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,22 @@ exports[`ViewTests Views can have overflow 1`] = `
},
],
},
{
"Background": null,
"BorderBrush": "#E4000000",
"BorderThickness": "1,1,1,1",
"Clip": null,
"CornerRadius": "0,0,0,0",
"FlowDirection": "LeftToRight",
"HorizontalAlignment": "Stretch",
"Left": 0,
"Margin": "0,0,0,0",
"Padding": "0,0,0,0",
"Top": 0,
"VerticalAlignment": "Stretch",
"Visibility": "Visible",
"XamlType": "Windows.UI.Xaml.Controls.Border",
},
],
},
{
Expand Down Expand Up @@ -574,6 +590,22 @@ exports[`ViewTests Views can have overflow 1`] = `
},
],
},
{
"Background": null,
"BorderBrush": "#E4000000",
"BorderThickness": "1,1,1,1",
"Clip": null,
"CornerRadius": "0,0,0,0",
"FlowDirection": "LeftToRight",
"HorizontalAlignment": "Stretch",
"Left": 0,
"Margin": "0,0,0,0",
"Padding": "0,0,0,0",
"Top": 0,
"VerticalAlignment": "Stretch",
"Visibility": "Visible",
"XamlType": "Windows.UI.Xaml.Controls.Border",
},
],
},
{
Expand Down Expand Up @@ -628,6 +660,22 @@ exports[`ViewTests Views can have overflow 1`] = `
},
],
},
{
"Background": null,
"BorderBrush": "#E4000000",
"BorderThickness": "1,1,1,1",
"Clip": null,
"CornerRadius": "0,0,0,0",
"FlowDirection": "LeftToRight",
"HorizontalAlignment": "Stretch",
"Left": 0,
"Margin": "0,0,0,0",
"Padding": "0,0,0,0",
"Top": 0,
"VerticalAlignment": "Stretch",
"Visibility": "Visible",
"XamlType": "Windows.UI.Xaml.Controls.Border",
},
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/Views/ViewPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void ViewPanel::FinalizeProperties() {
bool hasBorderBrush = ReadLocalValue(BorderBrushProperty()) != unsetValue;
bool hasBorderThickness = BorderThickness() != emptyThickness;
bool hasCornerRadius = ReadLocalValue(CornerRadiusProperty()) != unsetValue;
bool displayBorder = hasBorderBrush && hasBorderThickness;
bool displayBorder = hasBorderThickness;

// Determine which scenario our current properties have put us into
enum class Scenario { OuterBorder, InnerBorder, NoBorder } scenario;
Expand Down

0 comments on commit 6bb0ecd

Please sign in to comment.