|
1 | | -/* tslint:disable:no-console */ |
2 | 1 | import React from 'react'; |
3 | 2 | import {View} from 'react-native'; |
4 | | -import {List, Stepper} from '@uiw/react-native'; |
5 | | -import Layout from '../../Layout'; |
6 | | -const {Header} = Layout; |
| 3 | +import {List, Stepper, Pagination, Button} from '@uiw/react-native'; |
| 4 | +import Layout, {Container} from '../../Layout'; |
| 5 | + |
| 6 | +import {ComProps} from '../../routes'; |
| 7 | + |
| 8 | +const {Header, Body, Card, Footer} = Layout; |
7 | 9 |
|
8 | 10 | function onChange(value: any) { |
9 | | - console.log('changed', value); |
| 11 | + // console.log('changed', value); |
10 | 12 | } |
11 | | - |
12 | | -export default class StepperExample extends React.Component<any, any> { |
| 13 | +export interface IndexProps extends ComProps {} |
| 14 | +export interface IndexState { |
| 15 | + value: number; |
| 16 | + value1: number; |
| 17 | + value2: number; |
| 18 | +} |
| 19 | +export default class StepperExample extends React.Component< |
| 20 | + IndexProps, |
| 21 | + IndexState |
| 22 | +> { |
| 23 | + state = { |
| 24 | + value: 0, |
| 25 | + value1: 2, |
| 26 | + value2: 0, |
| 27 | + }; |
13 | 28 | render() { |
14 | 29 | const {route} = this.props; |
15 | 30 | const description = route.params.description; |
16 | 31 | const title = route.params.title; |
| 32 | + // const { value, value1, value2} = this.state |
| 33 | + const size = 'small'; |
| 34 | + // 'small' | 'default' | 'large'; |
17 | 35 |
|
18 | | - const readOnly = ( |
19 | | - <Stepper |
20 | | - key="1" |
21 | | - max={999} |
22 | | - min={1} |
23 | | - readOnly={false} |
24 | | - defaultValue={888} |
25 | | - onChange={onChange} |
26 | | - /> |
27 | | - ); |
28 | 36 | return ( |
29 | | - <View style={{flex: 1}}> |
30 | | - <Header title={title} description={description} /> |
31 | | - <List> |
32 | | - <List.Item |
33 | | - extra={ |
34 | | - <Stepper |
35 | | - key="0" |
36 | | - max={9999} |
37 | | - min={0} |
38 | | - defaultValue={3} |
39 | | - onChange={onChange} |
40 | | - /> |
41 | | - }> |
42 | | - 请选择您要购买iPhone 12 的数量: |
43 | | - </List.Item> |
44 | | - <List.Item extra={readOnly}>您当前选择的数量为: </List.Item> |
45 | | - <List.Item |
46 | | - extra={ |
47 | | - <Stepper |
48 | | - key="2" |
49 | | - disabled |
50 | | - max={100} |
51 | | - min={0} |
52 | | - defaultValue={0} |
53 | | - onChange={onChange} |
54 | | - /> |
55 | | - }> |
56 | | - 暂无库存: |
57 | | - </List.Item> |
58 | | - </List> |
59 | | - </View> |
| 37 | + <Container> |
| 38 | + <Layout> |
| 39 | + <Header title={title} description={description} /> |
| 40 | + <Body> |
| 41 | + <List flat={false} extra="test"> |
| 42 | + <List.Item |
| 43 | + extra={ |
| 44 | + <Stepper |
| 45 | + value={this.state.value} |
| 46 | + onChange={value => { |
| 47 | + this.setState({value}); |
| 48 | + }} |
| 49 | + /> |
| 50 | + }> |
| 51 | + 基本使用: |
| 52 | + </List.Item> |
| 53 | + <List.Item |
| 54 | + extra={ |
| 55 | + <Stepper |
| 56 | + size="small" |
| 57 | + value={this.state.value} |
| 58 | + onChange={value => { |
| 59 | + this.setState({value}); |
| 60 | + }} |
| 61 | + /> |
| 62 | + }> |
| 63 | + 尺寸控制(size: small | default | large): |
| 64 | + </List.Item> |
| 65 | + <List.Item |
| 66 | + extra={ |
| 67 | + <Stepper |
| 68 | + disabledLongPress={true} |
| 69 | + value={this.state.value2} |
| 70 | + onChange={value2 => { |
| 71 | + this.setState({value2}); |
| 72 | + }} |
| 73 | + /> |
| 74 | + }> |
| 75 | + 按钮开启长按(disabledLongPress: boolean): |
| 76 | + </List.Item> |
| 77 | + <List.Item |
| 78 | + extra={ |
| 79 | + <Stepper |
| 80 | + width={120} |
| 81 | + value={this.state.value2} |
| 82 | + onChange={value2 => { |
| 83 | + this.setState({value2}); |
| 84 | + }} |
| 85 | + /> |
| 86 | + }> |
| 87 | + 自定义宽度(width: number): |
| 88 | + </List.Item> |
| 89 | + <List.Item |
| 90 | + extra={ |
| 91 | + <Stepper |
| 92 | + value={this.state.value} |
| 93 | + color={{ |
| 94 | + color: '#ccc', |
| 95 | + borderColor: '#999', |
| 96 | + controlColor: 'red', |
| 97 | + valueColor: '#000', |
| 98 | + }} |
| 99 | + onChange={value => { |
| 100 | + this.setState({value}); |
| 101 | + }} |
| 102 | + /> |
| 103 | + }> |
| 104 | + 自定义颜色(color: Color): |
| 105 | + </List.Item> |
| 106 | + <List.Item |
| 107 | + extra={ |
| 108 | + <Stepper |
| 109 | + disabledInput={false} |
| 110 | + value={this.state.value1} |
| 111 | + onChange={value1 => { |
| 112 | + this.setState({value1}); |
| 113 | + }} |
| 114 | + /> |
| 115 | + }> |
| 116 | + 不禁止输入(disabledInput: boolean): |
| 117 | + </List.Item> |
| 118 | + <List.Item |
| 119 | + extra={ |
| 120 | + <Stepper |
| 121 | + disabled={true} |
| 122 | + disabledInput={false} |
| 123 | + value={this.state.value1} |
| 124 | + onChange={value1 => { |
| 125 | + this.setState({value1}); |
| 126 | + }} |
| 127 | + /> |
| 128 | + }> |
| 129 | + 禁止点击(disabled: boolean): |
| 130 | + </List.Item> |
| 131 | + </List> |
| 132 | + </Body> |
| 133 | + <Footer /> |
| 134 | + </Layout> |
| 135 | + </Container> |
60 | 136 | ); |
61 | 137 | } |
62 | 138 | } |
0 commit comments