Skip to content

Commit

Permalink
setup react native app for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwolfe committed Oct 2, 2022
1 parent 743ee8c commit 062c488
Show file tree
Hide file tree
Showing 17 changed files with 24,587 additions and 4,739 deletions.
4 changes: 4 additions & 0 deletions .expo-shared/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
lib/
node_modules/
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# macOS
.DS_Store
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

5 changes: 5 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function App() {
return null;
}

export default App;
5 changes: 5 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"expo": {
"entryPoint": "node_modules/expo/AppEntry.js"
}
}
Binary file added assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = function (api) {
api.cache(true);

return {
presets: ['babel-preset-expo', 'module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
root: ['.'],
extensions: [
'.ios.ts',
'.android.ts',
'.ts',
'.ios.tsx',
'.android.tsx',
'.tsx',
'.jsx',
'.js',
'.json',
],
alias: {
components: './src/components',
},
},
],
],
};
};
3 changes: 3 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type Undefined<T> = T | undefined;

type Nullable<T> = T | null;
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
23 changes: 23 additions & 0 deletions inject-env-variables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Constants from 'expo-constants';

const DEVELOPMENT_BASE_URL = `http://${Constants.manifest?.debuggerHost?.split(':').shift()}:3000`;

const DEVELOPMENT = {
NEXT_PUBLIC_BACKEND_URL: `${DEVELOPMENT_BASE_URL}/api`,
};

const PRODUCTION = {
NEXT_PUBLIC_BACKEND_URL: 'https://climb-tracker.com/api',
};

if (process.env.NODE_ENV === 'development') {
process.env = {
...process.env,
...DEVELOPMENT,
};
} else {
process.env = {
...process.env,
...PRODUCTION,
};
}
Loading

0 comments on commit 062c488

Please sign in to comment.