|
1 | | -import React from 'react'; |
2 | | -import {SafeAreaView, View, Image} from 'react-native'; |
3 | | -import {Card} from '@uiw/react-native'; |
| 1 | +import React, { useState } from 'react'; |
| 2 | +import { ScrollView, View, Image } from 'react-native'; |
| 3 | +import { Card, Divider, Loader } from '@uiw/react-native'; |
4 | 4 | import Layout from '../../Layout'; |
5 | 5 | const CardDemo = (props: any) => { |
6 | | - const {Header} = Layout; |
7 | | - const {route} = props; |
| 6 | + const { Header } = Layout; |
| 7 | + const { route } = props; |
8 | 8 | const description = route.params.description; |
9 | 9 | const title = route.params.title; |
| 10 | + const [selected, setSelected] = useState(false) |
| 11 | + const [loading, setLoad] = useState(true) |
10 | 12 | return ( |
11 | | - <SafeAreaView style={{flex: 1}}> |
| 13 | + <ScrollView style={{ flex: 1 }}> |
12 | 14 | <Header title={title} description={description} /> |
| 15 | + <Header description={'基本使用'} /> |
13 | 16 | <Card |
| 17 | + > |
| 18 | + <Loader loading={loading}> |
| 19 | + <Image |
| 20 | + onLoad={() => setLoad(false)} |
| 21 | + source={{ |
| 22 | + uri: 'https://image11.m1905.cn/uploadfile/2020/ss/0624/20200624104507290748.jpg', |
| 23 | + }} |
| 24 | + style={{ height: 200 }} |
| 25 | + /> |
| 26 | + </Loader> |
| 27 | + </Card> |
| 28 | + <Divider /> |
| 29 | + <Header description={'带标题下划线圆角卡片'} /> |
| 30 | + <Card |
| 31 | + title="我是标题" |
| 32 | + showDriver={true} |
| 33 | + borderRadius={12} |
| 34 | + > |
| 35 | + <Image |
| 36 | + source={{ |
| 37 | + uri: 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2019%2F04%2F22%2Fca22d8623fe7454ea9cdb33f3137d14e.jpeg&thumbnail=650x2147483647&quality=80&type=jpg', |
| 38 | + }} |
| 39 | + style={{ height: 200 }} |
| 40 | + /> |
| 41 | + </Card> |
| 42 | + <Divider /> |
| 43 | + <Header description={'可点击选中卡片'} /> |
| 44 | + <Card |
| 45 | + selected={selected} |
14 | 46 | title="我是标题" |
15 | 47 | showDriver={true} |
16 | | - borderRadius={0} |
17 | | - // onLongPress={() => {}} |
| 48 | + borderRadius={12} |
| 49 | + onPress={() => { setSelected(!selected) }} |
18 | 50 | > |
19 | | - <View> |
| 51 | + <Loader loading={loading}> |
20 | 52 | <Image |
21 | 53 | source={{ |
22 | | - uri: 'https://img11.51tietu.net/pic/2016-071418/20160714181543xyu10ukncwf221991.jpg', |
| 54 | + uri: 'https://image11.m1905.cn/uploadfile/2020/ss/0624/20200624104507290748.jpg', |
23 | 55 | }} |
24 | | - style={{height: 150}} |
| 56 | + style={{ height: 200 }} |
25 | 57 | /> |
26 | | - </View> |
| 58 | + </Loader> |
27 | 59 | </Card> |
28 | | - </SafeAreaView> |
| 60 | + </ScrollView> |
29 | 61 | ); |
30 | 62 | }; |
31 | 63 | export default CardDemo; |
0 commit comments