From bdfbbbe876ebd60522e94c47432b7462647ed2d7 Mon Sep 17 00:00:00 2001 From: Matt Chowning Date: Wed, 15 Jan 2020 10:24:27 -0500 Subject: [PATCH] Allow overriding EditText construction in ReactTextInputShadowNode --- .../react/views/textinput/ReactTextInputShadowNode.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java index eeda18dedf5cba..5e9545cffc7794 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java @@ -75,7 +75,7 @@ public void setThemedContext(ThemedReactContext themedContext) { // of Android), and it cannot be changed. // So, we have to enforce it as a default padding. // TODO #7120264: Cache this stuff better. - EditText editText = new EditText(getThemedContext()); + EditText editText = createDummyEditText(); setDefaultPadding(Spacing.START, ViewCompat.getPaddingStart(editText)); setDefaultPadding(Spacing.TOP, editText.getPaddingTop()); setDefaultPadding(Spacing.END, ViewCompat.getPaddingEnd(editText)); @@ -249,4 +249,8 @@ public void setPadding(int spacingType, float padding) { super.setPadding(spacingType, padding); markUpdated(); } + + protected EditText createDummyEditText() { + return new EditText(getThemedContext()); + } }