Fix instrumentation tests for api 22

Summary:
Bug in Android https://code.google.com/p/android/issues/detail?id=33868 causes the RN catalyst instrumentation test to fail with

```
java.lang.ArrayIndexOutOfBoundsException: length=253; index=-1
	at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:667)
	at android.text.StaticLayout.out(StaticLayout.java:631)
	at android.text.StaticLayout.generate(StaticLayout.java:423)
	...
```

The fix is to set singleLine to true when there is only one line of text

Reviewed By: AaaChiuuu

Differential Revision: D4562000

fbshipit-source-id: 84248e3982063b767e8b0465effe2321b54a7fa2
This commit is contained in:
Andrew Y. Chen 2017-03-21 14:45:37 -07:00 committed by Facebook Github Bot
parent 1433185a09
commit ee245b9be8
1 changed files with 1 additions and 0 deletions

View File

@ -231,6 +231,7 @@ public class ReactTextView extends TextView implements ReactCompoundView {
public void setNumberOfLines(int numberOfLines) { public void setNumberOfLines(int numberOfLines) {
mNumberOfLines = numberOfLines == 0 ? ViewDefaults.NUMBER_OF_LINES : numberOfLines; mNumberOfLines = numberOfLines == 0 ? ViewDefaults.NUMBER_OF_LINES : numberOfLines;
setSingleLine(mNumberOfLines == 1);
setMaxLines(mNumberOfLines); setMaxLines(mNumberOfLines);
} }