diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-06-09 16:32:03 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-06-09 16:32:03 -0500 |
commit | fc3b2952bb59b80665ebb53ffb3377f647ccdbd3 (patch) | |
tree | 37477c0803459ff55f0e26ae27c8231305e6856a /src/App.native.tsx | |
parent | d6942bffab68ce80d5cb26b42710dd9276f62ded (diff) | |
download | voidsky-fc3b2952bb59b80665ebb53ffb3377f647ccdbd3.tar.zst |
Add routes and core views
Diffstat (limited to 'src/App.native.tsx')
-rw-r--r-- | src/App.native.tsx | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx index 40989caf0..2fadf993f 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -1,52 +1,6 @@ import React, {useState, useEffect} from 'react' -import { - SafeAreaView, - ScrollView, - StatusBar, - Text, - Button, - useColorScheme, - View, -} from 'react-native' -import {NavigationContainer} from '@react-navigation/native' -import { - createNativeStackNavigator, - NativeStackScreenProps, -} from '@react-navigation/native-stack' import {RootStore, setupState, RootStoreProvider} from './state' - -type RootStackParamList = { - Home: undefined - Profile: {name: string} -} -const Stack = createNativeStackNavigator() - -const HomeScreen = ({ - navigation, -}: NativeStackScreenProps<RootStackParamList, 'Home'>) => { - const isDarkMode = useColorScheme() === 'dark' - - return ( - <SafeAreaView> - <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> - <ScrollView contentInsetAdjustmentBehavior="automatic"> - <View> - <Text>Native</Text> - <Button - title="Go to Jane's profile" - onPress={() => navigation.navigate('Profile', {name: 'Jane'})} - /> - </View> - </ScrollView> - </SafeAreaView> - ) -} - -const ProfileScreen = ({ - route, -}: NativeStackScreenProps<RootStackParamList, 'Profile'>) => { - return <Text>This is {route.params.name}'s profile</Text> -} +import * as Routes from './routes' function App() { const [rootStore, setRootStore] = useState<RootStore | undefined>(undefined) @@ -63,16 +17,7 @@ function App() { return ( <RootStoreProvider value={rootStore}> - <NavigationContainer> - <Stack.Navigator> - <Stack.Screen - name="Home" - component={HomeScreen} - options={{title: 'Welcome'}} - /> - <Stack.Screen name="Profile" component={ProfileScreen} /> - </Stack.Navigator> - </NavigationContainer> + <Routes.Root /> </RootStoreProvider> ) } |