Skip to content

Commit e3352aa

Browse files
Merge branch 'ReactWindows' of https://github.com/ReactWindows/react-native into issue-388
2 parents d57e217 + 811a911 commit e3352aa

File tree

7 files changed

+27
-9
lines changed

7 files changed

+27
-9
lines changed

ReactWindows/ReactNative/Views/Picker/ReactPickerShadowNode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public ReactPickerShadowNode()
1717
MeasureFunction = MeasurePicker;
1818
}
1919

20-
private static MeasureOutput MeasurePicker(CSSNode node, float width, float height)
20+
private static MeasureOutput MeasurePicker(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
2121
{
2222
return new MeasureOutput(width, 40);
2323
}

ReactWindows/ReactNative/Views/Progress/ProgressBarShadowNode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public ProgressBarShadowNode()
1010
MeasureFunction = MeasureProgressBar;
1111
}
1212

13-
private static MeasureOutput MeasureProgressBar(CSSNode node, float width, float height)
13+
private static MeasureOutput MeasureProgressBar(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
1414
{
1515
var adjustedHeight = CSSConstants.IsUndefined(height) ? 4 : height;
1616
return new MeasureOutput(width, adjustedHeight);

ReactWindows/ReactNative/Views/Switch/ReactSwitchShadowNode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public ReactSwitchShadowNode()
1616
MeasureFunction = MeasureSwitch;
1717
}
1818

19-
private static MeasureOutput MeasureSwitch(CSSNode node, float width, float height)
19+
private static MeasureOutput MeasureSwitch(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
2020
{
2121
// TODO: figure out how to properly measure the switch.
2222
// We are currently blocked until we switch to a UWP-specific React

ReactWindows/ReactNative/Views/Text/ReactTextShadowNode.cs

+20-3
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,29 @@ public override void OnCollectExtraUpdates(UIViewOperationQueue uiViewOperationQ
121121

122122
if (_inline != null)
123123
{
124+
var _paddings = new Thickness()
125+
{
126+
Left = float.IsNaN(GetPadding(CSSSpacingType.Left)) ?
127+
float.IsNaN(GetPadding(CSSSpacingType.Horizontal)) ?
128+
float.IsNaN(GetPadding(CSSSpacingType.All)) ? 0 :
129+
GetPadding(CSSSpacingType.All) :
130+
GetPadding(CSSSpacingType.Horizontal) :
131+
GetPadding(CSSSpacingType.Left),
132+
Top = float.IsNaN(GetPadding(CSSSpacingType.Top)) ?
133+
float.IsNaN(GetPadding(CSSSpacingType.Vertical)) ?
134+
float.IsNaN(GetPadding(CSSSpacingType.All)) ? 0 :
135+
GetPadding(CSSSpacingType.All) :
136+
GetPadding(CSSSpacingType.Vertical) :
137+
GetPadding(CSSSpacingType.Top),
138+
};
139+
124140
var args = Tuple.Create(
125141
_inline,
126142
_textAlignment,
127143
_lineHeight,
128144
_numberOfLines,
129-
_letterSpacing);
145+
_letterSpacing,
146+
_paddings);
130147

131148
uiViewOperationQueue.EnqueueUpdateExtraData(ReactTag, args);
132149
}
@@ -371,7 +388,7 @@ private static void ThrowException(string property)
371388
throw new InvalidOperationException("Property " + property + " is supported only on the outermost text block.");
372389
}
373390

374-
private static MeasureOutput MeasureText(CSSNode node, float width, float height)
391+
private static MeasureOutput MeasureText(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
375392
{
376393
// This is not a terribly efficient way of projecting the height of
377394
// the text elements. It requires that we have access to the
@@ -394,7 +411,7 @@ private static MeasureOutput MeasureText(CSSNode node, float width, float height
394411
textBlock.CharacterSpacing = textNode._letterSpacing;
395412
textBlock.LineHeight = textNode._lineHeight;
396413
textBlock.MaxLines = textNode._numberOfLines;
397-
textBlock.TextAlignment = (TextAlignment)textNode._textAlignment;
414+
textBlock.TextAlignment = textNode._textAlignment;
398415

399416
textBlock.Inlines.Add(ReactTextShadowNodeInlineVisitor.Apply(node));
400417

ReactWindows/ReactNative/Views/Text/ReactTextViewManager.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override ReactTextShadowNode CreateShadowNodeInstance()
4040
/// <param name="extraData">The aggregated virtual node changes.</param>
4141
public override void UpdateExtraData(TextBlock root, object extraData)
4242
{
43-
var textUpdate = (Tuple<Inline, TextAlignment, double, int, int>)extraData;
43+
var textUpdate = (Tuple<Inline, TextAlignment, double, int, int, Thickness>)extraData;
4444
var inline = textUpdate.Item1;
4545

4646
root.Inlines.Clear();
@@ -49,7 +49,8 @@ public override void UpdateExtraData(TextBlock root, object extraData)
4949
root.TextAlignment = textUpdate.Item2;
5050
root.LineHeight = textUpdate.Item3;
5151
root.MaxLines = textUpdate.Item4;
52-
root.CharacterSpacing = textUpdate.Item5;
52+
root.CharacterSpacing = textUpdate.Item5;
53+
root.Padding = textUpdate.Item6;
5354
}
5455

5556
/// <summary>

ReactWindows/ReactNative/Views/TextInput/ReactTextInputShadowNode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public override void OnCollectExtraUpdates(UIViewOperationQueue uiViewOperationQ
8787
}
8888
}
8989

90-
private MeasureOutput MeasureText(CSSNode node, float width, float height)
90+
private MeasureOutput MeasureText(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
9191
{
9292
_computedPadding = GetComputedPadding();
9393

512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)