1- import React , { Component , useState } from 'react' ;
2- import { VerificationCode } from '@uiw/react-native' ;
3- import Layout , { Container } from '../../Layout' ;
4- import { ComProps } from '../../routes' ;
1+ import React , { Component , useState } from 'react' ;
2+ import { VerificationCode } from '@uiw/react-native' ;
3+ import Layout , { Container } from '../../Layout' ;
4+ import { ComProps } from '../../routes' ;
55
6- const { Header, Body, Card, Footer } = Layout ;
6+ const { Header, Body, Card, Footer} = Layout ;
77
88export interface VerificationCodeProps extends ComProps {
99 onBefore ?: ( ) => Promise < boolean > ;
1010 onSend ?: ( ) => Promise < boolean > | boolean ;
1111}
1212
13- const VerificationCodeDemo : React . FC < VerificationCodeProps > = ( { route } ) => {
13+ const VerificationCodeDemo : React . FC < VerificationCodeProps > = ( { route} ) => {
1414 const [ value , setValue ] = useState ( '' ) ;
1515 const description = route . params . description ;
1616 const title = route . params . title ;
1717
1818 const onChange = ( val : string ) => {
1919 console . log ( 'onChange--> 输入改变事件 ' , val ) ;
20- setValue ( val )
20+ setValue ( val ) ;
2121 } ;
2222
2323 const onBefore = async ( ) => {
2424 console . log ( 'onBefore--> 发验证码之前的回调 ' ) ;
2525 return true ;
26- }
26+ } ;
2727
2828 const onSend = async ( ) => {
2929 console . log ( 'onSend--> 发送验证码' ) ;
3030 return true ;
31- }
31+ } ;
3232
3333 const onEnd = ( ) => {
3434 console . log ( 'onEnd--> 倒计时结束后的回调' ) ;
35- }
35+ } ;
3636
3737 return (
3838 < Container >
3939 < Layout >
4040 < Header title = { title } description = { description } />
41- < Body style = { { paddingLeft : 16 , paddingRight : 16 } } >
41+ < Body style = { { paddingLeft : 16 , paddingRight : 16 } } >
4242 < Card title = "基础实例" >
43- < VerificationCode
44- value = { value }
45- count = { 3 }
46- onChange = { ( text : string ) => onChange ( text ) }
47- outerStyle = { { borderWidth : 1 , borderColor : "#ccc" } }
48-
49- />
43+ < VerificationCode value = { value } count = { 3 } onChange = { ( text : string ) => onChange ( text ) } outerStyle = { { borderWidth : 1 , borderColor : '#ccc' } } />
5044 </ Card >
5145 < Card title = "无边框" >
5246 < VerificationCode
5347 bordered = { false }
54- label = ' 我没框框哦'
48+ label = " 我没框框哦"
5549 count = { 3 }
5650 onChange = { ( text : string ) => onChange ( text ) }
57- outerStyle = { { backgroundColor : '#FFF' } }
51+ outerStyle = { { backgroundColor : '#FFF' } }
52+ buttonStyle = { { backgroundColor : '#fff' } }
5853 />
5954 </ Card >
6055 < Card title = "自定义倒计时文字和重新发送文字" >
6156 < VerificationCode
62- label = '点我'
63- resendLabel = '好了'
57+ label = "点我"
58+ resendLabel = "好了"
6459 value = { value }
6560 count = { 3 }
6661 onChange = { ( text : string ) => onChange ( text ) }
67- outerStyle = { { borderWidth : 1 , borderColor : " #ccc" } }
62+ outerStyle = { { borderWidth : 1 , borderColor : ' #ccc' } }
6863 />
6964 </ Card >
7065 < Card title = "自定义倒计时时长" >
71- < VerificationCode
72- count = { 10 }
73- value = { value }
74- onChange = { ( text : string ) => onChange ( text ) }
75- outerStyle = { { borderWidth : 1 , borderColor : "#ccc" } }
76- />
66+ < VerificationCode count = { 10 } value = { value } onChange = { ( text : string ) => onChange ( text ) } outerStyle = { { borderWidth : 1 , borderColor : '#ccc' } } />
7767 </ Card >
7868 < Card title = "输入改变事件" >
79- < VerificationCode
80- value = { value }
81- count = { 3 }
82- onChange = { ( text : string ) => onChange ( text ) }
83- outerStyle = { { borderWidth : 1 , borderColor : "#ccc" } }
84- />
69+ < VerificationCode value = { value } count = { 3 } onChange = { ( text : string ) => onChange ( text ) } outerStyle = { { borderWidth : 1 , borderColor : '#ccc' } } />
8570 </ Card >
8671 < Card title = "发验证码之前的回调" >
8772 < VerificationCode
8873 value = { value }
8974 count = { 3 }
9075 onChange = { ( text : string ) => onChange ( text ) }
9176 onBefore = { onBefore }
92- outerStyle = { { borderWidth : 1 , borderColor : " #ccc" } }
77+ outerStyle = { { borderWidth : 1 , borderColor : ' #ccc' } }
9378 />
9479 </ Card >
9580 < Card title = "发送验证码" >
@@ -98,7 +83,7 @@ const VerificationCodeDemo: React.FC<VerificationCodeProps> = ({ route }) => {
9883 count = { 3 }
9984 onChange = { ( text : string ) => onChange ( text ) }
10085 onSend = { onSend }
101- outerStyle = { { borderWidth : 1 , borderColor : " #ccc" } }
86+ outerStyle = { { borderWidth : 1 , borderColor : ' #ccc' } }
10287 />
10388 </ Card >
10489 < Card title = "倒计时结束后的回调" >
@@ -107,15 +92,15 @@ const VerificationCodeDemo: React.FC<VerificationCodeProps> = ({ route }) => {
10792 count = { 3 }
10893 onChange = { ( text : string ) => onChange ( text ) }
10994 onEnd = { onEnd }
110- outerStyle = { { borderWidth : 1 , borderColor : " #ccc" } }
95+ outerStyle = { { borderWidth : 1 , borderColor : ' #ccc' } }
11196 />
11297 </ Card >
11398 < Card title = "自定义外层输入框样式" >
11499 < VerificationCode
115100 value = { value }
116101 count = { 3 }
117102 onChange = { ( text : string ) => onChange ( text ) }
118- outerStyle = { { backgroundColor : '#FFD21D' , borderWidth : 1 , borderColor : " #ccc" } }
103+ outerStyle = { { backgroundColor : '#FFD21D' , borderWidth : 1 , borderColor : ' #ccc' } }
119104 />
120105 </ Card >
121106 < Card title = "自定义内层按钮样式" >
@@ -124,34 +109,28 @@ const VerificationCodeDemo: React.FC<VerificationCodeProps> = ({ route }) => {
124109 value = { value }
125110 count = { 3 }
126111 onChange = { ( text : string ) => onChange ( text ) }
127- buttonStyle = { { backgroundColor : '#F86E21' } }
128- outerStyle = { { borderWidth : 1 , borderColor : " #ccc" } }
112+ buttonStyle = { { backgroundColor : '#F86E21' } }
113+ outerStyle = { { borderWidth : 1 , borderColor : ' #ccc' } }
129114 />
130115 </ Card >
131116 < Card title = "自定义按钮文字样式" >
132- < VerificationCode
133- value = { value }
134- count = { 3 }
135- onChange = { ( text : string ) => onChange ( text ) }
136- outerStyle = { { borderWidth : 1 , borderColor : "#ccc" } }
137- />
117+ < VerificationCode value = { value } count = { 3 } onChange = { ( text : string ) => onChange ( text ) } outerStyle = { { borderWidth : 1 , borderColor : '#ccc' } } />
138118 </ Card >
139119 < Card title = "自定义输入框提示文字" >
140120 < VerificationCode
141121 bordered = { false }
142122 value = { value }
143123 count = { 3 }
144124 onChange = { ( text : string ) => onChange ( text ) }
145- placeholder = ' 请输入112233.....'
146- outerStyle = { { borderBottomWidth : 1 , borderBottomColor : '#CCC' } }
125+ placeholder = " 请输入112233....."
126+ outerStyle = { { borderBottomWidth : 1 , borderBottomColor : '#CCC' } }
147127 />
148128 </ Card >
149129 </ Body >
150130 < Footer />
151131 </ Layout >
152132 </ Container >
153133 ) ;
154- }
134+ } ;
155135
156136export default VerificationCodeDemo ;
157-
0 commit comments