Fix ClassCastException
Summary: Closes https://github.com/facebook/react-native/pull/7225 Differential Revision: D3234878 Pulled By: dmmiller fb-gh-sync-id: 00f36f3c45e3492026729175e393812879149773 fbshipit-source-id: 00f36f3c45e3492026729175e393812879149773
This commit is contained in:
parent
1af47603cf
commit
f323b02eff
|
@ -289,7 +289,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
}
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
newFilters = (InputFilter[]) list.toArray();
|
||||
newFilters = (InputFilter[]) list.toArray(new InputFilter[list.size()]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -12,6 +12,7 @@ package com.facebook.react.views.textinput;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.text.InputType;
|
||||
import android.text.InputFilter;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.widget.EditText;
|
||||
|
@ -330,4 +331,13 @@ public class ReactTextInputPropertyTest {
|
|||
buildStyles("textAlign", null, "textAlignVertical", null));
|
||||
assertThat(view.getGravity()).isEqualTo(defaultGravity);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMaxLength() {
|
||||
ReactEditText view = mManager.createViewInstance(mThemedContext);
|
||||
InputFilter[] filters = new InputFilter[] { new InputFilter.AllCaps() };
|
||||
view.setFilters(filters);
|
||||
mManager.setMaxLength(view, null);
|
||||
assertThat(view.getFilters()).isEqualTo(filters);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue