Browse Source

feat: 在支付按钮上添加加载动画

main
Your Name (aider) 3 weeks ago
parent
commit
5c1e91212b
  1. 12
      app/screens/previewOrder/perviewOrder.tsx

12
app/screens/previewOrder/perviewOrder.tsx

@ -1,4 +1,4 @@
import {View, Text, TouchableOpacity, StyleSheet, TextInput, ScrollView, Alert} from "react-native"; import {View, Text, TouchableOpacity, StyleSheet, TextInput, ScrollView, Alert, ActivityIndicator} from "react-native";
import useCreateOrderStore from "../../store/createOrder"; import useCreateOrderStore from "../../store/createOrder";
import BackIcon from "../../components/BackIcon"; import BackIcon from "../../components/BackIcon";
import { useNavigation, useRoute, RouteProp } from "@react-navigation/native"; import { useNavigation, useRoute, RouteProp } from "@react-navigation/native";
@ -172,12 +172,16 @@ export const PreviewOrder = () => {
<TouchableOpacity <TouchableOpacity
style={[ style={[
styles.primaryButtonStyle, styles.primaryButtonStyle,
(!showPhoneInput || (showPhoneInput && phoneNumber)) ? {} : styles.disabledButtonStyle (!showPhoneInput || (showPhoneInput && phoneNumber)) && !loading ? {} : styles.disabledButtonStyle
]} ]}
onPress={handleSubmit} onPress={handleSubmit}
disabled={showPhoneInput && !phoneNumber} disabled={(showPhoneInput && !phoneNumber) || loading}
> >
<Text style={styles.buttonText}></Text> {loading ? (
<ActivityIndicator size="small" color="#ffffff" />
) : (
<Text style={styles.buttonText}></Text>
)}
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>

Loading…
Cancel
Save