Skip to content

Commit 5b7d23b

Browse files
committed
Merge branch 'dev' of https://github.com/uiwjs/react-native-uiw into dev
2 parents 07fa78b + f5bf63a commit 5b7d23b

File tree

3 files changed

+50
-38
lines changed

3 files changed

+50
-38
lines changed

example/examples/src/routes/Empty/index.tsx

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,33 @@ const xml = `
3131

3232
export interface DividerViewProps extends ComProps {}
3333

34-
export default class DividerView extends React.Component<DividerViewProps> {
35-
render() {
36-
const {route} = this.props;
37-
const description = route.params.description;
38-
const title = route.params.title;
39-
return (
40-
<Container>
41-
<Layout>
42-
<Header title={title} description={description} />
43-
<Body>
44-
<Card title="默认基础实例">
45-
<Empty />
46-
</Card>
47-
<Card title="自定义文字 label?: string">
48-
<Empty label="冇得数据咯" />
49-
</Card>
50-
<Card title="替换默认图标 xml?: string;">
51-
<Empty label="冇得数据咯" xml={xml} />
52-
</Card>
53-
<Card title="自定义图标尺寸 size?: number">
54-
<Empty label="冇得数据咯" size={120} />
55-
</Card>
56-
<Card title="自定义文字样式 labelStyle?: TextProps['style']">
57-
<Empty label="冇得数据咯" labelStyle={{color: 'red'}} />
58-
</Card>
59-
</Body>
60-
<Footer />
61-
</Layout>
62-
</Container>
63-
);
64-
}
34+
export default function DividerView(props: DividerViewProps) {
35+
const {route} = props || {};
36+
const description = route.params.description;
37+
const title = route.params.title;
38+
return (
39+
<Container>
40+
<Layout>
41+
<Header title={title} description={description} />
42+
<Body>
43+
<Card title="默认基础实例">
44+
<Empty />
45+
</Card>
46+
<Card title="自定义文字 label?: string">
47+
<Empty label="冇得数据咯" />
48+
</Card>
49+
<Card title="替换默认图标 xml?: string;">
50+
<Empty label="冇得数据咯" xml={xml} />
51+
</Card>
52+
<Card title="自定义图标尺寸 size?: number">
53+
<Empty label="冇得数据咯" size={120} />
54+
</Card>
55+
<Card title="自定义文字样式 labelStyle?: TextProps['style']">
56+
<Empty label="冇得数据咯" labelStyle={{color: 'red'}} />
57+
</Card>
58+
</Body>
59+
<Footer />
60+
</Layout>
61+
</Container>
62+
);
6563
}

packages/core/src/Avatar/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export interface AvatarProps extends ViewProps {
3737
}
3838

3939
export default function Avatar(props: AvatarProps) {
40-
const { style, src = defaultImage, size = 40, shape = 'square', rounded = 3, imageProps, ...otherProps } = props;
40+
const { style, src, size, shape, rounded, imageProps, ...otherProps } = props;
41+
4142
return (
4243
<View
4344
style={[
@@ -56,3 +57,10 @@ export default function Avatar(props: AvatarProps) {
5657
</View>
5758
);
5859
}
60+
61+
Avatar.defaultProps = {
62+
src: defaultImage,
63+
shape: 'square',
64+
rounded: 3,
65+
size: 40,
66+
} as AvatarProps;

packages/core/src/Empty/README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ Empty 空状态
1111
```js
1212
import { Empty } from '@uiw/react-native';
1313

14-
class Demo extends Component {
14+
const Demo = () => {
1515
render() {
1616
return (
1717
<Empty />
1818
)
1919
}
2020
}
21+
export default Demo
2122
```
2223
<!--End-->
2324

@@ -27,13 +28,14 @@ class Demo extends Component {
2728
```js
2829
import { Empty } from '@uiw/react-native';
2930

30-
class Demo extends Component {
31+
const Demo = () => {
3132
render() {
3233
return (
3334
<Empty label="冇得数据咯"/>
3435
)
3536
}
3637
}
38+
export default Demo
3739
```
3840
<!--End-->
3941

@@ -67,13 +69,14 @@ const xml = `
6769
</svg>
6870
`;
6971

70-
class Demo extends Component {
72+
const Demo = () => {
7173
render() {
7274
return (
7375
<Empty label="冇得数据咯" xml={xml}/>
7476
)
7577
}
7678
}
79+
export default Demo
7780
```
7881
<!--End-->
7982

@@ -83,13 +86,14 @@ class Demo extends Component {
8386
```js
8487
import { Empty } from '@uiw/react-native';
8588

86-
class Demo extends Component {
89+
const Demo = () => {
8790
render() {
8891
return (
8992
<Empty label="冇得数据咯" size={120} />
9093
)
9194
}
9295
}
96+
export default Demo
9397
```
9498
<!--End-->
9599

@@ -99,13 +103,14 @@ class Demo extends Component {
99103
```js
100104
import { Empty } from '@uiw/react-native';
101105

102-
class Demo extends Component {
106+
const Demo = () => {
103107
render() {
104108
return (
105109
<Empty label="冇得数据咯" labelStyle={{ color: 'red' }} />
106110
)
107111
}
108112
}
113+
export default Demo
109114
```
110115
<!--End-->
111116

@@ -116,7 +121,7 @@ class Demo extends Component {
116121
import { Empty } from '@uiw/react-native';
117122
import {View, Text } from 'react-native';
118123

119-
class Demo extends Component {
124+
const Demo = () => {
120125
render() {
121126
return (
122127
<Empty>
@@ -127,6 +132,7 @@ class Demo extends Component {
127132
)
128133
}
129134
}
135+
export default Demo
130136
```
131137
<!--End-->
132138

0 commit comments

Comments
 (0)