Skip to content

Commit b0d00d0

Browse files
author
rulishu
committed
Merge branch 'dev' of github.com:uiwjs/react-native-uiw into rls
2 parents 6bb4f2b + be95d58 commit b0d00d0

File tree

2 files changed

+42
-47
lines changed

2 files changed

+42
-47
lines changed

packages/core/src/Loader/index.tsx

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -50,53 +50,45 @@ export interface LoaderProps extends ViewProps {
5050
tip?: React.ReactNode;
5151
}
5252

53-
export default class Loader extends Component<LoaderProps> {
54-
static defaultProps: LoaderProps = {
55-
maskColor: 'rgba(255, 255, 255, 0.85)',
56-
loading: true,
57-
color: 'gray',
58-
size: 'small',
59-
};
60-
render() {
61-
const {
62-
children,
63-
color: loaderColor,
64-
maskColor,
65-
rounded,
66-
loading,
67-
tip,
68-
size,
69-
vertical,
70-
...otherProps
71-
} = this.props;
72-
let styleProps: ActivityIndicatorProps['style'] = {};
73-
if (maskColor) {
74-
styleProps.backgroundColor = maskColor;
75-
}
76-
if (rounded) {
77-
styleProps.borderRadius = rounded;
78-
}
79-
if (vertical) {
80-
styleProps.flexDirection = 'column';
81-
}
82-
if (!children && !tip) {
83-
return <ActivityIndicator animating={loading} size={size} color={loaderColor} />;
84-
}
85-
const tips =
86-
tip || loading ? (
87-
<View style={[styles[loading ? 'defalut' : 'stopActivity'], styleProps]}>
88-
<ActivityIndicator animating={loading} size={size} color={loaderColor} />
89-
{tip && (typeof tip === 'string' ? <Text style={{ color: loaderColor }}>{tip}</Text> : <View>{tip}</View>)}
90-
</View>
91-
) : null;
92-
if (!children && tip) {
93-
return tips;
94-
}
95-
return (
96-
<View {...otherProps}>
97-
{tips}
98-
{children}
53+
export default function Loader(props: LoaderProps) {
54+
const {
55+
children,
56+
color: loaderColor = 'gray',
57+
maskColor = 'rgba(255, 255, 255, 0.85)',
58+
rounded,
59+
loading = true,
60+
tip,
61+
size = 'small',
62+
vertical,
63+
...otherProps
64+
} = props;
65+
let styleProps: ActivityIndicatorProps['style'] = {};
66+
if (maskColor) {
67+
styleProps.backgroundColor = maskColor;
68+
}
69+
if (rounded) {
70+
styleProps.borderRadius = rounded;
71+
}
72+
if (vertical) {
73+
styleProps.flexDirection = 'column';
74+
}
75+
if (!children && !tip) {
76+
return <ActivityIndicator animating={loading} size={size} color={loaderColor} />;
77+
}
78+
const tips =
79+
tip || loading ? (
80+
<View style={[styles[loading ? 'defalut' : 'stopActivity'], styleProps]}>
81+
<ActivityIndicator animating={loading} size={size} color={loaderColor} />
82+
{tip && (typeof tip === 'string' ? <Text style={{ color: loaderColor }}>{tip}</Text> : <View>{tip}</View>)}
9983
</View>
100-
);
84+
) : null;
85+
if (!children && tip) {
86+
return tips;
10187
}
88+
return (
89+
<View {...otherProps}>
90+
{tips}
91+
{children}
92+
</View>
93+
);
10294
}

website/src/component/Header/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export default function Header(props: HeaderProps) {
3636
<NavLink to="/home">首页</NavLink>
3737
<NavLink to="/docs">文档</NavLink>
3838
<NavLink to="/components">RN组件</NavLink>
39+
<a target="__blank" href="https://pushy.reactnative.cn/">
40+
热更新
41+
</a>
3942
<a target="__blank" href="https://github.com/uiwjs/react-native-uiw/issues">
4043
问题反馈
4144
</a>

0 commit comments

Comments
 (0)