mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
feat(ios): textfield option to disable iOS autofill strong password handling (#8348)
* feat(ios): textfield option to disable autofill strong password handling * chore: api change report
This commit is contained in:
@ -2424,10 +2424,9 @@ export class TabViewItem extends ViewBase {
|
|||||||
// @public
|
// @public
|
||||||
export interface TapGestureEventData extends GestureEventData {
|
export interface TapGestureEventData extends GestureEventData {
|
||||||
getPointerCount(): number;
|
getPointerCount(): number;
|
||||||
|
|
||||||
getX(): number;
|
getX(): number;
|
||||||
|
|
||||||
getY(): number;
|
getY(): number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public
|
// @public
|
||||||
@ -2508,6 +2507,8 @@ export class TextField extends EditableTextBase {
|
|||||||
public static returnPressEvent: string;
|
public static returnPressEvent: string;
|
||||||
|
|
||||||
secure: boolean;
|
secure: boolean;
|
||||||
|
|
||||||
|
secureWithoutAutofill: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public
|
// @public
|
||||||
|
@ -8,6 +8,8 @@ export class TextFieldBase extends EditableTextBase implements TextFieldDefiniti
|
|||||||
public static returnPressEvent = "returnPress";
|
public static returnPressEvent = "returnPress";
|
||||||
public secure: boolean;
|
public secure: boolean;
|
||||||
public closeOnReturn: boolean;
|
public closeOnReturn: boolean;
|
||||||
|
// iOS only (to avoid 12+ suggested strong password handling)
|
||||||
|
public secureWithoutAutofill: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextFieldBase.prototype.recycleNativeView = "auto";
|
TextFieldBase.prototype.recycleNativeView = "auto";
|
||||||
|
@ -32,4 +32,9 @@ export class TextField extends EditableTextBase {
|
|||||||
* Gets or sets if a text field should dismiss on return.
|
* Gets or sets if a text field should dismiss on return.
|
||||||
*/
|
*/
|
||||||
closeOnReturn: boolean;
|
closeOnReturn: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iOS only (to avoid 12+ auto suggested strong password handling)
|
||||||
|
*/
|
||||||
|
secureWithoutAutofill: boolean;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,14 @@ class UITextFieldDelegateImpl extends NSObject implements UITextFieldDelegate {
|
|||||||
public textFieldShouldChangeCharactersInRangeReplacementString(textField: UITextField, range: NSRange, replacementString: string): boolean {
|
public textFieldShouldChangeCharactersInRangeReplacementString(textField: UITextField, range: NSRange, replacementString: string): boolean {
|
||||||
const owner = this._owner.get();
|
const owner = this._owner.get();
|
||||||
if (owner) {
|
if (owner) {
|
||||||
|
if (owner.secureWithoutAutofill && !textField.secureTextEntry) {
|
||||||
|
/**
|
||||||
|
* Helps avoid iOS 12+ autofill strong password suggestion prompt
|
||||||
|
* Discussed in several circles but for example:
|
||||||
|
* https://github.com/expo/expo/issues/2571#issuecomment-473347380
|
||||||
|
*/
|
||||||
|
textField.secureTextEntry = true;
|
||||||
|
}
|
||||||
const delta = replacementString.length - range.length;
|
const delta = replacementString.length - range.length;
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
if (textField.text.length + delta > owner.maxLength) {
|
if (textField.text.length + delta > owner.maxLength) {
|
||||||
|
Reference in New Issue
Block a user