Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Commit 5b7ee99

Browse files
committed
fix editable inputFormatters bug
1 parent e7838e6 commit 5b7ee99

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

com.unity.uiwidgets/Runtime/widgets/editable_text.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,13 @@ public EditableText(
191191
paste: true,
192192
selectAll: true
193193
);
194-
inputFormatters = inputFormatters ?? new List<TextInputFormatter>();
195194
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline);
196-
List<TextInputFormatter> formatters = new List<TextInputFormatter>();
197-
if (inputFormatters == null) {
198-
formatters = inputFormatters;
199-
}
200195

201-
inputFormatters = maxLines == 1
202-
? new List<TextInputFormatter>() {
203-
BlacklistingTextInputFormatter.singleLineFormatter,
204-
}
205-
: inputFormatters;
196+
this.inputFormatters = inputFormatters?? new List<TextInputFormatter>();
206197
if (maxLines == 1) {
207-
foreach (var formatter in formatters) {
208-
inputFormatters.Add(formatter);
209-
}
198+
this.inputFormatters.Add(BlacklistingTextInputFormatter.singleLineFormatter);
210199
}
200+
211201
showCursor = showCursor ?? !readOnly;
212202

213203
this.readOnly = readOnly;

0 commit comments

Comments
 (0)