Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_BASE_URL=
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ local.properties
#
node_modules/
npm-debug.log
package-lock.json
yarn-error.log

# fastlane
Expand Down Expand Up @@ -66,6 +67,9 @@ yarn-error.log
# testing
/coverage

# Env
.env

# Yarn
.yarn/*
!.yarn/patches
Expand Down
13 changes: 5 additions & 8 deletions android/app/src/main/java/com/herbarioapp/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package com.herbarioapp

import android.os.Bundle
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

class MainActivity : ReactActivity() {

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null)
}

override fun getMainComponentName(): String = "HerbarioApp"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}
7 changes: 6 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: [
'@babel/plugin-transform-export-namespace-from',
[
'babel-plugin-module-resolver', {
root: ['./src'],
alias: {
'@': './',
'@': './src',
},
}
],
['module:react-native-dotenv', {
moduleName: '@env',
path: '.env',
}]
],
};
6 changes: 5 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = {
preset: 'react-native',
setupFiles: ['<rootDir>/jest.setup.js'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
}
},
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?|@react-navigation|react-native-screens|react-native-safe-area-context)/)',
],
}
23 changes: 23 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
jest.mock('@env', () => ({
API_BASE_URL: 'http://localhost/api',
}), { virtual: true })

jest.mock('@react-native-async-storage/async-storage', () => {
const store = new Map()

return {
__esModule: true,
default: {
getItem: async (key) => (store.has(key) ? store.get(key) : null),
setItem: async (key, value) => {
store.set(key, value)
},
removeItem: async (key) => {
store.delete(key)
},
clear: async () => {
store.clear()
},
},
}
})
Loading