11import React , { useState , useEffect } from 'react' ;
22import { View , Text } from 'react-native' ;
3- import { Progress , Button , Spacing } from '@uiw/react-native' ;
3+ import { Progress , Spacing , Button , Toast } from '@uiw/react-native' ;
44import Layout , { Container } from '../../Layout' ;
5- import { motorcycle } from './svg' ;
65
76const { Header, Body, Card } = Layout ;
87
@@ -11,31 +10,91 @@ const ProgressDemo = (props: any) => {
1110 const description = route . params . description ;
1211 const title = route . params . title ;
1312
14- const [ val , setValue ] = useState < number > ( 0 ) ;
15- const [ automaticVal , setAutomaticVal ] = useState < number > ( 0 ) ;
13+ const [ val , setValue ] = useState < number > ( 15 ) ;
14+ console . log ( 'val' , val ) ;
1615
1716 const onPress = ( ) => {
18- let count = val + 5 ;
19- if ( count > 100 ) {
20- count = 0 ;
17+ if ( val < 100 ) {
18+ setValue ( val + 5 ) ;
19+ } else {
20+ Toast . info ( '宝,别点了,要溢出了' )
2121 }
22- setValue ( count ) ;
2322 } ;
2423
2524 return (
2625 < Container >
2726 < Header title = { title } description = { description } />
2827 < Body style = { { paddingLeft : 16 , paddingRight : 16 } } >
29- < Header description = { '基本使用' } />
30- < Progress type = 'circle' />
31- < Header description = { '基本使用' } />
32- < Progress type = 'circle' />
33- < Header description = { '展示进度图标' } />
34- < Progress type = 'line' />
35- < Header description = { '改变进度图标' } />
36- < Progress type = 'circle' />
28+ < Card title = "基础实例" >
29+ < Progress type = 'circle' />
30+ < Spacing />
31+ < Progress type = 'line' />
32+ </ Card >
33+ < Card title = "自定义值" >
34+ < Progress type = 'circle' value = { val } />
35+ < Spacing />
36+ < Progress type = 'line' value = { val } />
37+ < Spacing />
38+ < Button onPress = { ( ) => onPress ( ) } > 你点我呀!</ Button >
39+ </ Card >
40+ < Card title = "自定义渐变色" >
41+ < Progress type = 'circle' color = { [ '#FFD080' , 'red' ] } />
42+ < Spacing />
43+ < Progress type = 'line' color = { [ '#FFD080' , 'red' ] } />
44+ </ Card >
45+ < Card title = "设置大小" >
46+ < Progress type = 'circle' width = { 60 } left = '6.5%' />
47+ < Spacing />
48+ < Progress type = 'circle' width = { 80 } left = '8.5%' />
49+ < Spacing />
50+ < Progress type = 'line' width = { 60 } />
51+ < Spacing />
52+ < Progress type = 'line' width = { 80 } />
53+ </ Card >
54+ < Card title = "是否显示单位" >
55+ < Progress type = 'circle' showUnit = { false } left = '12.5%' />
56+ < Spacing />
57+ < Progress type = 'line' showUnit = { false } />
58+ </ Card >
59+ < Card title = "自定义单色" >
60+ < Progress type = 'circle' color = '#FFD080' />
61+ < Spacing />
62+ < Progress type = 'line' color = '#FFD080' />
63+ </ Card >
64+ < Card title = "自定义背景色" >
65+ < Progress type = 'circle' bgColor = "#FFD080" value = { 5 } />
66+ < Spacing />
67+ < Progress type = 'line' bgColor = '#FFD080' value = { 70 } />
68+ </ Card >
69+ < Card title = "设置外环宽度" >
70+ < Progress type = 'circle' value = { 5 } strokeWidth = { 25 } />
71+ < Spacing />
72+ < Progress type = 'line' value = { 70 } strokeWidth = { 15 } />
73+ </ Card >
74+
75+ < Card title = "是否显示文本" >
76+ < Progress type = 'circle' value = { 68 } showLabel = { false } />
77+ < Spacing />
78+ < Progress type = 'line' value = { 70 } showLabel = { false } />
79+ </ Card >
80+ < Card title = "自定义标签" >
81+ < Progress type = 'circle' value = { 53 } label = { < Text > 饕餮</ Text > } />
82+ < Spacing />
83+ < Progress type = 'line' value = { 30 } label = { < Text > 饕餮</ Text > } />
84+ </ Card >
85+ < Card title = "设置外环宽度" >
86+ < Progress type = 'circle' value = { 5 } strokeWidth = { 25 } />
87+ < Spacing />
88+ < Progress type = 'line' value = { 70 } strokeWidth = { 15 } />
89+ </ Card >
90+ < Card title = "自定义文本位置" >
91+ < Progress type = 'circle' value = { 5 } top = "50%" left = '50%' />
92+ < Spacing />
93+ < Progress type = 'line' value = { 70 } top = "-20%" left = '50%' />
94+ </ Card >
95+ < Spacing />
3796 </ Body >
38- </ Container >
97+ </ Container >
3998 ) ;
4099} ;
41100
0 commit comments