@onekeyfe/react-native-auto-size-input 1.1.33 → 1.1.34
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.
|
@@ -214,13 +214,16 @@ class HybridAutoSizeInput(val context: ThemedReactContext) : HybridAutoSizeInput
|
|
|
214
214
|
set(value) {
|
|
215
215
|
if (isDisposed) return
|
|
216
216
|
field = value
|
|
217
|
-
|
|
217
|
+
// Use setRawInputType so the IME shows the correct keyboard layout
|
|
218
|
+
// without restricting which characters the EditText accepts.
|
|
219
|
+
// JS-side sanitization handles character filtering.
|
|
220
|
+
inputView.setRawInputType(when (value) {
|
|
218
221
|
"numberPad" -> InputType.TYPE_CLASS_NUMBER
|
|
219
222
|
"decimalPad" -> InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
|
220
223
|
"emailAddress" -> InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|
|
221
224
|
"phonePad" -> InputType.TYPE_CLASS_PHONE
|
|
222
225
|
else -> InputType.TYPE_CLASS_TEXT
|
|
223
|
-
}
|
|
226
|
+
})
|
|
224
227
|
}
|
|
225
228
|
|
|
226
229
|
override var returnKeyType: String? = null
|
|
@@ -243,6 +246,11 @@ class HybridAutoSizeInput(val context: ThemedReactContext) : HybridAutoSizeInput
|
|
|
243
246
|
set(value) {
|
|
244
247
|
if (isDisposed) return
|
|
245
248
|
field = value
|
|
249
|
+
// autoCorrect only applies to text-class inputs. Modifying inputType on
|
|
250
|
+
// number/phone classes would install a restrictive KeyListener and
|
|
251
|
+
// override the raw input type set by keyboardType.
|
|
252
|
+
val inputClass = inputView.inputType and InputType.TYPE_MASK_CLASS
|
|
253
|
+
if (inputClass != InputType.TYPE_CLASS_TEXT) return
|
|
246
254
|
val currentType = inputView.inputType
|
|
247
255
|
inputView.inputType = if (value == true) {
|
|
248
256
|
currentType or InputType.TYPE_TEXT_FLAG_AUTO_CORRECT
|
|
@@ -256,7 +264,13 @@ class HybridAutoSizeInput(val context: ThemedReactContext) : HybridAutoSizeInput
|
|
|
256
264
|
set(value) {
|
|
257
265
|
if (isDisposed) return
|
|
258
266
|
field = value
|
|
259
|
-
|
|
267
|
+
// Cap flags share bit positions with number flags
|
|
268
|
+
// (TYPE_TEXT_FLAG_CAP_WORDS=0x2000 == TYPE_NUMBER_FLAG_DECIMAL=0x2000,
|
|
269
|
+
// TYPE_TEXT_FLAG_CAP_CHARACTERS=0x1000 == TYPE_NUMBER_FLAG_SIGNED=0x1000).
|
|
270
|
+
// Modifying inputType on number/phone classes would strip decimal/signed
|
|
271
|
+
// flags and install a restrictive KeyListener. Skip for non-text classes.
|
|
272
|
+
val inputClass = inputView.inputType and InputType.TYPE_MASK_CLASS
|
|
273
|
+
if (inputClass != InputType.TYPE_CLASS_TEXT) return
|
|
260
274
|
val capFlag = when (value) {
|
|
261
275
|
"characters" -> InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS
|
|
262
276
|
"words" -> InputType.TYPE_TEXT_FLAG_CAP_WORDS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-auto-size-input",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.34",
|
|
4
4
|
"description": "Auto-sizing text input with font scaling, prefix and suffix support",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|