@klyftig/mobile-ui 1.2.0 → 1.2.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klyftig/mobile-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "scripts": {
5
5
  "pack-install": "npm pack && mv klyftig-ui-*.tgz /tmp/klyftig-ui-local.tgz && cd ../../mobile && npm install /tmp/klyftig-ui-local.tgz"
6
6
  },
@@ -11,12 +11,19 @@ interface GlassInputProps {
11
11
  secureTextEntry?: boolean;
12
12
  keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad';
13
13
  autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
14
+ // Off by default for fields where iOS would otherwise replace partially-edited
15
+ // multi-word values with its autocorrect suggestion and snap the caret to end.
16
+ autoCorrect?: boolean;
17
+ spellCheck?: boolean;
14
18
  disabled?: boolean;
15
19
  icon?: string;
16
20
  showPasswordToggle?: boolean;
17
21
  rightText?: string;
18
22
  textContentType?: 'none' | 'password' | 'newPassword' | 'emailAddress' | 'username' | 'oneTimeCode';
19
23
  autoComplete?: string;
24
+ onFocus?: () => void;
25
+ onBlur?: () => void;
26
+ selectTextOnFocus?: boolean;
20
27
  }
21
28
 
22
29
  const GlassInputComponent: React.FC<GlassInputProps> = ({
@@ -27,12 +34,17 @@ const GlassInputComponent: React.FC<GlassInputProps> = ({
27
34
  secureTextEntry = false,
28
35
  keyboardType = 'default',
29
36
  autoCapitalize = 'sentences',
37
+ autoCorrect,
38
+ spellCheck,
30
39
  disabled = false,
31
40
  icon,
32
41
  showPasswordToggle = false,
33
42
  rightText,
34
43
  textContentType,
35
44
  autoComplete,
45
+ onFocus,
46
+ onBlur,
47
+ selectTextOnFocus,
36
48
  }) => {
37
49
  const { colors } = useTheme();
38
50
  const [isSecure, setIsSecure] = useState(secureTextEntry);
@@ -40,11 +52,13 @@ const GlassInputComponent: React.FC<GlassInputProps> = ({
40
52
 
41
53
  const handleFocus = useCallback(() => {
42
54
  setIsFocused(true);
43
- }, []);
55
+ onFocus?.();
56
+ }, [onFocus]);
44
57
 
45
58
  const handleBlur = useCallback(() => {
46
59
  setIsFocused(false);
47
- }, []);
60
+ onBlur?.();
61
+ }, [onBlur]);
48
62
 
49
63
  const toggleSecure = useCallback(() => {
50
64
  setIsSecure(prev => !prev);
@@ -72,9 +86,12 @@ const GlassInputComponent: React.FC<GlassInputProps> = ({
72
86
  secureTextEntry={isSecure}
73
87
  keyboardType={keyboardType}
74
88
  autoCapitalize={autoCapitalize}
89
+ autoCorrect={autoCorrect}
90
+ spellCheck={spellCheck}
75
91
  editable={!disabled}
76
92
  onFocus={handleFocus}
77
93
  onBlur={handleBlur}
94
+ selectTextOnFocus={selectTextOnFocus}
78
95
  textContentType={textContentType ?? (secureTextEntry ? 'oneTimeCode' : undefined)}
79
96
  autoComplete={autoComplete as any}
80
97
  accessibilityLabel={label}