WellNuo/components/ImageLightbox.tsx
Sergei 966d8e2aba Various improvements and fixes
- Added ImageLightbox component for avatar viewing
- Updated beneficiary detail page with lightbox support
- Profile page improvements
- Bug page cleanup
- API and context updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-10 08:25:39 -08:00

88 lines
2.0 KiB
TypeScript

import React from 'react';
import {
Modal,
View,
Image,
StyleSheet,
TouchableOpacity,
Dimensions,
StatusBar,
} from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { AppColors } from '@/constants/theme';
interface ImageLightboxProps {
visible: boolean;
imageUri: string | null;
onClose: () => void;
}
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
export function ImageLightbox({ visible, imageUri, onClose }: ImageLightboxProps) {
if (!imageUri) return null;
return (
<Modal
visible={visible}
transparent
animationType="fade"
statusBarTranslucent
onRequestClose={onClose}
>
<StatusBar barStyle="light-content" backgroundColor="rgba(0,0,0,0.95)" />
<View style={styles.container}>
{/* Close button */}
<TouchableOpacity style={styles.closeButton} onPress={onClose}>
<Ionicons name="close" size={28} color={AppColors.white} />
</TouchableOpacity>
{/* Image */}
<TouchableOpacity
style={styles.imageContainer}
activeOpacity={1}
onPress={onClose}
>
<Image
source={{ uri: imageUri }}
style={styles.image}
resizeMode="contain"
/>
</TouchableOpacity>
</View>
</Modal>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.95)',
justifyContent: 'center',
alignItems: 'center',
},
closeButton: {
position: 'absolute',
top: 50,
right: 20,
width: 44,
height: 44,
borderRadius: 22,
backgroundColor: 'rgba(255, 255, 255, 0.2)',
justifyContent: 'center',
alignItems: 'center',
zIndex: 10,
},
imageContainer: {
width: screenWidth,
height: screenHeight,
justifyContent: 'center',
alignItems: 'center',
},
image: {
width: screenWidth - 40,
height: screenWidth - 40,
borderRadius: 20,
},
});