@@ -95,13 +95,15 @@ export interface InputProps {
9595 'selection-start' ?: number
9696 'selection-end' ?: number
9797 'placeholder-style' ?: { color ?: string }
98- 'enable-offset' ?: boolean ,
98+ 'enable-offset' ?: boolean
9999 'enable-var' ?: boolean
100100 'external-var-context' ?: Record < string , any >
101101 'parent-font-size' ?: number
102102 'parent-width' ?: number
103103 'parent-height' ?: number
104- 'adjust-position' : boolean ,
104+ // 只有 RN 环境读取
105+ 'keyboard-type' ?: string
106+ 'adjust-position' : boolean
105107 bindinput ?: ( evt : NativeSyntheticEvent < TextInputTextInputEventData > | unknown ) => void
106108 bindfocus ?: ( evt : NativeSyntheticEvent < TextInputFocusEventData > | unknown ) => void
107109 bindblur ?: ( evt : NativeSyntheticEvent < TextInputFocusEventData > | unknown ) => void
@@ -118,11 +120,11 @@ export interface PrivateInputProps {
118120
119121type FinalInputProps = InputProps & PrivateInputProps
120122
121- const keyboardTypeMap : Record < Type , string > = {
122- text : 'default ' ,
123+ const inputModeMap : Record < Type , string > = {
124+ text : 'text ' ,
123125 number : 'numeric' ,
124- idcard : 'default ' ,
125- digit : isIOS ? 'decimal-pad' : 'numeric '
126+ idcard : 'text ' ,
127+ digit : 'decimal'
126128}
127129
128130const Input = forwardRef < HandlerRef < TextInput , FinalInputProps > , FinalInputProps > ( ( props : FinalInputProps , ref ) : JSX . Element => {
@@ -150,6 +152,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
150152 'parent-width' : parentWidth ,
151153 'parent-height' : parentHeight ,
152154 'adjust-position' : adjustPosition = true ,
155+ 'keyboard-type' : originalKeyboardType ,
153156 bindinput,
154157 bindfocus,
155158 bindblur,
@@ -182,7 +185,6 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
182185 return ''
183186 }
184187
185- const keyboardType = keyboardTypeMap [ type ]
186188 const defaultValue = parseValue ( value )
187189 const textAlignVertical = multiline ? 'top' : 'auto'
188190
@@ -459,7 +461,8 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
459461 ref : nodeRef ,
460462 style : extendObject ( { } , normalStyle , layoutStyle ) ,
461463 allowFontScaling,
462- keyboardType : keyboardType ,
464+ inputMode : originalKeyboardType ? undefined : inputModeMap [ type ] ,
465+ keyboardType : originalKeyboardType ,
463466 secureTextEntry : ! ! password ,
464467 defaultValue : defaultValue ,
465468 value : inputValue ,
0 commit comments