Skip to content

Commit dea2648

Browse files
kevinvangelderrozele
authored andcommitted
Fixed issue where text was clipping instead of wrapping (microsoft#946)
* fixed issue where text was clipping instead of wrapping * fix imports, thanks Visual Studio...
1 parent 746d710 commit dea2648

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

ReactWindows/Playground.Net46/index.windows.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,17 @@ const styles = StyleSheet.create({
3737
flex: 1,
3838
justifyContent: 'center',
3939
alignItems: 'center',
40-
backgroundColor: '#F5FCFF',
40+
backgroundColor: '#F5FCFF'
4141
},
4242
welcome: {
4343
fontSize: 20,
4444
textAlign: 'center',
45-
margin: 10,
46-
width: 500
45+
margin: 10
4746
},
4847
instructions: {
4948
textAlign: 'center',
5049
color: '#333333',
51-
marginBottom: 5,
52-
width: 500
50+
marginBottom: 5
5351
},
5452
});
5553

ReactWindows/ReactNative.Net46/Views/Text/ReactTextShadowNode.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
using ReactNative.Reflection;
44
using ReactNative.UIManager;
55
using ReactNative.UIManager.Annotations;
6+
using System;
67
using System.Windows;
78
using System.Windows.Controls;
8-
using System.Windows.Documents;
99
using System.Windows.Media;
1010

1111
namespace ReactNative.Views.Text
@@ -195,6 +195,7 @@ private static MeasureOutput MeasureText(CSSNode node, float width, CSSMeasureMo
195195
var textBlock = new TextBlock
196196
{
197197
TextAlignment = TextAlignment.Left,
198+
TextWrapping = TextWrapping.Wrap,
198199
TextTrimming = TextTrimming.CharacterEllipsis,
199200
};
200201

@@ -210,8 +211,8 @@ private static MeasureOutput MeasureText(CSSNode node, float width, CSSMeasureMo
210211
var normalizedHeight = CSSConstants.IsUndefined(height) ? double.PositiveInfinity : height;
211212
textBlock.Measure(new Size(normalizedWidth, normalizedHeight));
212213
return new MeasureOutput(
213-
(float)textBlock.DesiredSize.Width,
214-
(float)textBlock.DesiredSize.Height);
214+
(float)Math.Ceiling(textBlock.DesiredSize.Width),
215+
(float)Math.Ceiling(textBlock.DesiredSize.Height));
215216
});
216217

217218
return task.Result;

ReactWindows/ReactNative.Net46/Views/Text/ReactTextViewManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System;
2-
using ReactNative.UIManager;
1+
using ReactNative.UIManager;
32
using ReactNative.UIManager.Annotations;
3+
using System;
44
using System.Collections;
5-
using System.Linq;
65
using System.Windows;
76
using System.Windows.Controls;
87
using System.Windows.Documents;
@@ -158,6 +157,7 @@ protected override TextBlock CreateViewInstance(ThemedReactContext reactContext)
158157
var textBlock = new TextBlock
159158
{
160159
TextAlignment = TextAlignment.Left,
160+
TextWrapping = TextWrapping.Wrap,
161161
TextTrimming = TextTrimming.CharacterEllipsis,
162162
};
163163

0 commit comments

Comments
 (0)