mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
TextInput: ViewManager shouldn't reset EditText padding when none is set
Summary: UpdateLocalData and UpdateState return an `extra data` object, which in the case of TextInput contains padding. In Paper, the padding was always set on this object; in Fabric, it generally is not. However, the ViewManager was unconditionally setting the padding on the view, regardless of whether or not padding was set. We just check the padding values before setting now. This fixes an issue where the padding would be reset when the user started typing in Fabric. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D18875261 fbshipit-source-id: d7cb87c07f47ab522e32cd34a4ca6ed5fea2e832
This commit is contained in:
committed by
Facebook Github Bot
parent
b1f2c1e2c5
commit
9bb042fe58
+15
-5
@@ -254,11 +254,21 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
if (extraData instanceof ReactTextUpdate) {
|
||||
ReactTextUpdate update = (ReactTextUpdate) extraData;
|
||||
|
||||
view.setPadding(
|
||||
(int) update.getPaddingLeft(),
|
||||
(int) update.getPaddingTop(),
|
||||
(int) update.getPaddingRight(),
|
||||
(int) update.getPaddingBottom());
|
||||
// TODO T58784068: delete this block of code, these are always unset in Fabric
|
||||
int paddingLeft = (int) update.getPaddingLeft();
|
||||
int paddingTop = (int) update.getPaddingTop();
|
||||
int paddingRight = (int) update.getPaddingRight();
|
||||
int paddingBottom = (int) update.getPaddingBottom();
|
||||
if (paddingLeft != UNSET
|
||||
|| paddingTop != UNSET
|
||||
|| paddingRight != UNSET
|
||||
|| paddingBottom != UNSET) {
|
||||
view.setPadding(
|
||||
paddingLeft != UNSET ? paddingLeft : view.getPaddingLeft(),
|
||||
paddingTop != UNSET ? paddingTop : view.getPaddingTop(),
|
||||
paddingRight != UNSET ? paddingRight : view.getPaddingRight(),
|
||||
paddingBottom != UNSET ? paddingBottom : view.getPaddingBottom());
|
||||
}
|
||||
|
||||
if (update.containsImages()) {
|
||||
Spannable spannable = update.getText();
|
||||
|
||||
Reference in New Issue
Block a user