feat: 长按下载

This commit is contained in:
jinyaqiu 2025-07-22 18:19:05 +08:00
parent 857a22dd6a
commit d18bca1ccf
2 changed files with 2 additions and 30 deletions

View File

@ -40,15 +40,6 @@ export const AppDownload = (props: AppDownloadProps) => {
<HandlersSvg style={{ marginBottom: -4, zIndex: 3 }} /> <HandlersSvg style={{ marginBottom: -4, zIndex: 3 }} />
<View style={styles.qrCode}> <View style={styles.qrCode}>
<QRDownloadScreen url={platform == "ios" ? IOS_APP_STORE_URL : ANDROID_APK_URL} /> <QRDownloadScreen url={platform == "ios" ? IOS_APP_STORE_URL : ANDROID_APK_URL} />
{/* <QRCode
value={platform == "ios" ? IOS_APP_STORE_URL : ANDROID_APK_URL}
size={200}
color="black"
backgroundColor="white"
logoSize={50}
logoBorderRadius={10}
logoBackgroundColor="#f0f0f0"
/> */}
</View> </View>
</View> </View>
{/* Description */} {/* Description */}

View File

@ -1,7 +1,7 @@
import * as Haptics from 'expo-haptics'; import * as Haptics from 'expo-haptics';
import * as MediaLibrary from 'expo-media-library'; import * as MediaLibrary from 'expo-media-library';
import React, { useRef } from 'react'; import React, { useRef } from 'react';
import { Alert, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { Alert, StyleSheet, TouchableOpacity, View } from 'react-native';
import QRCode from 'react-native-qrcode-svg'; import QRCode from 'react-native-qrcode-svg';
import { captureRef } from 'react-native-view-shot'; import { captureRef } from 'react-native-view-shot';
@ -42,45 +42,26 @@ export default function QRDownloadScreen(prop: { url: string }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.title}></Text>
{/* 可截图的容器 */} {/* 可截图的容器 */}
<TouchableOpacity onLongPress={saveQRToGallery} activeOpacity={0.8}> <TouchableOpacity onLongPress={saveQRToGallery} activeOpacity={0.8}>
<View ref={qrViewRef} style={styles.qrContainer}> <View ref={qrViewRef} style={styles.qrContainer}>
<QRCode value={qrValue} size={200} /> <QRCode value={qrValue} size={200} />
</View> </View>
</TouchableOpacity> </TouchableOpacity>
<Text style={styles.tip}>👉 </Text>
</View> </View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, // flex: 1,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
padding: 20,
backgroundColor: '#f8f8f8',
},
title: {
fontSize: 18,
fontWeight: 'bold',
marginBottom: 20,
textAlign: 'center',
}, },
qrContainer: { qrContainer: {
padding: 16, padding: 16,
backgroundColor: '#fff', backgroundColor: '#fff',
borderRadius: 12, borderRadius: 12,
borderWidth: 1,
borderColor: '#ddd',
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 4,
elevation: 3,
}, },
tip: { tip: {
marginTop: 20, marginTop: 20,