Skip to content

Commit

Permalink
doc(Avatar): Update document.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 17, 2021
1 parent 2814be7 commit 3065ff7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
32 changes: 25 additions & 7 deletions packages/core/src/Avatar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,28 @@ function Demo() {

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

| 参数 | 说明 | 类型 | 默认值 |
|------|------|-----|------|
| `src` | 图像源(远程URL或本地文件资源)。 | String/Number | - |
| `imageProps` | React Native `Image` 组件 Props | ImageProps | - |
| `size` | 设置圆角 | Number | `40` |
| `rounded` | 设置圆角 | Number | `3` |
| `shape` | 指定头像的形状 `square` 正方形或者 `circle`| `circle`/`square` | `square` |
```ts
import { ViewProps } from 'react-native';

export interface AvatarProps extends ViewProps {
/** React Native `Image` 组件 Props */
imageProps?: ImageProps;
/** 图像源(远程URL或本地文件资源)。 */
src?: string | number;
/**
* 尺寸
* @default 40
*/
size?: number;
/**
* 设置圆角
* @default 3
*/
rounded?: number;
/**
* 指定头像的形状
* @default square
*/
shape?: 'circle' | 'square';
}
```
14 changes: 14 additions & 0 deletions packages/core/src/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,24 @@ const styles = StyleSheet.create({
const defaultImage = require('./assets/user.png');

export interface AvatarProps extends ViewProps {
/** React Native `Image` 组件 Props */
imageProps?: ImageProps;
/** 图像源(远程URL或本地文件资源)。 */
src?: string | number;
/**
* 尺寸
* @default 40
*/
size?: number;
/**
* 设置圆角
* @default 3
*/
rounded?: number;
/**
* 指定头像的形状
* @default square
*/
shape?: 'circle' | 'square';
}

Expand Down

0 comments on commit 3065ff7

Please sign in to comment.