Added comments to App
This commit is contained in:
parent
a4fefbe9ad
commit
26177beeab
1 changed files with 27 additions and 1 deletions
26
App.tsx
26
App.tsx
|
@ -7,11 +7,24 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
||||||
import { NewPostContainer } from "./src/components/NewPostContainer";
|
import { NewPostContainer } from "./src/components/NewPostContainer";
|
||||||
import { NativeStackNavigationProp } from "@react-navigation/native-stack";
|
import { NativeStackNavigationProp } from "@react-navigation/native-stack";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RootStackParamList defines the possible screens in the app.
|
||||||
|
* @typedef {object} RootStackParamList
|
||||||
|
* @property {undefined} Home - Home screen.
|
||||||
|
* @property {undefined} New - New post screen.
|
||||||
|
*/
|
||||||
|
|
||||||
type RootStackParamList = {
|
type RootStackParamList = {
|
||||||
Home: undefined;
|
Home: undefined;
|
||||||
New: undefined;
|
New: undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HomeScreenNavigationProp represents the navigation prop for the Home screen.
|
||||||
|
* @typedef {object} HomeScreenNavigationProp
|
||||||
|
* @property {Function} navigate - Function to navigate to a different screen.
|
||||||
|
*/
|
||||||
|
|
||||||
export type HomeScreenNavigationProp = NativeStackNavigationProp<
|
export type HomeScreenNavigationProp = NativeStackNavigationProp<
|
||||||
RootStackParamList,
|
RootStackParamList,
|
||||||
"Home"
|
"Home"
|
||||||
|
@ -19,17 +32,28 @@ export type HomeScreenNavigationProp = NativeStackNavigationProp<
|
||||||
|
|
||||||
const Stack = createNativeStackNavigator();
|
const Stack = createNativeStackNavigator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App function represents the main application component.
|
||||||
|
* @returns {JSX.Element} - The rendered App component.
|
||||||
|
*/
|
||||||
export default function App(): JSX.Element {
|
export default function App(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{/* Sets the status bar style */}
|
||||||
<StatusBar style="light" />
|
<StatusBar style="light" />
|
||||||
|
|
||||||
|
{/* Navigation container for the app */}
|
||||||
<NavigationContainer>
|
<NavigationContainer>
|
||||||
|
{/* Stack navigator for different screens */}
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
|
{/* Home screen */}
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="Home"
|
name="Home"
|
||||||
component={PostsContainer}
|
component={PostsContainer}
|
||||||
options={options}
|
options={options}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* New post screen */}
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="New"
|
name="New"
|
||||||
options={options}
|
options={options}
|
||||||
|
@ -41,8 +65,10 @@ export default function App(): JSX.Element {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Header options for the screens
|
||||||
const options = {
|
const options = {
|
||||||
headerStyle: style.header,
|
headerStyle: style.header,
|
||||||
headerTitleStyle: style.headerTitle,
|
headerTitleStyle: style.headerTitle,
|
||||||
headerTintColor: "#fff",
|
headerTintColor: "#fff",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue