Compare commits
	
		
			No commits in common. "a1c8cd95d3904d7ad052653895db25d2c7f63e18" and "68b0b162219dcc0309b62ea044358c37ec1b47c4" have entirely different histories.
		
	
	
		
			a1c8cd95d3
			...
			68b0b16221
		
	
		
					 4 changed files with 18 additions and 38 deletions
				
			
		
							
								
								
									
										20
									
								
								App.tsx
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								App.tsx
									
										
									
									
									
								
							| 
						 | 
					@ -1,15 +1,23 @@
 | 
				
			||||||
import { StatusBar } from "expo-status-bar";
 | 
					import { StatusBar } from 'expo-status-bar';
 | 
				
			||||||
import { Text, View } from "react-native";
 | 
					import { StyleSheet, Text, View } from 'react-native';
 | 
				
			||||||
import { style } from "./src/util/style";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { PostsContainer } from "./src/components/PostsContainer";
 | 
					import { PostsContainer } from './src/components/PostsContainer';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function App(): JSX.Element {
 | 
					export default function App() {
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <View style={style.app}>
 | 
					    <View style={styles.container}>
 | 
				
			||||||
      <Text>Open up App.tsx to start working on your app!</Text>
 | 
					      <Text>Open up App.tsx to start working on your app!</Text>
 | 
				
			||||||
      <StatusBar style="auto" />
 | 
					      <StatusBar style="auto" />
 | 
				
			||||||
      <PostsContainer />
 | 
					      <PostsContainer />
 | 
				
			||||||
    </View>
 | 
					    </View>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const styles = StyleSheet.create({
 | 
				
			||||||
 | 
					  container: {
 | 
				
			||||||
 | 
					    flex: 1,
 | 
				
			||||||
 | 
					    backgroundColor: '#fff',
 | 
				
			||||||
 | 
					    alignItems: 'center',
 | 
				
			||||||
 | 
					    justifyContent: 'center',
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
import React from "react";
 | 
					import React from "react";
 | 
				
			||||||
import { View, Text } from "react-native";
 | 
					import { View, Text } from "react-native";
 | 
				
			||||||
import { Post } from "../util/api";
 | 
					import { Post } from "../util/api";
 | 
				
			||||||
import { style } from "../util/style";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is the component that holds a single Post
 | 
					 * This is the component that holds a single Post
 | 
				
			||||||
| 
						 | 
					@ -15,8 +14,8 @@ export function PostView({ post }: { post: Post }): JSX.Element {
 | 
				
			||||||
  const [thisPost, setThisPost] = React.useState<Post>(post);
 | 
					  const [thisPost, setThisPost] = React.useState<Post>(post);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <View style={style.postView}>
 | 
					    <View style={{ flexDirection: "row", height: 100, padding: 20 }}>
 | 
				
			||||||
      <Text style={style.postFont} >{thisPost.content}</Text>
 | 
					      <Text>{thisPost.content}</Text>
 | 
				
			||||||
    </View>
 | 
					    </View>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,6 @@ import React from "react";
 | 
				
			||||||
import { View, Text } from "react-native";
 | 
					import { View, Text } from "react-native";
 | 
				
			||||||
import { getPosts, Post } from "../util/api";
 | 
					import { getPosts, Post } from "../util/api";
 | 
				
			||||||
import { PostView } from "./PostView";
 | 
					import { PostView } from "./PostView";
 | 
				
			||||||
import { style } from "../util/style";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function PostsContainer(): JSX.Element {
 | 
					export function PostsContainer(): JSX.Element {
 | 
				
			||||||
  const [posts, setPosts] = React.useState<Post[]>([]);
 | 
					  const [posts, setPosts] = React.useState<Post[]>([]);
 | 
				
			||||||
| 
						 | 
					@ -16,7 +15,7 @@ export function PostsContainer(): JSX.Element {
 | 
				
			||||||
  }, []);
 | 
					  }, []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <View style={style.postsContainer}>
 | 
					    <View style={{ height: 100, padding: 20 }}>
 | 
				
			||||||
      <Text>Hello World!</Text>
 | 
					      <Text>Hello World!</Text>
 | 
				
			||||||
      {posts.map((post) => (
 | 
					      {posts.map((post) => (
 | 
				
			||||||
        <PostView key={post.id} post={post} />
 | 
					        <PostView key={post.id} post={post} />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,26 +0,0 @@
 | 
				
			||||||
import { StyleSheet } from 'react-native';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const style = StyleSheet.create({
 | 
					 | 
				
			||||||
  app: { // Outermost container
 | 
					 | 
				
			||||||
    flex: 1,
 | 
					 | 
				
			||||||
    backgroundColor: '#fff', // For the "entire" app
 | 
					 | 
				
			||||||
    alignItems: 'center',
 | 
					 | 
				
			||||||
    justifyContent: 'center',
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  postsContainer: {
 | 
					 | 
				
			||||||
    height: '100%',
 | 
					 | 
				
			||||||
    padding: 5,
 | 
					 | 
				
			||||||
    flex: 1,
 | 
					 | 
				
			||||||
    alignItems: 'center',
 | 
					 | 
				
			||||||
    justifyContent: 'flex-start',
 | 
					 | 
				
			||||||
    backgroundColor: '#fff', // For the container holding the posts
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  postView: {
 | 
					 | 
				
			||||||
    flexDirection: "row",
 | 
					 | 
				
			||||||
    backgroundColor: '#fff',
 | 
					 | 
				
			||||||
    paddingVertical: 5,
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  postFont: {
 | 
					 | 
				
			||||||
    color: "#000",
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue