diff --git a/App.tsx b/App.tsx index e22f7e3..21b6298 100644 --- a/App.tsx +++ b/App.tsx @@ -1,5 +1,4 @@ import { StatusBar } from "expo-status-bar"; -import { View } from "react-native"; import { style } from "./src/util/style"; import { PostsContainer } from "./src/components/PostsContainer"; @@ -17,34 +16,22 @@ export default function App(): JSX.Element { + - ); } -const homeOptions = { +const options = { headerStyle: style.header, headerTitleStyle: style.headerTitle, headerTintColor: "#fff", }; - -function HomeScreen(): JSX.Element { - return ( - - - - ); -} - -function PostScreen(): JSX.Element { - return ( - - - - ); -} diff --git a/src/components/NewPostContainer.tsx b/src/components/NewPostContainer.tsx index 5545464..b0c852e 100644 --- a/src/components/NewPostContainer.tsx +++ b/src/components/NewPostContainer.tsx @@ -3,7 +3,7 @@ import { View, Text, TextInput, Button } from "react-native"; import { style } from "../util/style"; import { createPost, NewPost } from "../util/api"; -export function NewPostContainer(): JSX.Element { +export function NewPostContainer({ navigation }): JSX.Element { const [currentInput, setCurrentInput] = React.useState(""); const [currentInputError, setCurrentInputError] = React.useState(""); diff --git a/src/components/PostsContainer.tsx b/src/components/PostsContainer.tsx index 3afa494..d5b1a67 100644 --- a/src/components/PostsContainer.tsx +++ b/src/components/PostsContainer.tsx @@ -1,12 +1,12 @@ import React from "react"; -import { RefreshControl } from "react-native"; +import { Button, RefreshControl } from "react-native"; import { getPostsInterval, Post } from "../util/api"; import { PostView } from "./PostView"; import { style } from "../util/style"; import { SafeAreaView } from "react-native"; import { VirtualizedList } from "react-native"; -export function PostsContainer(): JSX.Element { +export function PostsContainer({ navigation }): JSX.Element { const [postData, setPostData] = React.useState([]); const [page, setPage] = React.useState(0); const [refreshing, setRefreshing] = React.useState(false); @@ -53,26 +53,32 @@ export function PostsContainer(): JSX.Element { const getItem = (_data: unknown, index: number): Post => postData[index]; return ( - - ( - - )} - keyExtractor={(item: Post) => item.id + item.createdAt} - getItemCount={getItemCount} - getItem={getItem} - onEndReached={handleEndReached} - onEndReachedThreshold={0.4} - refreshControl={ - - } + <> +