Skip to content

Commit cf65d2e

Browse files
nullptr-zxingyuefeng
authored andcommitted
doc(TransitionImage): 重构过度动画图像组件
1 parent e03c644 commit cf65d2e

File tree

1 file changed

+43
-26
lines changed

1 file changed

+43
-26
lines changed
Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1-
TransitionImage 图像
1+
TransitionImage 图片
22
---
33

44
直接替换标准 React Native Image 组件,该组件显示带有占位符和平滑图像加载转换的图像
55

6-
![](https://user-images.githubusercontent.com/57083007/146734209-c9e25051-3473-401e-ba3f-688f843da7df.gif)<!--rehype:style=zoom: 33%;float: right; margin-left: 15px;-->
6+
<!-- ![](https://user-images.githubusercontent.com/57083007/146734209-c9e25051-3473-401e-ba3f-688f843da7df.gif) -->
7+
<!--rehype:style=zoom: 33%;float: right; margin-left: 15px;-->
78

89
### 基础示例
910

10-
```jsx
11+
```jsx mdx:preview
12+
import React, { useState } from 'react';
1113
import { Fragment } from 'react';
1214
import { TransitionImage } from '@uiw/react-native';
13-
import {ActivityIndicator} from 'react-native';
15+
import { ActivityIndicator } from 'react-native';
1416

17+
function Demo() {
18+
return (
19+
<Fragment>
20+
<TransitionImage
21+
source={{ uri: 'https://img11.51tietu.net/pic/2016-071418/20160714181543xyu10ukncwf221991.jpg' }}
22+
style={{ width: 200, height: 200, }}
23+
onPress={()=> console.log('点击图片回调事件')}
24+
onLongPress={()=> console.log('长按组件回调事件')}
25+
/>
26+
</Fragment>
27+
);
28+
}
29+
export default Demo
30+
```
31+
32+
### 过度动画效果
33+
34+
```jsx mdx:preview
35+
import React, { useState } from 'react';
36+
import { Fragment } from 'react';
37+
import { TransitionImage } from '@uiw/react-native';
38+
import { ActivityIndicator } from 'react-native';
1539

1640
function Demo() {
1741
return (
@@ -30,30 +54,23 @@ function Demo() {
3054
</Fragment>
3155
);
3256
}
57+
export default Demo
3358
```
3459

60+
### Props
3561

36-
### TransitionImage Props
37-
38-
```ts
62+
```js
3963
import { ImageProps } from 'react-native';
40-
41-
export interface TransitionImage extends ImageProps{
42-
/* 按下组件时的回调函数 */
43-
onPress?(): void;
44-
/* 长按组件时的回调函数 */
45-
onLongPress?(): void;
46-
/* 加载图像时要呈现的内容 */
47-
PlaceholderContent?: React.ReactElement<any>;
48-
/* 容器的附加样式(可选) */
49-
containerStyle?: StyleProp<ViewStyle>;
50-
/* 子容器的附加样式(可选) */
51-
childrenContainerStyle?: StyleProp<ViewStyle>;
52-
/* 占位符容器的附加样式(可选) */
53-
placeholderStyle?: StyleProp<ViewStyle>;
54-
/* 在图像加载时执行淡入淡出过渡 */
55-
transition?: boolean;
56-
/* 在图像加载时执行淡入淡出过渡 */
57-
transitionDuration?: number;
58-
}
5964
```
65+
66+
| 参数 | 说明 | 类型 | 默认值 |
67+
|------|------|-----|------|
68+
| onPress | 按下组件时的回调函数 | void | - |
69+
| onLongPress | 长按组件时的回调函数 | void | - |
70+
| PlaceholderContent | 加载图像时要呈现的内容 | React.ReactElement<any> | - |
71+
| containerStyle | 容器的附加样式(可选) | StyleProp<ViewStyle> | - |
72+
| childrenContainerStyle | 子容器的附加样式(可选) | StyleProp<ViewStyle> | - |
73+
| placeholderStyle | 占位符容器的附加样式(可选) | StyleProp<ViewStyle> | - |
74+
| transition | 在图像加载时执行淡入淡出过渡 | boolean | - |
75+
| transitionDuration | 图像加载时执行淡入淡出过渡时间 | boolean | - |
76+

0 commit comments

Comments
 (0)