Skip to content

Commit e0e8de4

Browse files
committed
Merge branch 'dev' of https://github.com/uiwjs/react-native-uiw into dev
2 parents 0962e55 + 5c5d3f7 commit e0e8de4

File tree

35 files changed

+977
-534
lines changed

35 files changed

+977
-534
lines changed

example/base/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@example/base",
3-
"version": "3.0.7",
3+
"version": "3.0.8",
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android",
@@ -10,7 +10,7 @@
1010
"lint": "eslint ."
1111
},
1212
"dependencies": {
13-
"@uiw/react-native": "3.0.7",
13+
"@uiw/react-native": "3.0.8",
1414
"react": "18.0.0",
1515
"react-native": "0.69.7",
1616
"react-native-svg": "12.1.1"

example/examples/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "examples",
3-
"version": "3.0.7",
3+
"version": "3.0.8",
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android",
@@ -13,7 +13,7 @@
1313
"@react-native-community/masked-view": "~0.1.11",
1414
"@react-navigation/native": "~6.0.11",
1515
"@react-navigation/stack": "~6.2.2",
16-
"@uiw/react-native": "3.0.7",
16+
"@uiw/react-native": "3.0.8",
1717
"react": "18.0.0",
1818
"react-native": "0.69.7",
1919
"react-native-gesture-handler": "~2.5.0",

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
}

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.0.7",
2+
"version": "3.0.8",
33
"packages": ["example/*", "packages/*", "website"],
44
"npmClient": "yarn",
55
"npmClientArgs": ["--production", "--no-optional"],

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uiw/react-native",
3-
"version": "3.0.7",
3+
"version": "3.0.8",
44
"description": "UIW for React Native",
55
"homepage": "https://uiwjs.github.io/react-native-uiw/",
66
"main": "lib/index.js",

packages/core/src/Avatar/README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAA2CAMAAAC7m5rvA
1515

1616
function Demo() {
1717
return (
18-
<View style={{ flexDirection: 'row' }}>
18+
<View style={{ flexDirection: 'row',justifyContent:'space-around' }}>
1919
<Avatar src="https://avatars.githubusercontent.com/u/24369183?v=4" />
2020
<Avatar src={uri} />
2121
</View>
@@ -26,6 +26,72 @@ export default Demo
2626

2727
```
2828

29+
### 头像尺寸
30+
31+
```jsx mdx:preview
32+
import React from 'react';
33+
import { View } from 'react-native';
34+
import { Avatar } from '@uiw/react-native';
35+
36+
function Demo() {
37+
return (
38+
<View style={{ flexDirection: 'row',justifyContent:'space-around' }}>
39+
<Avatar size={20} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
40+
<Avatar size={30} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
41+
<Avatar size={40} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
42+
<Avatar size={50} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
43+
</View>
44+
);
45+
}
46+
47+
export default Demo
48+
49+
```
50+
51+
### 设置头像圆角
52+
53+
```jsx mdx:preview
54+
import React from 'react';
55+
import { View } from 'react-native';
56+
import { Avatar } from '@uiw/react-native';
57+
58+
function Demo() {
59+
return (
60+
<View style={{ flexDirection: 'row',justifyContent:'space-around' }}>
61+
<Avatar rounded={0} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
62+
<Avatar rounded={5} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
63+
<Avatar rounded={10} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
64+
<Avatar rounded={20} src="https://avatars.githubusercontent.com/u/24369183?v=4" />
65+
</View>
66+
);
67+
}
68+
69+
export default Demo
70+
71+
```
72+
73+
### 指定头像的形状
74+
75+
circle 圆头像
76+
square 正方形头像
77+
78+
```jsx mdx:preview
79+
import React from 'react';
80+
import { View } from 'react-native';
81+
import { Avatar } from '@uiw/react-native';
82+
83+
function Demo() {
84+
return (
85+
<View style={{ flexDirection: 'row',justifyContent:'space-around' }}>
86+
<Avatar shape='circle' src="https://avatars.githubusercontent.com/u/24369183?v=4" />
87+
<Avatar rounded='square' src="https://avatars.githubusercontent.com/u/24369183?v=4" />
88+
</View>
89+
);
90+
}
91+
92+
export default Demo
93+
94+
```
2995
### Props
3096

3197
继承 [View](https://facebook.github.io/react-native/docs/view#props) 组件。

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/Badge/README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,50 @@ function Demo() {
2121

2222
export default Demo;
2323

24+
```
25+
### 设置文本内容
26+
27+
28+
```jsx mdx:preview
29+
import React from "react"
30+
import { View, Text } from 'react-native';
31+
import { Badge } from '@uiw/react-native';
32+
33+
function Demo() {
34+
return (
35+
<View style={{ flexDirection: 'row',justifyContent:'space-around' }}>
36+
<Badge text="设置" color="red" />
37+
<Badge text="文本" color="red" />
38+
<Badge text="内容" color="red" />
39+
<Badge text="内容" color="red" />
40+
</View>
41+
);
42+
}
43+
44+
export default Demo;
45+
46+
```
47+
48+
### 设置颜色
49+
50+
```jsx mdx:preview
51+
import React from "react"
52+
import { View, Text } from 'react-native';
53+
import { Badge } from '@uiw/react-native';
54+
55+
function Demo() {
56+
return (
57+
<View style={{ flexDirection: 'row',justifyContent:'space-around' }}>
58+
<Badge text="红色" color="red" />
59+
<Badge text="黄色" color="yellow" />
60+
<Badge text="黑色" color="black" />
61+
<Badge text="绿色" color="green" />
62+
</View>
63+
);
64+
}
65+
66+
export default Demo;
67+
2468
```
2569
### 设置类型
2670

@@ -32,9 +76,11 @@ import { Badge } from '@uiw/react-native';
3276

3377
function Demo() {
3478
return (
35-
<View style={{ flexDirection: 'row' }}>
36-
<Text>一文带你搞懂 API 网关</Text>
79+
<View style={{ flexDirection: 'row',justifyContent:'space-around' }}>
3780
<Badge text="标记" type="dot" color="skyblue" />
81+
<Badge text="标记" type="dot" color="black" />
82+
<Badge text="标记" color="red" />
83+
<Badge text="标记" color="green" />
3884
</View>
3985
);
4086
}

packages/core/src/Button/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Demo extends Component {
2323
<Spacing/>
2424
<Button disabled>disabled</Button>
2525
<Spacing/>
26-
<Button type="primary">primary</Button>
26+
<Button type="primary" onPress={()=>console.log("The Button")}>primary</Button>
2727
<Spacing/>
2828
<Button type="warning">warning</Button>
2929
<Spacing/>
@@ -181,7 +181,7 @@ export default Demo
181181

182182
```
183183

184-
### 自定义图标
184+
### 自定义图标
185185

186186
```jsx mdx:preview
187187

0 commit comments

Comments
 (0)