Permalink
Browse files

Make <TextInput multiline> default blurOnSubmit to false.

Reviewed By: achen1

Differential Revision: D5830633

fbshipit-source-id: 3d0880656f14cfafa0f15c4341021799f20f40ed
  • Loading branch information...
rsnara authored and facebook-github-bot committed Sep 14, 2017
1 parent f568090 commit adb6646016944fb17fd4cb3824f38a42d4785176
@@ -9,10 +9,6 @@
package com.facebook.react.views.textinput;
import javax.annotation.Nullable;
import java.util.ArrayList;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
@@ -38,13 +34,14 @@
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.views.text.CustomStyleSpan;
import com.facebook.react.views.text.ReactTagSpan;
import com.facebook.react.views.text.ReactTextUpdate;
import com.facebook.react.views.text.TextInlineImageSpan;
import com.facebook.react.views.view.ReactViewBackgroundDrawable;
import java.util.ArrayList;
import javax.annotation.Nullable;
/**
* A wrapper around the EditText that lets us better control what happens when an EditText gets
@@ -76,7 +73,7 @@
private @Nullable TextWatcherDelegator mTextWatcherDelegator;
private int mStagedInputType;
private boolean mContainsImages;
private boolean mBlurOnSubmit;
private @Nullable Boolean mBlurOnSubmit;
private boolean mDisableFullscreen;
private @Nullable String mReturnKeyType;
private @Nullable SelectionWatcher mSelectionWatcher;
@@ -102,7 +99,7 @@ public ReactEditText(Context context) {
mMostRecentEventCount = 0;
mIsSettingTextFromJS = false;
mIsJSSettingFocus = false;
mBlurOnSubmit = true;
mBlurOnSubmit = null;
mDisableFullscreen = false;
mListeners = null;
mTextWatcherDelegator = null;
@@ -277,11 +274,16 @@ public void setSelectionWatcher(SelectionWatcher selectionWatcher) {
mSelectionWatcher = selectionWatcher;
}
public void setBlurOnSubmit(boolean blurOnSubmit) {
public void setBlurOnSubmit(@Nullable Boolean blurOnSubmit) {
mBlurOnSubmit = blurOnSubmit;
}
public boolean getBlurOnSubmit() {
if (mBlurOnSubmit == null) {
// Default blurOnSubmit
return isMultiline() ? false : true;
}
return mBlurOnSubmit;
}
@@ -9,15 +9,9 @@
package com.facebook.react.views.textinput;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.util.LinkedList;
import java.util.Map;
import android.graphics.drawable.Drawable;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.InputFilter;
@@ -30,8 +24,6 @@
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import com.facebook.yoga.YogaConstants;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReactContext;
@@ -56,8 +48,12 @@
import com.facebook.react.views.text.DefaultStyleValuesUtil;
import com.facebook.react.views.text.ReactFontManager;
import com.facebook.react.views.text.ReactTextUpdate;
import com.facebook.react.views.text.ReactTextView;
import com.facebook.react.views.text.TextInlineImageSpan;
import com.facebook.yoga.YogaConstants;
import java.lang.reflect.Field;
import java.util.LinkedList;
import java.util.Map;
import javax.annotation.Nullable;
/**
* Manages instances of TextInput.
@@ -269,8 +265,8 @@ public void setOnSelectionChange(final ReactEditText view, boolean onSelectionCh
}
}
@ReactProp(name = "blurOnSubmit", defaultBoolean = true)
public void setBlurOnSubmit(ReactEditText view, boolean blurOnSubmit) {
@ReactProp(name = "blurOnSubmit")
public void setBlurOnSubmit(ReactEditText view, @Nullable Boolean blurOnSubmit) {
view.setBlurOnSubmit(blurOnSubmit);
}

0 comments on commit adb6646

Please sign in to comment.