@@ -3,7 +3,11 @@ import {SafeAreaView, Dimensions, ActivityIndicator} from 'react-native';
33import { TransitionImage } from '@uiw/react-native' ;
44import Layout from '../../Layout' ;
55const TransitionImageDemo = ( props : any ) => {
6- const { Header, Body} = Layout ;
6+ const [ state , setState ] = React . useState < any > ( {
7+ url1 : 'https://iknow-pic.cdn.bcebos.com/810a19d8bc3eb135828572d2ab1ea8d3fd1f441d' ,
8+ url3 : undefined ,
9+ } ) ;
10+ const { Header, Body, Card} = Layout ;
711 const { route} = props ;
812 const description = route . params . description ;
913 const title = route . params . title ;
@@ -12,19 +16,26 @@ const TransitionImageDemo = (props: any) => {
1216 < SafeAreaView style = { { flex : 1 } } >
1317 < Header title = { title } description = { description } />
1418 < Body style = { { paddingLeft : 16 , paddingRight : 16 } } >
15- < TransitionImage
16- source = { {
17- uri : 'https://iknow-pic.cdn.bcebos.com/810a19d8bc3eb135828572d2ab1ea8d3fd1f441d' ,
18- } }
19- style = { { width : 200 , height : 200 } }
20- PlaceholderContent = { < ActivityIndicator /> }
21- // placeholderStyle={{backgroundColor: 'red'}}
22- // containerStyle={{backgroundColor: '#eee'}}
23- transition = { true }
24- transitionDuration = { 1000 }
25- onPress = { ( ) => console . log ( '点击图片回调事件' ) }
26- onLongPress = { ( ) => console . log ( '长按组件回调事件' ) }
27- />
19+ < Card title = "基础用法" >
20+ < TransitionImage
21+ source = { { uri : state . url1 } }
22+ style = { { width : 100 , height : 100 } }
23+ PlaceholderContent = { < ActivityIndicator /> }
24+ transition = { true }
25+ transitionDuration = { 1000 }
26+ onPress = { ( ) => console . log ( '点击图片回调事件' ) }
27+ onLongPress = { ( ) => console . log ( '长按组件回调事件' ) }
28+ />
29+ </ Card >
30+ < Card title = "加载失败" >
31+ < TransitionImage
32+ source = { { uri : state . url3 } }
33+ style = { { width : 100 , height : 100 } }
34+ PlaceholderContent = { < ActivityIndicator /> }
35+ transition = { true }
36+ transitionDuration = { 1000 }
37+ />
38+ </ Card >
2839 </ Body >
2940 </ SafeAreaView >
3041 ) ;
0 commit comments