Skip to content

Commit

Permalink
Fixing Crush on SDK 15 (ICS) on ReactTextInputLocalData
Browse files Browse the repository at this point in the history
Summary:
We had a crush reprot from Loadstone (manual tests) for RN standalone app on ICS, see:
https://our.intern.facebook.com/intern/tasks/view_inline_attachment/?attachment_id=2296063267087587&fbid=314266832445741

Seems like we are using TextView.getMinLines and TextView.getMaxLines - both added in SDK 16, witought a propert guard. see:
https://developer.android.com/reference/android/widget/TextView#getMinLines()
https://developer.android.com/reference/android/widget/TextView#getMaxLines()

Reviewed By: shergin

Differential Revision: D8763942

fbshipit-source-id: a56a6fc3e575b8ea97ddab983561df878b2f341c
  • Loading branch information
Noam Schachter authored and facebook-github-bot committed Jul 10, 2018
1 parent a69c330 commit 1bb2bea
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ public final class ReactTextInputLocalData {
public ReactTextInputLocalData(EditText editText) {
mText = new SpannableStringBuilder(editText.getText());
mTextSize = editText.getTextSize();
mMinLines = editText.getMinLines();
mMaxLines = editText.getMaxLines();
mInputType = editText.getInputType();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mMinLines = editText.getMinLines();
mMaxLines = editText.getMaxLines();
} else {
mMinLines = 1;
mMaxLines = 1;
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mBreakStrategy = editText.getBreakStrategy();
} else {
Expand Down

0 comments on commit 1bb2bea

Please sign in to comment.