-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathutil.js
70 lines (63 loc) · 1.96 KB
/
util.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* @Author: edmond
* @Date: 2018-03-20 17:51:08
* @Last Modified by: edmond
* @Last Modified time: 2018-03-26 16:36:38
*/
import { Dimensions } from 'react-native';
export const getScreenWidth = () => Dimensions.get('window').width;
export const getScreenHeight = () => Dimensions.get('window').height;
export const Colors = {
containerBackgroundColor: '#FEFFFE',
codeViewBorderColor: 'grey',
focusedCodeViewBorderColor: '#1192F6',
codeColor: '#222',
coverColor: 'black',
};
export const Constants = {
autoFocus: false,
verifyCodeLength: 5,
codeViewWidth: getScreenWidth() / ((3 * 5) + 1),
codeViewBorderWidth: 1.5,
codeViewBorderRadius: 5,
codeFontSize: 16,
secureTextEntry: false,
warningTitle: 'Warining',
warningContent: 'Only numbers to be entered',
warningButtonText: 'OK',
};
export function getCodeArray(codeArray, verifyCodeLength) {
const codeArrayLength = codeArray.length;
for (let i = 0; i < verifyCodeLength; i++) {
if (i >= codeArrayLength) {
codeArray[i] = '';
}
}
// console.log('codeArray:', codeArray)
return codeArray;
}
// export function getCoverBGColorList(codeArray, verifyCodeLength) {
// const coverBGColorList = [];
// for (let i = 0; i < verifyCodeLength; i++) {
// if (codeArray[i] === '') {
// coverBGColorList.push('transparent');
// } else {
// coverBGColorList.push('black');
// }
// }
// // console.log('coverBGColorList:', coverBGColorList)
// return coverBGColorList;
// }
// export function getBeforeCoverBGColorList(codeArray, verifyCodeLength) {
// const coverBGColorList = [];
// const count = codeArray.filter(code => code !== '').length;
// for (let i = 0; i < verifyCodeLength; i++) {
// if (codeArray[i] === '' || i === count - 1) {
// coverBGColorList.push('transparent');
// } else {
// coverBGColorList.push('black');
// }
// }
// // console.log('coverBGColorList:', coverBGColorList)
// return coverBGColorList;
// }