From fc3b2952bb59b80665ebb53ffb3377f647ccdbd3 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 9 Jun 2022 16:32:03 -0500 Subject: Add routes and core views --- README.md | 13 +++- .../app/src/main/java/com/app/MainActivity.java | 6 ++ ios/Podfile.lock | 6 ++ package.json | 2 + public/index.html | 10 ++- src/App.native.tsx | 59 +----------------- src/App.web.tsx | 59 +----------------- src/routes/index.tsx | 72 ++++++++++++++++++++++ src/routes/types.ts | 24 ++++++++ src/screens/Home.tsx | 17 +++++ src/screens/Menu.tsx | 19 ++++++ src/screens/NotFound.tsx | 27 ++++++++ src/screens/Notifications.tsx | 21 +++++++ src/screens/Profile.tsx | 7 +++ src/screens/Search.tsx | 19 ++++++ yarn.lock | 50 ++++++++++++++- 16 files changed, 293 insertions(+), 118 deletions(-) create mode 100644 src/routes/index.tsx create mode 100644 src/routes/types.ts create mode 100644 src/screens/Home.tsx create mode 100644 src/screens/Menu.tsx create mode 100644 src/screens/NotFound.tsx create mode 100644 src/screens/Notifications.tsx create mode 100644 src/screens/Profile.tsx create mode 100644 src/screens/Search.tsx diff --git a/README.md b/README.md index 81f530018..159d374ad 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,15 @@ Uses: - To run the Web app: `yarn web` - Tips - `npx react-native info` Checks what has been installed. - - Android instructions are a *little* inaccurate but not as much as you might think. I had to manually create a virtual device, then run `yarn android` twice (once to start the emulator and the second time to connect to it). \ No newline at end of file + - Android instructions are a *little* inaccurate but not as much as you might think. I had to manually create a virtual device, then run `yarn android` twice (once to start the emulator and the second time to connect to it). + +## TODOs + +- Navigation + - Auth / Unauthed +- Web + - Desktop vs mobile styling +- API + - Create mock api +- Tests + - Should just try to catch errors on basic load diff --git a/android/app/src/main/java/com/app/MainActivity.java b/android/app/src/main/java/com/app/MainActivity.java index 8502b9e3f..ba71d4819 100644 --- a/android/app/src/main/java/com/app/MainActivity.java +++ b/android/app/src/main/java/com/app/MainActivity.java @@ -3,6 +3,7 @@ package com.app; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView; +import android.os.Bundle; public class MainActivity extends ReactActivity { @@ -36,5 +37,10 @@ public class MainActivity extends ReactActivity { reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED); return reactRootView; } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(null); + } } } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 4d7b00974..fef825bb5 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -353,6 +353,8 @@ PODS: - React-jsi (= 0.68.2) - React-logger (= 0.68.2) - React-perflogger (= 0.68.2) + - RNCAsyncStorage (1.17.6): + - React-Core - RNScreens (3.13.1): - React-Core - React-RCTImage @@ -417,6 +419,7 @@ DEPENDENCIES: - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) + - "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)" - RNScreens (from `../node_modules/react-native-screens`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) @@ -501,6 +504,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" ReactCommon: :path: "../node_modules/react-native/ReactCommon" + RNCAsyncStorage: + :path: "../node_modules/@react-native-async-storage/async-storage" RNScreens: :path: "../node_modules/react-native-screens" Yoga: @@ -551,6 +556,7 @@ SPEC CHECKSUMS: React-RCTVibration: 79040b92bfa9c3c2d2cb4f57e981164ec7ab9374 React-runtimeexecutor: b960b687d2dfef0d3761fbb187e01812ebab8b23 ReactCommon: 095366164a276d91ea704ce53cb03825c487a3f2 + RNCAsyncStorage: 466b9df1a14bccda91da86e0b7d9a345d78e1673 RNScreens: 40a2cb40a02a609938137a1e0acfbf8fc9eebf19 SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 Yoga: 99652481fcd320aefa4a7ef90095b95acd181952 diff --git a/package.json b/package.json index 346cbcc9c..764c79b44 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,10 @@ }, "dependencies": { "@react-native-async-storage/async-storage": "^1.17.6", + "@react-navigation/bottom-tabs": "^6.3.1", "@react-navigation/native": "^6.0.10", "@react-navigation/native-stack": "^6.6.2", + "@react-navigation/stack": "^6.2.1", "mobx": "^6.6.0", "mobx-state-tree": "^5.1.5", "react": "17.0.2", diff --git a/public/index.html b/public/index.html index c12fddc36..f6cb612b6 100644 --- a/public/index.html +++ b/public/index.html @@ -4,8 +4,16 @@ WEBAPP + -
+
\ No newline at end of file diff --git a/src/App.native.tsx b/src/App.native.tsx index 40989caf0..2fadf993f 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -1,52 +1,6 @@ import React, {useState, useEffect} from 'react' -import { - SafeAreaView, - ScrollView, - StatusBar, - Text, - Button, - useColorScheme, - View, -} from 'react-native' -import {NavigationContainer} from '@react-navigation/native' -import { - createNativeStackNavigator, - NativeStackScreenProps, -} from '@react-navigation/native-stack' import {RootStore, setupState, RootStoreProvider} from './state' - -type RootStackParamList = { - Home: undefined - Profile: {name: string} -} -const Stack = createNativeStackNavigator() - -const HomeScreen = ({ - navigation, -}: NativeStackScreenProps) => { - const isDarkMode = useColorScheme() === 'dark' - - return ( - - - - - Native -