import { HeroCarousel } from '@strv/react-native-hero-carousel'
import { SafeAreaView, StyleSheet, View, Text, Dimensions } from 'react-native'
import { Image } from 'expo-image'
import { LinearGradient } from 'expo-linear-gradient'
import { useEffect } from 'react'
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window')
const getRandomImageUrl = () => {
return `https://picsum.photos/${SCREEN_WIDTH * 3}/${SCREEN_HEIGHT * 3}?random=${Math.floor(
Math.random() * 1000,
)}`
}
const images = Array.from({ length: 5 }, getRandomImageUrl)
const Slide = ({ image, title, index }: { image: string; title: string; index: number }) => {
return (
{title}
)
}
export default function BasicExample() {
// Preload all images when component mounts
useEffect(() => {
Image.prefetch(images)
}, [])
return (
{images.map((image, index) => (
))}
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
slide: {
flex: 1,
width: '100%',
height: '100%',
overflow: 'hidden',
},
image: {
width: '100%',
height: '100%',
transformOrigin: 'center',
},
gradient: {
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
height: '50%',
justifyContent: 'flex-end',
padding: 20,
},
title: {
fontSize: 32,
bottom: 100,
left: 20,
position: 'absolute',
lineHeight: 32,
fontWeight: 'bold',
color: 'white',
opacity: 0.5,
},
})