@mpxjs/webpack-plugin 2.10.4-beta.19 → 2.10.4-beta.19-input1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
import { forwardRef, useRef, useState, useContext, useEffect, createElement } from 'react';
|
|
41
41
|
import { TextInput } from 'react-native';
|
|
42
42
|
import { warn } from '@mpxjs/utils';
|
|
43
|
-
import { useUpdateEffect, useTransformStyle, useLayout, extendObject
|
|
43
|
+
import { useUpdateEffect, useTransformStyle, useLayout, extendObject } from './utils';
|
|
44
44
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
45
45
|
import useNodesRef from './useNodesRef';
|
|
46
46
|
import { FormContext, KeyboardAvoidContext } from './context';
|
|
47
|
-
const
|
|
48
|
-
text: '
|
|
47
|
+
const inputModeMap = {
|
|
48
|
+
text: 'text',
|
|
49
49
|
number: 'numeric',
|
|
50
|
-
idcard: '
|
|
51
|
-
digit:
|
|
50
|
+
idcard: 'text',
|
|
51
|
+
digit: 'decimal'
|
|
52
52
|
};
|
|
53
53
|
const Input = forwardRef((props, ref) => {
|
|
54
54
|
const { style = {}, allowFontScaling = false, type = 'text', value, password, 'placeholder-style': placeholderStyle = {}, disabled, maxlength = 140, 'cursor-spacing': cursorSpacing = 0, 'auto-focus': autoFocus, focus, 'confirm-type': confirmType = 'done', 'confirm-hold': confirmHold = false, cursor, 'cursor-color': cursorColor, 'selection-start': selectionStart = -1, 'selection-end': selectionEnd = -1, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'adjust-position': adjustPosition = true, bindinput, bindfocus, bindblur, bindconfirm, bindselectionchange,
|
|
@@ -71,7 +71,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
71
71
|
return value + '';
|
|
72
72
|
return '';
|
|
73
73
|
};
|
|
74
|
-
const
|
|
74
|
+
const inputMode = inputModeMap[type];
|
|
75
75
|
const defaultValue = parseValue(value);
|
|
76
76
|
const textAlignVertical = multiline ? 'top' : 'auto';
|
|
77
77
|
const tmpValue = useRef(defaultValue);
|
|
@@ -251,7 +251,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
251
251
|
ref: nodeRef,
|
|
252
252
|
style: extendObject({}, normalStyle, layoutStyle),
|
|
253
253
|
allowFontScaling,
|
|
254
|
-
|
|
254
|
+
inputMode: inputMode,
|
|
255
255
|
secureTextEntry: !!password,
|
|
256
256
|
defaultValue: defaultValue,
|
|
257
257
|
value: inputValue,
|
|
@@ -117,11 +117,11 @@ export interface PrivateInputProps {
|
|
|
117
117
|
|
|
118
118
|
type FinalInputProps = InputProps & PrivateInputProps
|
|
119
119
|
|
|
120
|
-
const
|
|
121
|
-
text: '
|
|
120
|
+
const inputModeMap: Record<Type, string> = {
|
|
121
|
+
text: 'text',
|
|
122
122
|
number: 'numeric',
|
|
123
|
-
idcard: '
|
|
124
|
-
digit:
|
|
123
|
+
idcard: 'text',
|
|
124
|
+
digit: 'decimal'
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps>((props: FinalInputProps, ref): JSX.Element => {
|
|
@@ -181,7 +181,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
|
|
|
181
181
|
return ''
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
const
|
|
184
|
+
const inputMode = inputModeMap[type]
|
|
185
185
|
const defaultValue = parseValue(value)
|
|
186
186
|
const textAlignVertical = multiline ? 'top' : 'auto'
|
|
187
187
|
|
|
@@ -438,7 +438,7 @@ const Input = forwardRef<HandlerRef<TextInput, FinalInputProps>, FinalInputProps
|
|
|
438
438
|
ref: nodeRef,
|
|
439
439
|
style: extendObject({}, normalStyle, layoutStyle),
|
|
440
440
|
allowFontScaling,
|
|
441
|
-
|
|
441
|
+
inputMode: inputMode,
|
|
442
442
|
secureTextEntry: !!password,
|
|
443
443
|
defaultValue: defaultValue,
|
|
444
444
|
value: inputValue,
|