feat: fixes and formatter
This commit is contained in:
@@ -1,41 +1,32 @@
|
||||
import { Portal } from "@gorhom/portal";
|
||||
import { BlurView } from "expo-blur";
|
||||
import React, { useEffect, useMemo } from "react";
|
||||
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
|
||||
import { Portal } from '@gorhom/portal'
|
||||
import { BlurView } from 'expo-blur'
|
||||
import React, { useEffect, useMemo } from 'react'
|
||||
import { Platform, Pressable, StyleSheet, Text, View } from 'react-native'
|
||||
|
||||
import { Palette } from "../../styles";
|
||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||
import QrCode from "../QrCode";
|
||||
import { Palette } from '../../styles'
|
||||
import { FONT_FAMILY } from '../../styles/Fonts'
|
||||
import QrCode from '../QrCode'
|
||||
|
||||
const ShareQrModal = ({
|
||||
visible,
|
||||
onClose,
|
||||
url,
|
||||
title = "Scannez le QR-code",
|
||||
}) => {
|
||||
const shareUrl = useMemo(() => url, [url]);
|
||||
const ShareQrModal = ({ visible, onClose, url, title = 'Scannez le QR-code' }) => {
|
||||
const shareUrl = useMemo(() => url, [url])
|
||||
|
||||
useEffect(() => {
|
||||
console.log("share.qr.modal.state", {
|
||||
console.log('share.qr.modal.state', {
|
||||
visible,
|
||||
url: shareUrl,
|
||||
});
|
||||
}, [shareUrl, visible]);
|
||||
})
|
||||
}, [shareUrl, visible])
|
||||
|
||||
if (!visible) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
|
||||
const blurIntensity = Platform.select({ ios: 40, android: 40, default: 20 });
|
||||
const blurIntensity = Platform.select({ ios: 40, android: 40, default: 20 })
|
||||
|
||||
return (
|
||||
<Portal>
|
||||
<View style={styles.overlay}>
|
||||
<Pressable
|
||||
onPress={onClose}
|
||||
accessibilityRole="button"
|
||||
style={styles.backdrop}
|
||||
/>
|
||||
<Pressable onPress={onClose} accessibilityRole="button" style={styles.backdrop} />
|
||||
|
||||
<View style={styles.centerWrapper} pointerEvents="box-none">
|
||||
<BlurView
|
||||
@@ -57,18 +48,10 @@ const ShareQrModal = ({
|
||||
<Text style={styles.subtitle}>Partage Musicland à tes amis.</Text>
|
||||
|
||||
<View style={styles.qrWrapper}>
|
||||
<QrCode
|
||||
value={shareUrl}
|
||||
size={220}
|
||||
backgroundColor="transparent"
|
||||
/>
|
||||
<QrCode value={shareUrl} size={220} backgroundColor="transparent" />
|
||||
</View>
|
||||
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
ellipsizeMode="middle"
|
||||
style={styles.linkText}
|
||||
>
|
||||
<Text numberOfLines={1} ellipsizeMode="middle" style={styles.linkText}>
|
||||
{shareUrl}
|
||||
</Text>
|
||||
</View>
|
||||
@@ -76,8 +59,8 @@ const ShareQrModal = ({
|
||||
</View>
|
||||
</View>
|
||||
</Portal>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
overlay: {
|
||||
@@ -85,47 +68,47 @@ const styles = StyleSheet.create({
|
||||
zIndex: 200,
|
||||
...Platform.select({
|
||||
web: {
|
||||
position: "fixed",
|
||||
position: 'fixed',
|
||||
},
|
||||
}),
|
||||
},
|
||||
backdrop: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
backgroundColor: "rgba(0, 0, 0, 0.65)",
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.65)',
|
||||
...Platform.select({
|
||||
web: {
|
||||
position: "fixed",
|
||||
position: 'fixed',
|
||||
},
|
||||
}),
|
||||
},
|
||||
centerWrapper: {
|
||||
flex: 1,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: 24,
|
||||
},
|
||||
modalCard: {
|
||||
width: 360,
|
||||
maxWidth: "90%",
|
||||
maxWidth: '90%',
|
||||
borderRadius: 28,
|
||||
overflow: "hidden",
|
||||
overflow: 'hidden',
|
||||
paddingHorizontal: 24,
|
||||
paddingVertical: 32,
|
||||
backgroundColor: Palette.glass,
|
||||
},
|
||||
closeButton: {
|
||||
position: "absolute",
|
||||
position: 'absolute',
|
||||
top: 18,
|
||||
right: 18,
|
||||
width: 36,
|
||||
height: 36,
|
||||
borderRadius: 18,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
backgroundColor: "rgba(255, 255, 255, 0.12)",
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.12)',
|
||||
},
|
||||
content: {
|
||||
alignItems: "center",
|
||||
alignItems: 'center',
|
||||
gap: 18,
|
||||
},
|
||||
title: {
|
||||
@@ -137,22 +120,22 @@ const styles = StyleSheet.create({
|
||||
fontSize: 14,
|
||||
color: Palette.white,
|
||||
opacity: 0.8,
|
||||
textAlign: "center",
|
||||
textAlign: 'center',
|
||||
fontFamily: FONT_FAMILY.InterRegular,
|
||||
paddingHorizontal: 8,
|
||||
},
|
||||
qrWrapper: {
|
||||
padding: 16,
|
||||
borderRadius: 24,
|
||||
backgroundColor: "rgba(255, 255, 255, 0.08)",
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.08)',
|
||||
},
|
||||
linkText: {
|
||||
fontSize: 13,
|
||||
color: Palette.white,
|
||||
opacity: 0.9,
|
||||
textAlign: "center",
|
||||
textAlign: 'center',
|
||||
fontFamily: FONT_FAMILY.InterMedium,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
export default ShareQrModal;
|
||||
export default ShareQrModal
|
||||
|
||||
Reference in New Issue
Block a user