Skip to content

Commit

Permalink
Merge pull request #56 from UNLV-CS472-672/55-bug-fix-typescript-stri…
Browse files Browse the repository at this point in the history
…ng-type-errors-with-nav-component-routes

🐛fix: Fix TypeScript errors with Nav component routes
  • Loading branch information
taylorfinelli authored Mar 8, 2024
2 parents d66f451 + 74b1ed7 commit 18503f0
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions apps/expo/src/app/nav/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Route } from 'expo-router'
import React from 'react'
import { Button, FlatList, StyleSheet, View } from 'react-native'
import { router } from 'expo-router'
import { StyleSheet, Button, Text, View, FlatList } from 'react-native'
import { SafeAreaView } from 'react-native-safe-area-context'

const styles = StyleSheet.create({
container: {
Expand All @@ -13,20 +13,25 @@ const styles = StyleSheet.create({
fontSize: 18,
height: 44,
},
});
})

const Nav = () => {
return (
<View style={styles.container}>
<FlatList
data={[
// add your component routes here
{key: 'Home', route: '/'},
// add your component routes here
{ key: 'Home', route: '/' },
]}
renderItem={({item}) => <Button style={styles.btn} title={item.key} onPress={() => router.push(item.route)}/>}
renderItem={({ item }) => (
<Button
title={item.key}
onPress={() => router.push(item.route as Route<string>)}
/>
)}
/>
</View>
);
};
)
}

export default Nav

0 comments on commit 18503f0

Please sign in to comment.