overview
Github: https://github.com/skyhitz/skyhitz-expo-next
This repository contains frontend code of the Skyhitz app. It's a monorepo that uses Solito to reuse code between Web and Mobile.
Project structure
appsentry points for each appexpohere you can import all expo specific packages, or configure expo app (app.jsonoreas.json)nexthere you can import all next expecific packages and configure next apppagesunder this directory you have to maintain navigation hierarchy according to next guidelinespublichere you can put files that should be static served
packagesshared packages across appsappyou'll be importing most files fromapp/apidirectory for all graphql related code. Here you will add new queries or mutations (see more)assetsdirectory for assets like fonts or imagesconfigdirectory where we keep config depending on the current environmentconstantsdirectory for constantsdesign-systemdirectory for all things related to design-system. it should be merged in the future withuidirectoryfeaturescomponents organized by featurehooksdirectory where we keep all our custom hooksnavigationmobileNext.js has apages/folder. React Native doesn't. This folder contains navigation-related code for RN. You may use it for any navigation code, such as custom links.webWe use it as a wrapper to for the dashboard navbar
provider(all the providers that wrap the app, and some no-ops for Web.)stateall recoil related codestellarstellar related code (i.ex. creating transactions). Could be moved to utilstypesdirectory where we keep global types (i.ex. user)uidirectory where we keep components that are reused by many features i.ex. buttons, inputsutilsself-explanatoryvalidationcode for form validation. Could be moved to utils
🏁 Start the app
Install dependencies:
yarnNext.js local dev:
yarn web- Runs
yarn next
- Runs
Expo local dev:
yarn native- Runs
expo start
- Runs
🆕 Add new dependencies
Pure JS dependencies
If you're installing a JavaScript-only dependency that will be used across platforms, install it in packages/app:
cd packages/app
yarn add date-fns
cd ../..
yarn
Native dependencies
If you're installing a library with any native code, you must install it in apps/expo:
cd apps/expo
yarn add react-native-reanimated
cd ../..
yarn
You can also install the native library inside of packages/app if you want to get autoimport for that package inside of the app folder. However, you need to be careful and install the exact same version in both packages. If the versions mismatch at all, you'll potentially get terrible bugs. This is a classic monorepo issue. I use lerna-update-wizard to help with this (you don't need to use Lerna to use that lib).