Skip to content

Instantly share code, notes, and snippets.

View happyharis's full-sized avatar
🎯
Focusing

Haris Samingan happyharis

🎯
Focusing
View GitHub Profile
@happyharis
happyharis / App.js
Last active October 14, 2023 09:35
PCMOB4 Notes Starter Code
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import React from "react";
import NotesScreenAdd from "./screens/NotesScreenAdd";
import NotesScreenHome from "./screens/NotesScreenHome";
const Stack = createStackNavigator();
export default function App() {
return (
@happyharis
happyharis / CameraScreen.js
Created July 23, 2022 12:19
PCMOB6B ProfileStack & CameraScreen
import { FontAwesome } from "@expo/vector-icons";
import { useNavigation } from "@react-navigation/native";
import { Camera } from "expo-camera";
import React, { useEffect, useRef, useState } from "react";
import { StyleSheet, TouchableOpacity, View } from "react-native";
export default function CameraScreen() {
const navigation = useNavigation();
const [back, setBack] = useState(true);
@happyharis
happyharis / metro.config.js
Created July 23, 2022 07:12
PCMOB6 metro.config.js
const { getDefaultConfig } = require("@expo/metro-config");
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.assetExts.push("cjs");
module.exports = defaultConfig;
@happyharis
happyharis / NotesScreenDetails.js
Created July 22, 2022 12:46
PCMOB6 NotesScreenDetails
import { FontAwesome } from "@expo/vector-icons";
import { useNavigation, useRoute } from "@react-navigation/native";
import React, { useRef, useState } from "react";
import {
KeyboardAvoidingView,
Platform,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
@happyharis
happyharis / NotesScreenAdd.js
Last active July 22, 2022 12:25
PCMOB 6 NotesStack.js & NotesScreenAdd.js
import { FontAwesome } from "@expo/vector-icons";
import { useNavigation } from "@react-navigation/native";
import React, { useState } from "react";
import {
KeyboardAvoidingView,
Platform,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
@happyharis
happyharis / notesSlice.js
Created July 21, 2022 11:36
PCMOB 6 Setup: store and reducer
import { createSlice } from "@reduxjs/toolkit";
const initialState = [
{ id: "1", title: "First Post!", content: "Hello!" },
{ id: "2", title: "Second Post", content: "More text" },
];
const notesSlice = createSlice({
name: "notes",
initialState,
@happyharis
happyharis / HomeStack.js
Last active July 21, 2022 08:53
PCMOB6 HomeStack.js
import { FontAwesome } from "@expo/vector-icons";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import React from "react";
import { NOTES_SCREEN, PROFILE_SCREEN } from "../constants";
import NotesScreenHome from "../screens/NotesScreenHome";
import ProfileScreen from "../screens/ProfileScreen";
const BottomTab = createBottomTabNavigator();
export default function HomeStack() {
@happyharis
happyharis / NotesScreenHome.js
Last active August 26, 2022 13:01
PCMOB6 NotesScreenHome.js
import {
FlatList,
StyleSheet,
Text,
TouchableOpacity,
View,
} from "react-native";
import React from "react";
const posts = [
@happyharis
happyharis / App.js
Last active December 7, 2022 00:56
PCMOB6 ProfileScreen & AuthScreen
import AsyncStorage from "@react-native-async-storage/async-storage";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import React, { useEffect, useState } from "react";
import { ActivityIndicator, StatusBar, StyleSheet, View } from "react-native";
import AuthScreen from "./screens/AuthScreen";
import ProfileScreen from "./screens/ProfileScreen";
import { AUTH_SCREEN, PROFILE_SCREEN } from "./constants";
const Stack = createStackNavigator();
@happyharis
happyharis / constants.js
Last active August 22, 2022 02:01
PCMOB6 constants.js
// API
export const API = "https://pcmob6-blog-api.<username>.repl.co";
export const API_LOGIN = "/auth";
export const API_SIGNUP = "/newuser";
export const API_POSTS = "/posts";
export const API_WHOAMI = "/whoami";
export const API_CREATE = "/create";
// Screen names
export const AUTH_SCREEN = "AUTH_SCREEN"