Skip to content

Commit 2ffc72e

Browse files
zholobovrozele
authored andcommitted
add support for borderTopLeftRaduis and the three other one-corner-only border radius props to ReactImageManager (#1871)
1 parent 5d71fcd commit 2ffc72e

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

ReactWindows/ReactNative/Views/Image/ReactImageManager.cs

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,53 @@ public void SetSource(Border view, JArray sources)
161161
}
162162
}
163163

164+
/// <summary>
165+
/// Enum values correspond to positions of prop names in ReactPropGroup attribute
166+
/// applied to <see cref="SetBorderRadius(Border, int, double)"/>
167+
/// </summary>
168+
private enum Radius
169+
{
170+
All,
171+
TopLeft,
172+
TopRight,
173+
BottomLeft,
174+
BottomRight,
175+
}
176+
164177
/// <summary>
165178
/// The border radius of the <see cref="ReactRootView"/>.
166179
/// </summary>
167180
/// <param name="view">The image view instance.</param>
181+
/// <param name="index">The prop index.</param>
168182
/// <param name="radius">The border radius value.</param>
169-
[ReactProp("borderRadius")]
170-
public void SetBorderRadius(Border view, double radius)
183+
[ReactPropGroup(
184+
ViewProps.BorderRadius,
185+
ViewProps.BorderTopLeftRadius,
186+
ViewProps.BorderTopRightRadius,
187+
ViewProps.BorderBottomLeftRadius,
188+
ViewProps.BorderBottomRightRadius)]
189+
public void SetBorderRadius(Border view, int index, double radius)
171190
{
172-
view.CornerRadius = new CornerRadius(radius);
191+
var cornerRadius = view.CornerRadius;
192+
switch ((Radius)index)
193+
{
194+
case Radius.All:
195+
cornerRadius = new CornerRadius(radius);
196+
break;
197+
case Radius.TopLeft:
198+
cornerRadius.TopLeft = radius;
199+
break;
200+
case Radius.TopRight:
201+
cornerRadius.TopRight = radius;
202+
break;
203+
case Radius.BottomLeft:
204+
cornerRadius.BottomLeft = radius;
205+
break;
206+
case Radius.BottomRight:
207+
cornerRadius.BottomRight = radius;
208+
break;
209+
}
210+
view.CornerRadius = cornerRadius;
173211
}
174212

175213
/// <summary>

0 commit comments

Comments
 (0)