@draftbit/core 48.4.7 → 48.4.8-41fa1b.2
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/lib/commonjs/components/PinInput/PinInput.js +1 -1
- package/lib/typescript/src/components/PinInput/PinInput.d.ts +2 -6
- package/lib/typescript/src/components/PinInput/PinInput.js +16 -15
- package/lib/typescript/src/components/PinInput/PinInput.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/PinInput/PinInput.js +16 -15
- package/src/components/PinInput/PinInput.js.map +1 -1
- package/src/components/PinInput/PinInput.tsx +20 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "48.4.
|
|
3
|
+
"version": "48.4.8-41fa1b.2+41fa1bd",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "48.
|
|
44
|
+
"@draftbit/types": "^48.4.8-41fa1b.2+41fa1bd",
|
|
45
45
|
"@expo/vector-icons": "^13.0.0",
|
|
46
46
|
"@material-ui/core": "^4.11.0",
|
|
47
47
|
"@material-ui/pickers": "^3.2.10",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
],
|
|
101
101
|
"testEnvironment": "node"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "41fa1bd5f068a9e0ca048669cab8770dc6cfc718"
|
|
104
104
|
}
|
|
@@ -5,7 +5,7 @@ import { CodeField, useClearByFocusCell, } from "react-native-confirmation-code-
|
|
|
5
5
|
import { withTheme } from "../../theming";
|
|
6
6
|
import PinInputText from "./PinInputText";
|
|
7
7
|
import { extractStyles } from "../../utilities";
|
|
8
|
-
const PinInput = React.forwardRef(({ theme, onInputFull, cellCount = 4, clearOnCellFocus = true, blurOnFull = true, renderItem, value, onChangeText, focusedBorderColor
|
|
8
|
+
const PinInput = React.forwardRef(({ theme, onInputFull, cellCount = 4, clearOnCellFocus = true, blurOnFull = true, renderItem, value, onChangeText, focusedBorderColor, focusedBackgroundColor, focusedBorderWidth, focusedTextColor, style, ...rest }, ref) => {
|
|
9
9
|
const newPinInputRef = React.useRef(null);
|
|
10
10
|
// Use the provided ref or default to new ref when not provided
|
|
11
11
|
const pinInputRef = ref
|
|
@@ -29,25 +29,25 @@ const PinInput = React.forwardRef(({ theme, onInputFull, cellCount = 4, clearOnC
|
|
|
29
29
|
}, [value, cellCount, blurOnFull, pinInputRef]);
|
|
30
30
|
return (React.createElement(CodeField, { ref: pinInputRef, ...(clearOnCellFocus ? codeFieldProps : {}), value: value, onChangeText: onChangeText, textInputStyle: { height: "100%" }, InputComponent: TextInput, cellCount: cellCount, renderCell: ({ symbol: cellValue, index, isFocused }) => (React.createElement(View, { key: index, onLayout: clearOnCellFocus ? getCellOnLayout(index) : undefined, style: { flex: 1 } }, (renderItem === null || renderItem === void 0 ? void 0 : renderItem({ cellValue, index, isFocused })) || (React.createElement(View, { testID: "default-code-input-cell", style: [
|
|
31
31
|
styles.cell,
|
|
32
|
-
{
|
|
33
|
-
borderWidth: isFocused
|
|
34
|
-
? focusedBorderWidth
|
|
35
|
-
: unFocusedBorderWidth,
|
|
36
|
-
borderColor: isFocused
|
|
37
|
-
? focusedBorderColor
|
|
38
|
-
: unFocusedBorderColor,
|
|
39
|
-
backgroundColor: isFocused
|
|
40
|
-
? focusedBackgroundColor
|
|
41
|
-
: unFocusedBackgroundColor,
|
|
42
|
-
},
|
|
32
|
+
{ borderColor: theme.colors.disabled },
|
|
43
33
|
viewStyles,
|
|
34
|
+
isFocused && focusedBorderWidth
|
|
35
|
+
? { borderWidth: focusedBorderWidth }
|
|
36
|
+
: undefined,
|
|
37
|
+
isFocused && focusedBorderColor
|
|
38
|
+
? { borderColor: focusedBorderColor }
|
|
39
|
+
: undefined,
|
|
40
|
+
isFocused && focusedBackgroundColor
|
|
41
|
+
? { backgroundColor: focusedBackgroundColor }
|
|
42
|
+
: undefined,
|
|
44
43
|
] },
|
|
45
44
|
React.createElement(PinInputText, { style: [
|
|
46
45
|
styles.cellText,
|
|
47
|
-
{
|
|
48
|
-
color: isFocused ? focusedTextColor : unFocusedTextColor,
|
|
49
|
-
},
|
|
46
|
+
{ color: theme.colors.strong },
|
|
50
47
|
textStyles,
|
|
48
|
+
isFocused && focusedTextColor
|
|
49
|
+
? { color: focusedTextColor }
|
|
50
|
+
: undefined,
|
|
51
51
|
], isFocused: isFocused }, cellValue))))), ...rest }));
|
|
52
52
|
});
|
|
53
53
|
const styles = StyleSheet.create({
|
|
@@ -61,6 +61,7 @@ const styles = StyleSheet.create({
|
|
|
61
61
|
aspectRatio: 1,
|
|
62
62
|
maxWidth: 70,
|
|
63
63
|
maxHeight: 70,
|
|
64
|
+
borderWidth: 1,
|
|
64
65
|
},
|
|
65
66
|
cellText: {
|
|
66
67
|
fontSize: 25,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PinInput.js","sourceRoot":"","sources":["PinInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"PinInput.js","sourceRoot":"","sources":["PinInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAKL,IAAI,EACJ,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,SAA6B,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,SAAS,EACT,mBAAmB,GACpB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAA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C,MAAM,CAAC,MAAM,EAAE;oBAC9B,UAAU;oBACV,SAAS,IAAI,gBAAgB;wBAC3B,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE;wBAC7B,CAAC,CAAC,SAAS;iBACd,EACD,SAAS,EAAE,SAAS,IAEnB,SAAS,CACG,CACV,CACR,CACI,CACR,KACG,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,CAAC;KACf;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
StyleProp,
|
|
4
4
|
ViewStyle,
|
|
5
|
+
TextStyle,
|
|
5
6
|
TextInput as NativeTextInput,
|
|
6
7
|
View,
|
|
7
8
|
StyleSheet,
|
|
@@ -29,14 +30,10 @@ interface PinInputProps extends TextInputProps {
|
|
|
29
30
|
blurOnFull?: boolean;
|
|
30
31
|
renderItem?: ({ cellValue, index, isFocused }: CellItem) => JSX.Element;
|
|
31
32
|
focusedBorderColor?: string;
|
|
32
|
-
unFocusedBorderColor?: string;
|
|
33
33
|
focusedBackgroundColor?: string;
|
|
34
|
-
unFocusedBackgroundColor?: string;
|
|
35
34
|
focusedBorderWidth?: number;
|
|
36
|
-
unFocusedBorderWidth?: number;
|
|
37
35
|
focusedTextColor?: string;
|
|
38
|
-
|
|
39
|
-
style?: StyleProp<ViewStyle>;
|
|
36
|
+
style?: StyleProp<ViewStyle | TextStyle>;
|
|
40
37
|
theme: Theme;
|
|
41
38
|
}
|
|
42
39
|
|
|
@@ -51,14 +48,10 @@ const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
|
|
|
51
48
|
renderItem,
|
|
52
49
|
value,
|
|
53
50
|
onChangeText,
|
|
54
|
-
focusedBorderColor
|
|
55
|
-
unFocusedBorderColor = theme.colors.disabled,
|
|
51
|
+
focusedBorderColor,
|
|
56
52
|
focusedBackgroundColor,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
unFocusedBorderWidth = 1,
|
|
60
|
-
focusedTextColor = theme.colors.strong,
|
|
61
|
-
unFocusedTextColor = focusedTextColor,
|
|
53
|
+
focusedBorderWidth,
|
|
54
|
+
focusedTextColor,
|
|
62
55
|
style,
|
|
63
56
|
...rest
|
|
64
57
|
},
|
|
@@ -109,27 +102,27 @@ const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
|
|
|
109
102
|
testID="default-code-input-cell"
|
|
110
103
|
style={[
|
|
111
104
|
styles.cell,
|
|
112
|
-
{
|
|
113
|
-
borderWidth: isFocused
|
|
114
|
-
? focusedBorderWidth
|
|
115
|
-
: unFocusedBorderWidth,
|
|
116
|
-
borderColor: isFocused
|
|
117
|
-
? focusedBorderColor
|
|
118
|
-
: unFocusedBorderColor,
|
|
119
|
-
backgroundColor: isFocused
|
|
120
|
-
? focusedBackgroundColor
|
|
121
|
-
: unFocusedBackgroundColor,
|
|
122
|
-
},
|
|
105
|
+
{ borderColor: theme.colors.disabled },
|
|
123
106
|
viewStyles,
|
|
107
|
+
isFocused && focusedBorderWidth
|
|
108
|
+
? { borderWidth: focusedBorderWidth }
|
|
109
|
+
: undefined,
|
|
110
|
+
isFocused && focusedBorderColor
|
|
111
|
+
? { borderColor: focusedBorderColor }
|
|
112
|
+
: undefined,
|
|
113
|
+
isFocused && focusedBackgroundColor
|
|
114
|
+
? { backgroundColor: focusedBackgroundColor }
|
|
115
|
+
: undefined,
|
|
124
116
|
]}
|
|
125
117
|
>
|
|
126
118
|
<PinInputText
|
|
127
119
|
style={[
|
|
128
120
|
styles.cellText,
|
|
129
|
-
{
|
|
130
|
-
color: isFocused ? focusedTextColor : unFocusedTextColor,
|
|
131
|
-
},
|
|
121
|
+
{ color: theme.colors.strong },
|
|
132
122
|
textStyles,
|
|
123
|
+
isFocused && focusedTextColor
|
|
124
|
+
? { color: focusedTextColor }
|
|
125
|
+
: undefined,
|
|
133
126
|
]}
|
|
134
127
|
isFocused={isFocused}
|
|
135
128
|
>
|
|
@@ -156,6 +149,7 @@ const styles = StyleSheet.create({
|
|
|
156
149
|
aspectRatio: 1,
|
|
157
150
|
maxWidth: 70,
|
|
158
151
|
maxHeight: 70,
|
|
152
|
+
borderWidth: 1,
|
|
159
153
|
},
|
|
160
154
|
cellText: {
|
|
161
155
|
fontSize: 25,
|