mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
textInput: Fix placeholder is not completely visible on Android. (#20337)
Summary: On Android, placeholder of TextInput is not completely visible. TextInput had some default fixed width. On iOS it is perfectly visible. This commit makes it consistent on both the platforms. Before: https://user-images.githubusercontent.com/39303760/43045649-54cb45e8-8dda-11e8-9935-059ad8ee9def.png After: https://user-images.githubusercontent.com/39303760/43045650-54fb9428-8dda-11e8-88b8-176839d6c0a7.png Testing code:a0a6fbb491/App.js
Clone code froma0a6fbb491/App.js
and test on Android with and without this commit. Before: https://user-images.githubusercontent.com/39303760/43045649-54cb45e8-8dda-11e8-9935-059ad8ee9def.png After: https://user-images.githubusercontent.com/39303760/43045650-54fb9428-8dda-11e8-88b8-176839d6c0a7.png [ANDROID] [BUGFIX] [TextInput] - Fix placeholder is not completely visible on Android. Pull Request resolved: https://github.com/facebook/react-native/pull/20337 Differential Revision: D8950051 Pulled By: mdvacca fbshipit-source-id: a583a48c90ecd55d8dd8c6f4eef829608b2a6079
This commit is contained in:
parent
e592d6f8c7
commit
84022321c4
@ -21,11 +21,13 @@ public final class ReactTextInputLocalData {
|
||||
private final int mMaxLines;
|
||||
private final int mInputType;
|
||||
private final int mBreakStrategy;
|
||||
private final CharSequence mPlaceholder;
|
||||
|
||||
public ReactTextInputLocalData(EditText editText) {
|
||||
mText = new SpannableStringBuilder(editText.getText());
|
||||
mTextSize = editText.getTextSize();
|
||||
mInputType = editText.getInputType();
|
||||
mPlaceholder = editText.getHint();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
mMinLines = editText.getMinLines();
|
||||
@ -48,8 +50,9 @@ public final class ReactTextInputLocalData {
|
||||
editText.setMinLines(mMinLines);
|
||||
editText.setMaxLines(mMaxLines);
|
||||
editText.setInputType(mInputType);
|
||||
editText.setHint(mPlaceholder);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
editText.setBreakStrategy(mBreakStrategy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user