@onairos/react-native 3.7.3 → 3.7.4
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.
|
@@ -48,7 +48,17 @@ const CodeInput = ({
|
|
|
48
48
|
};
|
|
49
49
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
50
50
|
style: styles.container
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
52
|
+
style: styles.boxesContainer
|
|
53
|
+
}, Array(length).fill(0).map((_, index) => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
54
|
+
key: index,
|
|
55
|
+
style: [styles.box, code[index] ? styles.boxFilled : null, focusedIndex === index && !code[index] ? styles.boxFocused : null]
|
|
51
56
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, {
|
|
57
|
+
style: styles.boxText,
|
|
58
|
+
value: code[index],
|
|
59
|
+
editable: false,
|
|
60
|
+
pointerEvents: "none"
|
|
61
|
+
})))), /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, {
|
|
52
62
|
ref: hiddenInputRef,
|
|
53
63
|
style: styles.hiddenInput,
|
|
54
64
|
value: code.join(''),
|
|
@@ -57,19 +67,9 @@ const CodeInput = ({
|
|
|
57
67
|
maxLength: length,
|
|
58
68
|
autoComplete: "sms-otp",
|
|
59
69
|
textContentType: "oneTimeCode",
|
|
60
|
-
caretHidden: true
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
onPress: handleBoxPress
|
|
64
|
-
}, Array(length).fill(0).map((_, index) => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
65
|
-
key: index,
|
|
66
|
-
style: [styles.box, code[index] ? styles.boxFilled : null, focusedIndex === index && !code[index] ? styles.boxFocused : null]
|
|
67
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, {
|
|
68
|
-
style: styles.boxText,
|
|
69
|
-
value: code[index],
|
|
70
|
-
editable: false,
|
|
71
|
-
pointerEvents: "none"
|
|
72
|
-
})))));
|
|
70
|
+
caretHidden: true,
|
|
71
|
+
selectionColor: "transparent"
|
|
72
|
+
}));
|
|
73
73
|
};
|
|
74
74
|
exports.CodeInput = CodeInput;
|
|
75
75
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -78,9 +78,13 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
78
78
|
},
|
|
79
79
|
hiddenInput: {
|
|
80
80
|
position: 'absolute',
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
top: 0,
|
|
82
|
+
left: 0,
|
|
83
|
+
right: 0,
|
|
84
|
+
bottom: 0,
|
|
85
|
+
color: 'transparent',
|
|
86
|
+
backgroundColor: 'transparent',
|
|
87
|
+
fontSize: 1
|
|
84
88
|
},
|
|
85
89
|
boxesContainer: {
|
|
86
90
|
flexDirection: 'row',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
-
import { View, TextInput, StyleSheet,
|
|
2
|
+
import { View, TextInput, StyleSheet, Keyboard } from 'react-native';
|
|
3
3
|
import { COLORS } from '../theme';
|
|
4
4
|
const CodeInput = ({
|
|
5
5
|
length = 6,
|
|
@@ -41,7 +41,17 @@ const CodeInput = ({
|
|
|
41
41
|
};
|
|
42
42
|
return /*#__PURE__*/React.createElement(View, {
|
|
43
43
|
style: styles.container
|
|
44
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
45
|
+
style: styles.boxesContainer
|
|
46
|
+
}, Array(length).fill(0).map((_, index) => /*#__PURE__*/React.createElement(View, {
|
|
47
|
+
key: index,
|
|
48
|
+
style: [styles.box, code[index] ? styles.boxFilled : null, focusedIndex === index && !code[index] ? styles.boxFocused : null]
|
|
44
49
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
50
|
+
style: styles.boxText,
|
|
51
|
+
value: code[index],
|
|
52
|
+
editable: false,
|
|
53
|
+
pointerEvents: "none"
|
|
54
|
+
})))), /*#__PURE__*/React.createElement(TextInput, {
|
|
45
55
|
ref: hiddenInputRef,
|
|
46
56
|
style: styles.hiddenInput,
|
|
47
57
|
value: code.join(''),
|
|
@@ -50,19 +60,9 @@ const CodeInput = ({
|
|
|
50
60
|
maxLength: length,
|
|
51
61
|
autoComplete: "sms-otp",
|
|
52
62
|
textContentType: "oneTimeCode",
|
|
53
|
-
caretHidden: true
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
onPress: handleBoxPress
|
|
57
|
-
}, Array(length).fill(0).map((_, index) => /*#__PURE__*/React.createElement(View, {
|
|
58
|
-
key: index,
|
|
59
|
-
style: [styles.box, code[index] ? styles.boxFilled : null, focusedIndex === index && !code[index] ? styles.boxFocused : null]
|
|
60
|
-
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
61
|
-
style: styles.boxText,
|
|
62
|
-
value: code[index],
|
|
63
|
-
editable: false,
|
|
64
|
-
pointerEvents: "none"
|
|
65
|
-
})))));
|
|
63
|
+
caretHidden: true,
|
|
64
|
+
selectionColor: "transparent"
|
|
65
|
+
}));
|
|
66
66
|
};
|
|
67
67
|
const styles = StyleSheet.create({
|
|
68
68
|
container: {
|
|
@@ -70,9 +70,13 @@ const styles = StyleSheet.create({
|
|
|
70
70
|
},
|
|
71
71
|
hiddenInput: {
|
|
72
72
|
position: 'absolute',
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
top: 0,
|
|
74
|
+
left: 0,
|
|
75
|
+
right: 0,
|
|
76
|
+
bottom: 0,
|
|
77
|
+
color: 'transparent',
|
|
78
|
+
backgroundColor: 'transparent',
|
|
79
|
+
fontSize: 1
|
|
76
80
|
},
|
|
77
81
|
boxesContainer: {
|
|
78
82
|
flexDirection: 'row',
|
package/package.json
CHANGED