설명 없음

validate.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import { Platform, Dimensions } from 'react-native';
  2. import { ifIphoneX } from 'react-native-iphone-x-helper'
  3. export function validateEmail(value) {
  4. const regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  5. return regex.test(value);
  6. }
  7. export function validatePassword(value) {
  8. // const regex = /^[\S]{8,32}$/;
  9. // const regex = /^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*)(?=.*[\.@#\$%\^&\*\(\)\[\]\\?\\\/\|\-~`\+\=\,\r\n\:\'\"]).{8,32}$/;
  10. const regex = /^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{8,}$/;
  11. return regex.test(value);
  12. }
  13. function getstatusBarHeight() {
  14. if (Platform.OS === 'ios') {
  15. return 20;
  16. }
  17. return 0;
  18. }
  19. const variables = {
  20. color: {
  21. primary: '#26B4FF',
  22. background: '#ECEDF0',
  23. info: '#46DFB7',
  24. error: '#E92A25',
  25. warn: '#FFC72F',
  26. border: '#E5E5E5',
  27. borderDark: '#d1d1d3',
  28. disabled: '#F5F5F5',
  29. disableBtn: '#969696',
  30. tipBackground: '#E7E9EC',
  31. white: '#fff',
  32. black: '#000000',
  33. line: '#CFCFCF',
  34. alphaWhite: 'rgba(255,255,255,0.6)',
  35. trendPath: '#63E2C7',
  36. trendArea: '#B9ECE2',
  37. trendValue: '#46DFB7',
  38. redButton: '#F44336',
  39. text: {
  40. primary: '#333',
  41. secondary: '#666',
  42. tip: '#999',
  43. placeholder: '#999',
  44. blue: '#009cff'
  45. }
  46. },
  47. fontSize: {
  48. xxxlarge: 27,
  49. xxlarge: 19,
  50. xlarge: 18,
  51. large: 17,
  52. medium: 16,
  53. normal: 14,
  54. small: 13,
  55. tiny: 12,
  56. xsmall: 10,
  57. xxsmall: 8
  58. },
  59. fontWeight: {
  60. light: '300',
  61. normal: '400',
  62. bold: '700'
  63. },
  64. height: {
  65. actionButton: 44,
  66. row: 45,
  67. largeRow: 55,
  68. doubleRow: 65,
  69. tripleRow: 85,
  70. narBar: Platform.OS === 'ios' ? 64 : 54,
  71. tabBar: 48,
  72. componentMargin: 19,
  73. componentMarginSmall: 9,
  74. statusBar: 20
  75. },
  76. margin: {
  77. horizontal: 15,
  78. vertical: 10
  79. },
  80. activeOpacity: 0.8,
  81. borderRadius: 5,
  82. commonGap: 4,
  83. commonGapBig: 12,
  84. commonMargin: 10,
  85. commonMarginTop: 35,
  86. statusBarHeight: getstatusBarHeight() + (ifIphoneX ? 18 : 0),
  87. screenWidth: Dimensions.get('window').width,
  88. screenHeight: Dimensions.get('window').height
  89. };
  90. export default variables;