Disable ImportantForAutofill when using Android API level < 26
Summary: Disable ImportantForAutofill when using Android API level < 26 Reviewed By: wcheng86 Differential Revision: D14400085 fbshipit-source-id: db8f94d38ed6b3f6559a13abb8752f08a3d0dab2
This commit is contained in:
Родитель
756dc2f3ed
Коммит
36957dcedd
|
@ -283,9 +283,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
|
||||
@ReactProp(name = "importantForAutofill")
|
||||
public void setImportantForAutofill(ReactEditText view, @Nullable String value) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
int mode = View.IMPORTANT_FOR_AUTOFILL_AUTO;
|
||||
if ("no".equals(value)) {
|
||||
mode = View.IMPORTANT_FOR_AUTOFILL_NO;
|
||||
|
@ -296,6 +293,13 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
} else if ("yesExcludeDescendants".equals(value)) {
|
||||
mode = View.IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS;
|
||||
}
|
||||
setImportantForAutofill(view, mode);
|
||||
}
|
||||
|
||||
private void setImportantForAutofill(ReactEditText view, int mode) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
view.setImportantForAutofill(mode);
|
||||
}
|
||||
|
||||
|
@ -566,7 +570,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
@ReactProp(name = "autoComplete")
|
||||
public void setTextContentType(ReactEditText view, @Nullable String autocomplete) {
|
||||
if (autocomplete == null) {
|
||||
view.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
|
||||
setImportantForAutofill(view, View.IMPORTANT_FOR_AUTOFILL_NO);
|
||||
} else if ("username".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_USERNAME);
|
||||
} else if ("password".equals(autocomplete)) {
|
||||
|
@ -592,7 +596,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
|||
} else if ("cc-exp-year".equals(autocomplete)) {
|
||||
view.setAutofillHints(View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR);
|
||||
} else if ("off".equals(autocomplete)) {
|
||||
view.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
|
||||
setImportantForAutofill(view, View.IMPORTANT_FOR_AUTOFILL_NO);
|
||||
} else {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid autocomplete option: " + autocomplete);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче