|
|
@@ -3,6 +3,9 @@ import './Buttons.scss'
|
|
|
import { ButtonType, ComponentStatus } from "../../utils/types";
|
|
|
|
|
|
import { Button as RNButton } from 'react-native';
|
|
|
+import { AtActivityIndicator } from 'taro-ui';
|
|
|
+import "taro-ui/dist/style/components/activity-indicator.scss";
|
|
|
+import 'taro-ui/dist/style/components/loading.scss';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -21,12 +24,13 @@ export default function Buttons(props: { title: string, type?: ButtonType, statu
|
|
|
export default function Buttons(props: {
|
|
|
title: string,
|
|
|
type?: ButtonType,
|
|
|
- className?:any,
|
|
|
+ className?: any,
|
|
|
onClick: () => void,
|
|
|
disabled?: boolean,
|
|
|
lowLight?: boolean,
|
|
|
openType?: string,
|
|
|
btnStyle?: any,
|
|
|
+ showLoading?: boolean
|
|
|
}) {
|
|
|
|
|
|
function onClick() {
|
|
|
@@ -40,13 +44,13 @@ export default function Buttons(props: {
|
|
|
|
|
|
if (props.type == ButtonType.text) {
|
|
|
mainClass = 'texted'
|
|
|
-
|
|
|
+
|
|
|
return <View style={{ opacity: (props.lowLight || props.disabled) ? 0.4 : 1 }} onClick={onClick}>
|
|
|
<Text
|
|
|
style={{
|
|
|
...props.btnStyle,
|
|
|
- fontWeight:500,
|
|
|
- }} className={props.className?props.className:''}>{props.title}</Text>
|
|
|
+ fontWeight: 500,
|
|
|
+ }} className={props.className ? props.className : ''}>{props.title}</Text>
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
@@ -56,30 +60,40 @@ export default function Buttons(props: {
|
|
|
|
|
|
return (
|
|
|
<View className={mainClass} style={{ ...props.btnStyle, opacity: props.lowLight ? 0.4 : 1 }} onClick={onClick}>
|
|
|
+ {
|
|
|
+ props.showLoading && <View style={{ marginBottom: 2, marginRight: 5 }}>
|
|
|
+ <AtActivityIndicator size={32} color="#000" />
|
|
|
+ </View>
|
|
|
+ }
|
|
|
<Text
|
|
|
|
|
|
style={{
|
|
|
color: props.btnStyle.color,
|
|
|
fontSize: props.btnStyle.fontSize,
|
|
|
- fontWeight:500,
|
|
|
- marginBottom:2
|
|
|
+ fontWeight: 500,
|
|
|
+ marginBottom: 2
|
|
|
}}>{props.title}</Text>
|
|
|
</View>
|
|
|
)
|
|
|
}
|
|
|
- else {
|
|
|
- mainClass = 'puretext'
|
|
|
- textClass = 'puretext_text'
|
|
|
- }
|
|
|
+ // else {
|
|
|
+ // mainClass = 'puretext'
|
|
|
+ // textClass = 'puretext_text'
|
|
|
+ // }
|
|
|
return (
|
|
|
- <View className={mainClass} style={{ ...props.btnStyle, opacity: props.lowLight ? 0.4 : 1 }} onClick={onClick}>
|
|
|
+ <View className={mainClass} style={{ ...props.btnStyle, opacity: props.lowLight ? 0.4 : 1 }} onClick={onClick}>
|
|
|
+ {
|
|
|
+ props.showLoading && <View style={{ marginBottom: 2, marginRight: 5 }}>
|
|
|
+ <AtActivityIndicator size={32} color="#000" />
|
|
|
+ </View>
|
|
|
+ }
|
|
|
<Text
|
|
|
// onClick={onClick}
|
|
|
style={{
|
|
|
color: props.btnStyle.color,
|
|
|
fontSize: props.btnStyle.fontSize,
|
|
|
- fontWeight:500,
|
|
|
- marginBottom:2
|
|
|
+ fontWeight: 500,
|
|
|
+ marginBottom: 2
|
|
|
}}>{props.title}</Text>
|
|
|
</View>
|
|
|
// <View onClick={onClick}>
|