Backed out changeset 8841a5719494 (D4944482)

Reviewed By: sahrens

Differential Revision: D4981286

fbshipit-source-id: 5b17ba93ee43a0a46f98f47b6fb8a779180ab4b6
This commit is contained in:
Ravi Bhoraskar 2017-05-02 12:09:39 -07:00 committed by Facebook Github Bot
parent 366c15d2b2
commit bf0a95d338
1 changed files with 1 additions and 12 deletions

View File

@ -28,7 +28,6 @@ import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
@ -92,23 +91,13 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
@Override
public ReactEditText createViewInstance(ThemedReactContext context) {
final ReactEditText editText = new ReactEditText(context);
ReactEditText editText = new ReactEditText(context);
int inputType = editText.getInputType();
editText.setInputType(inputType & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
editText.setReturnKeyType("done");
editText.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
(int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)));
// Fixes an issue where the EditText is not selectable if nested within a
// ViewPagerAndroid on some versions of Android (API 16, 23)
editText.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
editText.getViewTreeObserver().removeOnPreDrawListener(this);
editText.setTextIsSelectable(true);
return true;
}
});
return editText;
}