Add routes and core views

This commit is contained in:
Paul Frazee 2022-06-09 16:32:03 -05:00
parent d6942bffab
commit fc3b2952bb
16 changed files with 293 additions and 118 deletions

17
src/screens/Home.tsx Normal file
View file

@ -0,0 +1,17 @@
import React from 'react'
import {Text, Button, View, SafeAreaView} from 'react-native'
import type {PrimaryTabScreenProps} from '../routes/types'
export const Home = ({navigation}: PrimaryTabScreenProps<'Home'>) => {
return (
<SafeAreaView style={{flex: 1}}>
<View style={{flex: 1}}>
<Text>Hello world</Text>
<Button
title="Go to Jane's profile"
onPress={() => navigation.navigate('Profile', {name: 'Jane'})}
/>
</View>
</SafeAreaView>
)
}

19
src/screens/Menu.tsx Normal file
View file

@ -0,0 +1,19 @@
import React from 'react'
import {SafeAreaView, ScrollView, Text, Button, View} from 'react-native'
import type {PrimaryTabScreenProps} from '../routes/types'
export const Menu = ({navigation}: PrimaryTabScreenProps<'Menu'>) => {
return (
<SafeAreaView>
<ScrollView contentInsetAdjustmentBehavior="automatic">
<View>
<Text>Hello world</Text>
<Button
title="Go to Jane's profile"
onPress={() => navigation.navigate('Profile', {name: 'Jane'})}
/>
</View>
</ScrollView>
</SafeAreaView>
)
}

27
src/screens/NotFound.tsx Normal file
View file

@ -0,0 +1,27 @@
import React from 'react'
import {
SafeAreaView,
ScrollView,
StatusBar,
Text,
Button,
useColorScheme,
View,
} from 'react-native'
import type {RootStackScreenProps} from '../routes/types'
export const NotFound = ({navigation}: RootStackScreenProps<'NotFound'>) => {
const isDarkMode = useColorScheme() === 'dark'
return (
<SafeAreaView>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<ScrollView contentInsetAdjustmentBehavior="automatic">
<View>
<Text>Page not found</Text>
<Button title="Home" onPress={() => navigation.navigate('Primary')} />
</View>
</ScrollView>
</SafeAreaView>
)
}

View file

@ -0,0 +1,21 @@
import React from 'react'
import {SafeAreaView, ScrollView, Text, Button, View} from 'react-native'
import type {PrimaryTabScreenProps} from '../routes/types'
export const Notifications = ({
navigation,
}: PrimaryTabScreenProps<'Notifications'>) => {
return (
<SafeAreaView>
<ScrollView contentInsetAdjustmentBehavior="automatic">
<View>
<Text>Hello world</Text>
<Button
title="Go to Jane's profile"
onPress={() => navigation.navigate('Profile', {name: 'Jane'})}
/>
</View>
</ScrollView>
</SafeAreaView>
)
}

7
src/screens/Profile.tsx Normal file
View file

@ -0,0 +1,7 @@
import React from 'react'
import {Text} from 'react-native'
import type {RootStackScreenProps} from '../routes/types'
export const Profile = ({route}: RootStackScreenProps<'Profile'>) => {
return <Text>This is {route.params.name}'s profile</Text>
}

19
src/screens/Search.tsx Normal file
View file

@ -0,0 +1,19 @@
import React from 'react'
import {SafeAreaView, ScrollView, Text, Button, View} from 'react-native'
import type {PrimaryTabScreenProps} from '../routes/types'
export const Search = ({navigation}: PrimaryTabScreenProps<'Search'>) => {
return (
<SafeAreaView>
<ScrollView contentInsetAdjustmentBehavior="automatic">
<View>
<Text>Hello world</Text>
<Button
title="Go to Jane's profile"
onPress={() => navigation.navigate('Profile', {name: 'Jane'})}
/>
</View>
</ScrollView>
</SafeAreaView>
)
}