@hero-design/rn 8.64.4 → 8.64.5

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.
@@ -1,4 +1,5 @@
1
1
  import React, {
2
+ ComponentProps,
2
3
  forwardRef,
3
4
  useCallback,
4
5
  useEffect,
@@ -6,7 +7,7 @@ import React, {
6
7
  useRef,
7
8
  useState,
8
9
  } from 'react';
9
- import { InteractionManager, TextInput } from 'react-native';
10
+ import { InteractionManager, Platform, TextInput } from 'react-native';
10
11
  import type { StyleProp, ViewStyle } from 'react-native';
11
12
  import Icon from '../Icon';
12
13
  import PinCell from './PinCell';
@@ -62,6 +63,14 @@ interface PinInputProps {
62
63
  * Testing id of the component.
63
64
  */
64
65
  testID?: string;
66
+ /**
67
+ * The text content type of the input.
68
+ */
69
+ textContentType?: ComponentProps<typeof TextInput>['textContentType'];
70
+ /**
71
+ * The autofill type of the input.
72
+ */
73
+ autoComplete?: ComponentProps<typeof TextInput>['autoComplete'];
65
74
  }
66
75
 
67
76
  export function getState({
@@ -104,12 +113,16 @@ const PinInput = forwardRef<PinInputHandler, PinInputProps>(
104
113
  error,
105
114
  style,
106
115
  testID,
116
+ textContentType,
117
+ autoComplete,
107
118
  },
108
119
  ref
109
120
  ) => {
110
121
  const inputRef = useRef<TextInput>(null);
111
122
  const [focused, setFocused] = useState(autoFocus);
112
123
  const state = getState({ disabled, error });
124
+ const maskedValueWithExtraSpace =
125
+ Platform.OS === 'android' && !value ? '*' : value;
113
126
 
114
127
  const focus = useCallback(() => {
115
128
  if (inputRef?.current) {
@@ -179,7 +192,7 @@ const PinInput = forwardRef<PinInputHandler, PinInputProps>(
179
192
  <StyledHiddenInput
180
193
  themePinLength={length}
181
194
  ref={inputRef}
182
- value={value}
195
+ value={maskedValueWithExtraSpace}
183
196
  onChangeText={changeText}
184
197
  secureTextEntry={secure}
185
198
  editable={!disabled}
@@ -187,11 +200,13 @@ const PinInput = forwardRef<PinInputHandler, PinInputProps>(
187
200
  onFocus={focus}
188
201
  onBlur={blur}
189
202
  maxLength={length}
190
- keyboardType="numeric"
191
- contextMenuHidden
192
203
  caretHidden
193
- pointerEvents="box-only"
204
+ pointerEvents="box-none"
205
+ keyboardType="numeric"
194
206
  testID="pin-hidden-input"
207
+ textContentType={textContentType}
208
+ autoComplete={autoComplete}
209
+ selectTextOnFocus={false}
195
210
  />
196
211
  </StyledWrapper>
197
212
  );
@@ -645,6 +645,7 @@ exports[`theme returns correct theme object 1`] = `
645
645
  "fontSizes": {
646
646
  "cellText": 28,
647
647
  "errorMessage": 12,
648
+ "hiddenInputText": 42,
648
649
  },
649
650
  "fonts": {
650
651
  "cellText": "BeVietnamPro-SemiBold",
@@ -665,6 +666,8 @@ exports[`theme returns correct theme object 1`] = `
665
666
  },
666
667
  "space": {
667
668
  "errorMessagePadding": 4,
669
+ "hiddenInputHorrizontalPadding": 8,
670
+ "hiddenInputText": 32,
668
671
  "spacer": 16,
669
672
  },
670
673
  },
@@ -21,6 +21,7 @@ const getPinInputTheme = (theme: GlobalTheme) => {
21
21
  const fontSizes = {
22
22
  cellText: theme.fontSizes.xxxxlarge,
23
23
  errorMessage: theme.fontSizes.small,
24
+ hiddenInputText: theme.fontSizes['7xlarge'],
24
25
  };
25
26
  const lineHeights = {
26
27
  cellText: theme.lineHeights.xxxxlarge,
@@ -36,6 +37,8 @@ const getPinInputTheme = (theme: GlobalTheme) => {
36
37
  const space = {
37
38
  spacer: theme.space.medium,
38
39
  errorMessagePadding: theme.space.xsmall,
40
+ hiddenInputText: theme.space.xlarge,
41
+ hiddenInputHorrizontalPadding: theme.space.small,
39
42
  };
40
43
 
41
44
  const radii = {
@@ -4840,3 +4840,5 @@ var drawChart = (function (exports) {
4840
4840
  </body>
4841
4841
  </html>
4842
4842
 
4843
+ >
4844
+