Better route splitting
This commit is contained in:
		
							parent
							
								
									1ec6a90ff9
								
							
						
					
					
						commit
						74a5b3930b
					
				
					 1 changed files with 28 additions and 14 deletions
				
			
		
							
								
								
									
										30
									
								
								App.tsx
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								App.tsx
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -5,32 +5,46 @@ import { style } from "./src/util/style";
 | 
			
		|||
import { PostsContainer } from "./src/components/PostsContainer";
 | 
			
		||||
import { NavigationContainer } from "@react-navigation/native";
 | 
			
		||||
import { createNativeStackNavigator } from "@react-navigation/native-stack";
 | 
			
		||||
import { NewPostContainer } from "./src/components/NewPostContainer";
 | 
			
		||||
 | 
			
		||||
const Stack = createNativeStackNavigator();
 | 
			
		||||
 | 
			
		||||
export default function App(): JSX.Element {
 | 
			
		||||
  return (
 | 
			
		||||
    <>
 | 
			
		||||
      <StatusBar style="light" />
 | 
			
		||||
      <NavigationContainer>
 | 
			
		||||
        <Stack.Navigator>
 | 
			
		||||
          <Stack.Screen
 | 
			
		||||
            name="Home"
 | 
			
		||||
            component={HomeScreen}
 | 
			
		||||
          options={{
 | 
			
		||||
            options={homeOptions}
 | 
			
		||||
          />
 | 
			
		||||
          <Stack.Screen name="New" component={PostScreen} />
 | 
			
		||||
        </Stack.Navigator>
 | 
			
		||||
      </NavigationContainer>
 | 
			
		||||
    </>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const homeOptions = {
 | 
			
		||||
  headerStyle: style.header,
 | 
			
		||||
  headerTitleStyle: style.headerTitle,
 | 
			
		||||
  headerTintColor: "#fff",
 | 
			
		||||
          }}
 | 
			
		||||
        />
 | 
			
		||||
      </Stack.Navigator>
 | 
			
		||||
    </NavigationContainer>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function HomeScreen(): JSX.Element {
 | 
			
		||||
  return (
 | 
			
		||||
    <View style={style.app}>
 | 
			
		||||
      <StatusBar style="light" />
 | 
			
		||||
      <PostsContainer />
 | 
			
		||||
    </View>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function PostScreen(): JSX.Element {
 | 
			
		||||
  return (
 | 
			
		||||
    <View style={style.app}>
 | 
			
		||||
      <NewPostContainer />
 | 
			
		||||
    </View>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue