zbb 3 місяців тому
батько
коміт
1931d69fa8
1 змінених файлів з 24 додано та 1 видалено
  1. 24 1
      app/weal/detail.tsx

+ 24 - 1
app/weal/detail.tsx

@@ -7,6 +7,7 @@ import {
     ImageBackground,
     Modal,
     ScrollView,
+    Share,
     StatusBar,
     StyleSheet,
     Text,
@@ -144,6 +145,26 @@ export default function WealDetailScreen() {
         }
     };
 
+    const handleShare = async () => {
+        try {
+            const result = await Share.share({
+                message: `快来参与福利房:${data?.name},房间ID:${id}`,
+                title: '福利房分享',
+            });
+            if (result.action === Share.sharedAction) {
+                if (result.activityType) {
+                    // shared with activity type of result.activityType
+                } else {
+                    // shared
+                }
+            } else if (result.action === Share.dismissedAction) {
+                // dismissed
+            }
+        } catch (error: any) {
+            Alert.alert(error.message);
+        }
+    };
+
     const showWinRecords = async () => {
         try {
             const res = await getWinningRecord(id as string);
@@ -170,7 +191,9 @@ export default function WealDetailScreen() {
                         <Text style={styles.backText}>←</Text>
                     </TouchableOpacity>
                     <Text style={styles.navTitle}>{TYPE_MAP[data.type]?.title || '详情'}</Text>
-                    <View style={styles.placeholder} />
+                    <TouchableOpacity onPress={handleShare} style={styles.backBtn}>
+                        <Image source={{ uri: Images.mine.invite }} style={{ width: 20, height: 20 }} contentFit="contain" />
+                    </TouchableOpacity>
                 </View>
 
                 <ScrollView