- cd to the root App folder
~/WWW/Apps/expo
- run
npx create-expo-app somethingApp
- this will create the app project and all the expo folders/dependancies/etc.
- cd into the new dir
cd somethingApp
- run
npm start
- this runs expo - Alternatively - since i have xcode and ios simulator installed i can... open the xcode program THEN run
npm run ios
- access debug mode on ios simulator by clicking
command + D
keys (seems to only work once - need to exit expo app to access it again - click iphone circle home key) - to refresh ios simulator click
command + r
keys
- run
npm install @react-navigation/native
- this is the navigation that works with expo - we need to further config expo to work with navigation... run
npx expo install react-native-screens react-native-safe-area-context
- to install
tab
based navigation run:npm install @react-navigation/bottom-tabs
This allows us to get the geolaction of device the app is running on.
- run
npx expo install expo-location
to store secrets/ API keys we use a .env
file in project root
- run:
npm install -D react-native-dotenv
- open
babel.config.js
and edit file under 'presets' add the followingplugins: ['module:react-native-dotenv']
- create a
.env
file in project root
NOTE: we dont want to commit our secrests - so don't forget to add this to .gitignore
date and time stamps usually need formatting - moment
tool does this
- run
npm install moment --save
NOTE: moment is stale - it's own github page recommends to juse a different lib - find a better lib for future projects
this projects is only a 3 page app - so it uses props - look into react context
for future projects that need to pass data around many pages or often (eg. if passing a users name to lots of pages, or passing value deep into page tree)
see: https://react.dev/learn/passing-data-deeply-with-context
@TODO: currently not setup correctly - obviously the examples i used are out of date - so look into a new, better method.
-
while in the project dir
-
run
npm install eslint --save-dev
to install eslint and other node_modules into the project -
initialize eslint by running
npx eslint --init
- click enter for all default setting prompts - this will eventually create aeslintrc.js
file at the root of the project folder -
now run
npm install @react-native-community/eslint-config --save-dev
-
add some new rules to
eslintrc.js
file underextends:
add "@react-native-community"under
rules
add semi: ['error', 'never'], 'comma-dangle': [2, 'never'], 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], 'no-use-before-define': [ 'error', { functions: true, classes: true, variables: false } ] -
install prettier: run
npm install --save-dev --save-exact prettier
-
once complete, run
touch prettierrc.js
to create the prettierrc.js file -
add the following to the file module.exports = { bracketSpacing: true, singleQuote: true, tabWidth: 4, useTabs: false, trailingComma: "none", semi: false };
-
update
package.json
- underscripts
add"lint": "eslint ."
-
run
npm run lint