-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
264 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,62 @@ | ||
import { Image, StyleSheet, Platform } from 'react-native'; | ||
|
||
import { HelloWave } from '@/components/HelloWave'; | ||
import ParallaxScrollView from '@/components/ParallaxScrollView'; | ||
import React, { useState, useCallback } from 'react'; | ||
import { StyleSheet, View } from 'react-native'; | ||
import { ThemedText } from '@/components/ThemedText'; | ||
import { ThemedView } from '@/components/ThemedView'; | ||
import EventCard from '@/components/EventCard'; | ||
|
||
export default function HomeScreen() { | ||
const [events, setEvents] = useState([ | ||
{ id: '1', title: 'Tech Meetup', date: '2023-06-15', location: 'San Francisco', imageUrl: 'https://plus.unsplash.com/premium_photo-1681426687411-21986b0626a8?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8dGVjaHxlbnwwfHwwfHx8MA%3D%3D' }, | ||
{ id: '2', title: 'Photography Meetup', date: '2023-07-01', location: 'New York', imageUrl: 'https://images.unsplash.com/photo-1719937206498-b31844530a96?q=80&w=3348&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D' }, | ||
{ id: '3', title: 'AI Workshop', date: '2023-07-10', location: 'London', imageUrl: 'https://images.unsplash.com/photo-1620712943543-bcc4688e7485?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8YWl8ZW58MHx8MHx8fDA%3D' }, | ||
]); | ||
|
||
const handleEventAction = useCallback(() => { | ||
setEvents(prevEvents => { | ||
if (prevEvents.length > 1) { | ||
const [firstEvent, ...restEvents] = prevEvents; | ||
return [...restEvents, firstEvent]; | ||
} | ||
return prevEvents; | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<ParallaxScrollView | ||
headerBackgroundColor={{ light: '#A1CEDC', dark: '#1D3D47' }} | ||
headerImage={ | ||
<Image | ||
source={require('@/assets/images/partial-react-logo.png')} | ||
style={styles.reactLogo} | ||
/> | ||
}> | ||
<ThemedView style={styles.titleContainer}> | ||
<ThemedText type="title">Welcome!</ThemedText> | ||
<HelloWave /> | ||
</ThemedView> | ||
<ThemedView style={styles.stepContainer}> | ||
<ThemedText type="subtitle">Step 1: Try it</ThemedText> | ||
<ThemedText> | ||
Edit <ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> to see changes. | ||
Press{' '} | ||
<ThemedText type="defaultSemiBold"> | ||
{Platform.select({ ios: 'cmd + d', android: 'cmd + m' })} | ||
</ThemedText>{' '} | ||
to open developer tools. | ||
</ThemedText> | ||
<ThemedView style={styles.container}> | ||
<ThemedView style={styles.eventsContainer}> | ||
<ThemedText type="subtitle">Upcoming Events</ThemedText> | ||
<View style={styles.cardContainer}> | ||
{events.length > 0 ? ( | ||
<EventCard | ||
key={events[0].id} | ||
title={events[0].title} | ||
date={events[0].date} | ||
location={events[0].location} | ||
imageUrl={events[0].imageUrl} | ||
onAccept={handleEventAction} | ||
onReject={handleEventAction} | ||
/> | ||
) : ( | ||
<ThemedText>No events available</ThemedText> | ||
)} | ||
</View> | ||
</ThemedView> | ||
<ThemedView style={styles.stepContainer}> | ||
<ThemedText type="subtitle">Step 2: Explore</ThemedText> | ||
<ThemedText> | ||
Tap the Explore tab to learn more about what's included in this starter app. | ||
</ThemedText> | ||
</ThemedView> | ||
<ThemedView style={styles.stepContainer}> | ||
<ThemedText type="subtitle">Step 3: Get a fresh start</ThemedText> | ||
<ThemedText> | ||
When you're ready, run{' '} | ||
<ThemedText type="defaultSemiBold">npm run reset-project</ThemedText> to get a fresh{' '} | ||
<ThemedText type="defaultSemiBold">app</ThemedText> directory. This will move the current{' '} | ||
<ThemedText type="defaultSemiBold">app</ThemedText> to{' '} | ||
<ThemedText type="defaultSemiBold">app-example</ThemedText>. | ||
</ThemedText> | ||
</ThemedView> | ||
</ParallaxScrollView> | ||
</ThemedView> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
titleContainer: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
gap: 8, | ||
container: { | ||
flex: 1, | ||
padding: 16, | ||
}, | ||
stepContainer: { | ||
gap: 8, | ||
marginBottom: 8, | ||
eventsContainer: { | ||
flex: 1, | ||
marginBottom: 16, | ||
}, | ||
reactLogo: { | ||
height: 178, | ||
width: 290, | ||
bottom: 0, | ||
left: 0, | ||
position: 'absolute', | ||
cardContainer: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.