@hero-design/rn 8.64.7 → 8.64.8-alpha.0
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/CHANGELOG.md +0 -6
- package/es/index.js +1 -14
- package/lib/index.js +1 -14
- package/package.json +3 -2
- package/src/components/PinInput/index.tsx +1 -17
- package/.turbo/turbo-build.log +0 -5
- package/stats/8.64.7/rn-stats.html +0 -4842
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
-
## 8.64.7
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [#3336](https://github.com/Thinkei/hero-design/pull/3336) [`34f5cb207ed68fcb4d2882e0175c7c085963332d`](https://github.com/Thinkei/hero-design/commit/34f5cb207ed68fcb4d2882e0175c7c085963332d) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [PinInput] Add value validation logic
|
|
8
|
-
|
|
9
3
|
## 8.64.6
|
|
10
4
|
|
|
11
5
|
### Patch Changes
|
package/es/index.js
CHANGED
|
@@ -15616,10 +15616,6 @@ var PinInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
15616
15616
|
});
|
|
15617
15617
|
var trimmedValue = normalizeValue(value, length);
|
|
15618
15618
|
var maskedValueWithExtraSpace = Platform.OS === 'android' && !trimmedValue ? '*' : trimmedValue;
|
|
15619
|
-
var _useState3 = useState(false),
|
|
15620
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
15621
|
-
hasFulfilled = _useState4[0],
|
|
15622
|
-
setHasFulfilled = _useState4[1];
|
|
15623
15619
|
var focus = useCallback(function () {
|
|
15624
15620
|
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
15625
15621
|
inputRef.current.focus();
|
|
@@ -15633,22 +15629,13 @@ var PinInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
15633
15629
|
}
|
|
15634
15630
|
}, []);
|
|
15635
15631
|
var changeText = useCallback(function (text) {
|
|
15636
|
-
// If the input is already fulfilled and the user tries to remove characters
|
|
15637
|
-
if (hasFulfilled && text.length < length) {
|
|
15638
|
-
setHasFulfilled(false);
|
|
15639
|
-
}
|
|
15640
|
-
// If the input is already fulfilled and the user tries to add more characters
|
|
15641
|
-
if (hasFulfilled && ((text === null || text === void 0 ? void 0 : text.match(/\d/g)) || []).join('').length > length) {
|
|
15642
|
-
return;
|
|
15643
|
-
}
|
|
15644
15632
|
// Prevent user from entering more than the length
|
|
15645
15633
|
var trimmedPin = normalizeValue(text, length);
|
|
15646
15634
|
onChangeText === null || onChangeText === void 0 || onChangeText(trimmedPin);
|
|
15647
15635
|
if (trimmedPin.length === length) {
|
|
15648
15636
|
onFulfill === null || onFulfill === void 0 || onFulfill(trimmedPin);
|
|
15649
|
-
setHasFulfilled(true);
|
|
15650
15637
|
}
|
|
15651
|
-
}, [length, onChangeText, onFulfill
|
|
15638
|
+
}, [length, onChangeText, onFulfill]);
|
|
15652
15639
|
useEffect(function () {
|
|
15653
15640
|
// Must run after animations for keyboard to automatically open
|
|
15654
15641
|
if (autoFocus) {
|
package/lib/index.js
CHANGED
|
@@ -15646,10 +15646,6 @@ var PinInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
15646
15646
|
});
|
|
15647
15647
|
var trimmedValue = normalizeValue(value, length);
|
|
15648
15648
|
var maskedValueWithExtraSpace = reactNative.Platform.OS === 'android' && !trimmedValue ? '*' : trimmedValue;
|
|
15649
|
-
var _useState3 = React.useState(false),
|
|
15650
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
15651
|
-
hasFulfilled = _useState4[0],
|
|
15652
|
-
setHasFulfilled = _useState4[1];
|
|
15653
15649
|
var focus = React.useCallback(function () {
|
|
15654
15650
|
if (inputRef !== null && inputRef !== void 0 && inputRef.current) {
|
|
15655
15651
|
inputRef.current.focus();
|
|
@@ -15663,22 +15659,13 @@ var PinInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
15663
15659
|
}
|
|
15664
15660
|
}, []);
|
|
15665
15661
|
var changeText = React.useCallback(function (text) {
|
|
15666
|
-
// If the input is already fulfilled and the user tries to remove characters
|
|
15667
|
-
if (hasFulfilled && text.length < length) {
|
|
15668
|
-
setHasFulfilled(false);
|
|
15669
|
-
}
|
|
15670
|
-
// If the input is already fulfilled and the user tries to add more characters
|
|
15671
|
-
if (hasFulfilled && ((text === null || text === void 0 ? void 0 : text.match(/\d/g)) || []).join('').length > length) {
|
|
15672
|
-
return;
|
|
15673
|
-
}
|
|
15674
15662
|
// Prevent user from entering more than the length
|
|
15675
15663
|
var trimmedPin = normalizeValue(text, length);
|
|
15676
15664
|
onChangeText === null || onChangeText === void 0 || onChangeText(trimmedPin);
|
|
15677
15665
|
if (trimmedPin.length === length) {
|
|
15678
15666
|
onFulfill === null || onFulfill === void 0 || onFulfill(trimmedPin);
|
|
15679
|
-
setHasFulfilled(true);
|
|
15680
15667
|
}
|
|
15681
|
-
}, [length, onChangeText, onFulfill
|
|
15668
|
+
}, [length, onChangeText, onFulfill]);
|
|
15682
15669
|
React.useEffect(function () {
|
|
15683
15670
|
// Must run after animations for keyboard to automatically open
|
|
15684
15671
|
if (autoFocus) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.64.
|
|
3
|
+
"version": "8.64.8-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -93,5 +93,6 @@
|
|
|
93
93
|
"ts-jest": "^29.1.1",
|
|
94
94
|
"typescript": "4.8.4"
|
|
95
95
|
},
|
|
96
|
-
"prettier": "prettier-config-hd"
|
|
96
|
+
"prettier": "prettier-config-hd",
|
|
97
|
+
"react-native": "src/index.ts"
|
|
97
98
|
}
|
|
@@ -130,8 +130,6 @@ const PinInput = forwardRef<PinInputHandler, PinInputProps>(
|
|
|
130
130
|
const maskedValueWithExtraSpace =
|
|
131
131
|
Platform.OS === 'android' && !trimmedValue ? '*' : trimmedValue;
|
|
132
132
|
|
|
133
|
-
const [hasFulfilled, setHasFulfilled] = useState(false);
|
|
134
|
-
|
|
135
133
|
const focus = useCallback(() => {
|
|
136
134
|
if (inputRef?.current) {
|
|
137
135
|
inputRef.current.focus();
|
|
@@ -148,19 +146,6 @@ const PinInput = forwardRef<PinInputHandler, PinInputProps>(
|
|
|
148
146
|
|
|
149
147
|
const changeText = useCallback(
|
|
150
148
|
(text: string) => {
|
|
151
|
-
// If the input is already fulfilled and the user tries to remove characters
|
|
152
|
-
if (hasFulfilled && text.length < length) {
|
|
153
|
-
setHasFulfilled(false);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// If the input is already fulfilled and the user tries to add more characters
|
|
157
|
-
if (
|
|
158
|
-
hasFulfilled &&
|
|
159
|
-
(text?.match(/\d/g) || []).join('').length > length
|
|
160
|
-
) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
149
|
// Prevent user from entering more than the length
|
|
165
150
|
const trimmedPin = normalizeValue(text, length);
|
|
166
151
|
|
|
@@ -168,10 +153,9 @@ const PinInput = forwardRef<PinInputHandler, PinInputProps>(
|
|
|
168
153
|
|
|
169
154
|
if (trimmedPin.length === length) {
|
|
170
155
|
onFulfill?.(trimmedPin);
|
|
171
|
-
setHasFulfilled(true);
|
|
172
156
|
}
|
|
173
157
|
},
|
|
174
|
-
[length, onChangeText, onFulfill
|
|
158
|
+
[length, onChangeText, onFulfill]
|
|
175
159
|
);
|
|
176
160
|
|
|
177
161
|
useEffect(() => {
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
[36m
|
|
2
|
-
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
3
|
-
[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
4
|
-
[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
5
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [1m1m 3.5s[22m[39m
|