fix(PasswordBox): Fixes minor bug with keyboard type on PasswordBox (#733)
PasswordBox only supports 'number-pad' and 'password' (i.e., InputScopeNameValue.NumericPin and InputScopeNameValue.Password). Fixes #726
This commit is contained in:
Родитель
0f4db99204
Коммит
683b990681
|
@ -28,5 +28,16 @@ namespace ReactNative.Views.TextInput
|
|||
return InputScopeNameValue.Default;
|
||||
}
|
||||
}
|
||||
|
||||
public static InputScopeNameValue FromStringForPasswordBox(string inputScope)
|
||||
{
|
||||
switch (inputScope)
|
||||
{
|
||||
case "number-pad":
|
||||
return InputScopeNameValue.NumericPin;
|
||||
default:
|
||||
return InputScopeNameValue.Password;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,16 +274,13 @@ namespace ReactNative.Views.TextInput
|
|||
[ReactProp("keyboardType")]
|
||||
public void SetKeyboardType(PasswordBox view, string keyboardType)
|
||||
{
|
||||
view.InputScope = null;
|
||||
if (keyboardType != null)
|
||||
{
|
||||
var inputScope = new InputScope();
|
||||
inputScope.Names.Add(
|
||||
new InputScopeName(
|
||||
InputScopeHelpers.FromString(keyboardType)));
|
||||
var inputScope = new InputScope();
|
||||
var nameValue = keyboardType != null
|
||||
? InputScopeHelpers.FromStringForPasswordBox(keyboardType)
|
||||
: InputScopeNameValue.Password;
|
||||
|
||||
view.InputScope = inputScope;
|
||||
}
|
||||
inputScope.Names.Add(new InputScopeName(nameValue));
|
||||
view.InputScope = inputScope;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче