├── .huskyrc.yml ├── .prettierignore ├── __mocks__ └── fileMock.ts ├── babel.config.cjs ├── packages ├── docs │ ├── package.json │ ├── dark-mode.md │ └── dev-setup.md ├── null │ ├── index.ts │ ├── tsconfig.json │ └── package.json ├── app │ ├── assets │ │ ├── images │ │ │ ├── icon.png │ │ │ ├── splash.png │ │ │ ├── favicon.png │ │ │ ├── background.dark.jpg │ │ │ ├── background.dark.png │ │ │ ├── background.light.jpg │ │ │ └── background.light.png │ │ └── fonts │ │ │ └── SpaceMono-Regular.ttf │ ├── metro.config.js │ ├── tsconfig.json │ ├── @types │ │ ├── jpg.d.ts │ │ └── png.d.ts │ ├── ios │ │ └── sentry.properties │ ├── android │ │ └── sentry.properties │ ├── src │ │ ├── hooks │ │ │ ├── useNetwork.ts │ │ │ ├── useConfig.ts │ │ │ ├── useQuestionsNetworkContext.ts │ │ │ ├── useColorScheme.web.ts │ │ │ ├── useColorScheme.ts │ │ │ ├── useThemeColor.ts │ │ │ └── useCachedResources.ts │ │ ├── __generated__ │ │ │ └── AppEntry.js │ │ ├── context.ts │ │ ├── store │ │ │ ├── store.ts │ │ │ └── slices │ │ │ │ ├── __tests__ │ │ │ │ └── fruits.spec.ts │ │ │ │ └── questions.ts │ │ ├── components │ │ │ ├── Space.tsx │ │ │ ├── View.tsx │ │ │ ├── Text.tsx │ │ │ ├── Background.tsx │ │ │ ├── BaseLayout.tsx │ │ │ ├── Button.tsx │ │ │ ├── ResultListItem.tsx │ │ │ └── FruitCard.tsx │ │ ├── screens │ │ │ ├── NotFoundScreen.tsx │ │ │ ├── Landing.tsx │ │ │ └── Screen.tsx │ │ ├── ui.ts │ │ ├── containers │ │ │ └── AppContainer.tsx │ │ └── navigation │ │ │ └── index.tsx │ ├── __tests__ │ │ └── App.spec.tsx │ ├── .expo-shared │ │ └── assets.json │ ├── app.json │ ├── package.json │ ├── App.tsx │ └── jest.config.cjs ├── scripts │ ├── postInstall.sh │ └── package.json ├── utils │ ├── tsconfig.json │ ├── package.json │ └── index.ts ├── config │ ├── tsconfig.json │ ├── package.json │ └── index.ts └── babel │ ├── package.json │ └── index.js ├── test ├── __tests__ │ └── setup.spec.ts ├── teardown.ts ├── setup.ts └── setupTestFramework.ts ├── jest.config.js ├── .prettierrc.yml ├── .eslintignore ├── .lintstagedrc.yml ├── codecov.yml ├── LICENSE ├── package.json ├── .github └── workflows │ └── nodejs.yml ├── .gitignore ├── README.md ├── .eslintrc.yml └── tsconfig.json /.huskyrc.yml: -------------------------------------------------------------------------------- 1 | hooks: 2 | pre-commit: yarn lint-staged 3 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | packages/app/src/__generated__/**/*.js 2 | -------------------------------------------------------------------------------- /__mocks__/fileMock.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-default-export */ 2 | 3 | export default 'test-file-stub' 4 | -------------------------------------------------------------------------------- /babel.config.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | const config = require('@expoBoiler/babel') 3 | 4 | module.exports = config 5 | -------------------------------------------------------------------------------- /packages/docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@expoBoiler/dcos", 3 | "version": "0.0.1", 4 | "license": "MIT" 5 | } 6 | -------------------------------------------------------------------------------- /packages/null/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 'Use this package null as a boilerplate for others' 3 | */ 4 | export const value = null 5 | -------------------------------------------------------------------------------- /test/__tests__/setup.spec.ts: -------------------------------------------------------------------------------- 1 | describe('Jest', () => { 2 | it('works', () => { 3 | expect(2).toBe(2) 4 | }) 5 | }) 6 | -------------------------------------------------------------------------------- /packages/app/assets/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/images/icon.png -------------------------------------------------------------------------------- /packages/app/assets/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/images/splash.png -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-default-export */ 2 | export default { 3 | projects: ['/packages/app'], 4 | } 5 | -------------------------------------------------------------------------------- /packages/app/assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/images/favicon.png -------------------------------------------------------------------------------- /packages/app/assets/fonts/SpaceMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/fonts/SpaceMono-Regular.ttf -------------------------------------------------------------------------------- /packages/app/assets/images/background.dark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/images/background.dark.jpg -------------------------------------------------------------------------------- /packages/app/assets/images/background.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/images/background.dark.png -------------------------------------------------------------------------------- /packages/app/assets/images/background.light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/images/background.light.jpg -------------------------------------------------------------------------------- /packages/app/assets/images/background.light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tcodes0/expo-boiler-oss/HEAD/packages/app/assets/images/background.light.png -------------------------------------------------------------------------------- /test/teardown.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-default-export */ 2 | 3 | export default async () => { 4 | console.log(`\n# TEST TEARDOWN #`) 5 | } 6 | -------------------------------------------------------------------------------- /packages/scripts/postInstall.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | yarn workspace @expoBoiler/app expo-yarn-workspaces postinstall 4 | 5 | echo "Post install done" 6 | -------------------------------------------------------------------------------- /packages/utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "rootDir": "." 4 | }, 5 | "extends": "../../tsconfig.json", 6 | "include": ["."] 7 | } 8 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | bracketSpacing: true 2 | jsxBracketSameLine: false 3 | semi: false 4 | singleQuote: true 5 | trailingComma: 'es5' 6 | printWidth: 120 7 | arrowParens: 'avoid' 8 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | packages/app/src/__generated__/**/*.js 2 | packages/app/node_modules/**/*ts 3 | packages/app/node_modules/**/*js 4 | **/node_modules/**/* 5 | **/node_modules/@types/**/* 6 | -------------------------------------------------------------------------------- /.lintstagedrc.yml: -------------------------------------------------------------------------------- 1 | "*.{ts,tsx,js,cjs,mjs,jsx}": 2 | - yarn lint:staged 3 | - yarn prettier --write 4 | package.json: 5 | - yarn sort-package-json 6 | - yarn prettier --write 7 | -------------------------------------------------------------------------------- /packages/app/metro.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | const { createMetroConfiguration } = require('expo-yarn-workspaces') 3 | 4 | module.exports = createMetroConfiguration(__dirname) 5 | -------------------------------------------------------------------------------- /packages/app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "rootDir": "." 4 | }, 5 | "extends": "../../tsconfig.json", 6 | "exclude": ["node_modules"], 7 | "include": ["."] 8 | } 9 | -------------------------------------------------------------------------------- /packages/scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@expoBoiler/scripts", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "scripts": { 6 | "postinstall": "./postInstall.sh" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/null/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "rootDir": "." 4 | }, 5 | "extends": "../../tsconfig.json", 6 | "exclude": ["node_modules"], 7 | "include": [".", "index.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/app/@types/jpg.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.jpg' { 3 | import { ImageSourcePropType } from 'react-native' 4 | const Image: ImageSourcePropType 5 | export default Image 6 | } 7 | -------------------------------------------------------------------------------- /packages/app/@types/png.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.png' { 3 | import { ImageSourcePropType } from 'react-native' 4 | const Image: ImageSourcePropType 5 | export default Image 6 | } 7 | -------------------------------------------------------------------------------- /packages/app/ios/sentry.properties: -------------------------------------------------------------------------------- 1 | defaults.url=https://sentry.io/ 2 | defaults.org=thom-org 3 | defaults.project=react-native 4 | auth.token=78593d0da490488981f2e8649cbf40a153eb9924123c451b9efba064b74c9389 5 | -------------------------------------------------------------------------------- /packages/config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "rootDir": "." 4 | }, 5 | "extends": "../../tsconfig.json", 6 | "exclude": ["node_modules"], 7 | "include": [".", "index.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/app/android/sentry.properties: -------------------------------------------------------------------------------- 1 | defaults.url=https://sentry.io/ 2 | defaults.org=thom-org 3 | defaults.project=react-native 4 | auth.token=78593d0da490488981f2e8649cbf40a153eb9924123c451b9efba064b74c9389 5 | -------------------------------------------------------------------------------- /packages/app/src/hooks/useNetwork.ts: -------------------------------------------------------------------------------- 1 | import useSWR, { ConfigInterface } from 'swr' 2 | 3 | export function useNetwork(url: string, config?: ConfigInterface) { 4 | return useSWR(url, fetch, config) 5 | } 6 | -------------------------------------------------------------------------------- /packages/app/src/hooks/useConfig.ts: -------------------------------------------------------------------------------- 1 | import { ConfigContext } from '@expoBoiler/app/src/context' 2 | import * as React from 'react' 3 | 4 | export function useConfig() { 5 | return React.useContext(ConfigContext) 6 | } 7 | -------------------------------------------------------------------------------- /packages/null/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@expoBoiler/null", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "type": "module", 6 | "main": "index.js", 7 | "module": "index.ts", 8 | "dependencies": {} 9 | } 10 | -------------------------------------------------------------------------------- /packages/utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@expoBoiler/utils", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "type": "module", 6 | "main": "index.ts", 7 | "module": "index.ts", 8 | "dependencies": {} 9 | } 10 | -------------------------------------------------------------------------------- /test/setup.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-default-export */ 2 | 3 | export default () => { 4 | console.log(`\n# TEST SETUP #`) 5 | 6 | // normalize timezone to UTC 7 | process.env.TZ = 'UTC' 8 | // add other envs here 9 | } 10 | -------------------------------------------------------------------------------- /packages/app/src/hooks/useQuestionsNetworkContext.ts: -------------------------------------------------------------------------------- 1 | import { TopLevelDataContext } from '@expoBoiler/app/src/context' 2 | import * as React from 'react' 3 | 4 | export function useTopLevelDataContext() { 5 | return React.useContext(TopLevelDataContext) 6 | } 7 | -------------------------------------------------------------------------------- /packages/config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@expoBoiler/config", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "type": "module", 6 | "main": "index.ts", 7 | "module": "index.ts", 8 | "dependencies": {}, 9 | "devDependencies": {} 10 | } 11 | -------------------------------------------------------------------------------- /packages/app/__tests__/App.spec.tsx: -------------------------------------------------------------------------------- 1 | import App from '@expoBoiler/app/App' 2 | import React from 'react' 3 | import { render } from 'react-native-testing-library' 4 | 5 | describe('App', () => { 6 | it("doesn't crash", () => { 7 | render() 8 | }) 9 | }) 10 | -------------------------------------------------------------------------------- /packages/app/src/hooks/useColorScheme.web.ts: -------------------------------------------------------------------------------- 1 | // useColorScheme from react-native does not support web currently. You can replace 2 | // this with react-native-appearance if you would like theme support on web. 3 | export function useColorScheme() { 4 | return 'light' 5 | } 6 | -------------------------------------------------------------------------------- /packages/app/src/__generated__/AppEntry.js: -------------------------------------------------------------------------------- 1 | // @generated by expo-yarn-workspaces 2 | 3 | import { registerRootComponent } from 'expo'; 4 | import { activateKeepAwake } from 'expo-keep-awake'; 5 | 6 | import App from '../../App'; 7 | 8 | if (__DEV__) { 9 | activateKeepAwake(); 10 | } 11 | 12 | registerRootComponent(App); 13 | -------------------------------------------------------------------------------- /packages/babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@expoBoiler/babel", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "main": "index.js", 6 | "dependencies": { 7 | "@babel/core": "7.11.1", 8 | "@babel/preset-env": "7.11.0", 9 | "@babel/preset-typescript": "7.10.4", 10 | "babel-preset-expo": "~8.2.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/app/.expo-shared/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "e997a5256149a4b76e6bfd6cbf519c5e5a0f1d278a3d8fa1253022b03c90473b": true, 3 | "af683c96e0ffd2cf81287651c9433fa44debc1220ca7cb431fe482747f34a505": true, 4 | "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, 5 | "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true 6 | } 7 | -------------------------------------------------------------------------------- /packages/app/src/context.ts: -------------------------------------------------------------------------------- 1 | import { config } from '@expoBoiler/config' 2 | import { createContext } from 'react' 3 | import { responseInterface } from 'swr' 4 | 5 | export type TTopLevelDataContext = responseInterface | null 6 | 7 | export const ConfigContext = createContext(config()) 8 | export const TopLevelDataContext = createContext(null) 9 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: yes 3 | 4 | coverage: 5 | precision: 2 6 | round: down 7 | range: '80...100' 8 | 9 | parsers: 10 | gcov: 11 | branch_detection: 12 | conditional: yes 13 | loop: yes 14 | method: no 15 | macro: no 16 | 17 | comment: 18 | layout: 'reach,diff,flags,tree' 19 | behavior: default 20 | require_changes: no 21 | -------------------------------------------------------------------------------- /packages/app/src/store/store.ts: -------------------------------------------------------------------------------- 1 | import { listReducer, ListState } from '@expoBoiler/app/src/store/slices/questions' 2 | import { configureStore } from '@reduxjs/toolkit' 3 | import { createLogger } from 'redux-logger' 4 | 5 | export type State = { 6 | list: ListState 7 | } 8 | 9 | export const store = configureStore({ 10 | middleware: [createLogger()], 11 | reducer: { 12 | list: listReducer, 13 | }, 14 | }) 15 | -------------------------------------------------------------------------------- /packages/docs/dark-mode.md: -------------------------------------------------------------------------------- 1 | ## Dark and light mode 2 | 3 | This app uses react-native's `Appearance.getColorScheme()` and two themes to switch colors matching the phone OS 4 | 5 | ### iOS Simulator 6 | 7 | To change OS theme (requires iOS 13+) do 8 | 9 | `Settings > Developer > Dark appearance toggle` 10 | 11 | ### Android Emulator 12 | 13 | To change OS theme (requires Android 9+) do 14 | 15 | `Settings > Display > Dark theme toggle` 16 | 17 | The app should adapt itself 18 | -------------------------------------------------------------------------------- /packages/app/src/hooks/useColorScheme.ts: -------------------------------------------------------------------------------- 1 | import { ColorSchemeName, useColorScheme as _useColorScheme } from 'react-native' 2 | 3 | // The useColorScheme value is always either light or dark, but the built-in 4 | // type suggests that it can be null. This will not happen in practice, so this 5 | // makes it a bit easier to work with. 6 | export function useColorScheme(): NonNullable { 7 | const scheme = _useColorScheme() as NonNullable 8 | return scheme 9 | } 10 | -------------------------------------------------------------------------------- /packages/app/src/components/Space.tsx: -------------------------------------------------------------------------------- 1 | import * as ui from '@expoBoiler/app/src/ui' 2 | import * as React from 'react' 3 | import { View } from 'react-native' 4 | 5 | export const Space: React.FC<{ width?: number | string; height?: number | string; style?: View['props'] }> = ({ 6 | width, 7 | height, 8 | style, 9 | ...props 10 | }) => ( 11 | 15 | ) 16 | -------------------------------------------------------------------------------- /packages/app/src/hooks/useThemeColor.ts: -------------------------------------------------------------------------------- 1 | import { useColorScheme } from '@expoBoiler/app/src/hooks/useColorScheme' 2 | import { colors } from '@expoBoiler/app/src/ui' 3 | 4 | export function useThemeColor( 5 | props: { light?: string; dark?: string }, 6 | colorName: keyof typeof colors.light & keyof typeof colors.dark 7 | ) { 8 | const theme = useColorScheme() 9 | const colorFromProps = props[theme] 10 | 11 | if (colorFromProps) { 12 | return colorFromProps 13 | } 14 | return colors[theme][colorName] 15 | } 16 | -------------------------------------------------------------------------------- /packages/babel/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | const plugins = [] 4 | const presets = [] 5 | 6 | /** 7 | * Presets 8 | */ 9 | presets.push([ 10 | '@babel/preset-env', 11 | { 12 | targets: { 13 | node: 'current', 14 | }, 15 | }, 16 | ]) 17 | presets.push([ 18 | 'babel-preset-expo', 19 | { 20 | lazyImports: true, 21 | }, 22 | ]) 23 | presets.push('@babel/preset-typescript') 24 | 25 | /** 26 | * Plugins 27 | */ 28 | 29 | if (process.env.NODE_ENV === 'test') { 30 | // do something if test 31 | } 32 | 33 | module.exports = { 34 | presets, 35 | plugins, 36 | } 37 | -------------------------------------------------------------------------------- /packages/app/src/components/View.tsx: -------------------------------------------------------------------------------- 1 | import { useThemeColor } from '@expoBoiler/app/src/hooks/useThemeColor' 2 | import { ThemeProps } from '@expoBoiler/utils' 3 | import * as React from 'react' 4 | import { View as DefaultView } from 'react-native' 5 | 6 | export type ViewProps = ThemeProps & DefaultView['props'] 7 | 8 | export function View(props: ViewProps) { 9 | const { style, lightColor, darkColor, ...otherProps } = props 10 | const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background') 11 | 12 | return 13 | } 14 | -------------------------------------------------------------------------------- /packages/app/src/components/Text.tsx: -------------------------------------------------------------------------------- 1 | import { useThemeColor } from '@expoBoiler/app/src/hooks/useThemeColor' 2 | import { fontFamily } from '@expoBoiler/app/src/ui' 3 | import { ThemeProps } from '@expoBoiler/utils' 4 | import * as React from 'react' 5 | import { Text as DefaultText } from 'react-native' 6 | 7 | export type TextProps = ThemeProps & DefaultText['props'] 8 | 9 | export function Text(props: TextProps) { 10 | const { style, lightColor, darkColor, ...otherProps } = props 11 | const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text') 12 | 13 | return 14 | } 15 | -------------------------------------------------------------------------------- /packages/app/src/components/Background.tsx: -------------------------------------------------------------------------------- 1 | import backgroundDark from '@expoBoiler/app/assets/images/background.dark.png' 2 | import backgroundLight from '@expoBoiler/app/assets/images/background.light.png' 3 | import { useColorScheme } from '@expoBoiler/app/src/hooks/useColorScheme' 4 | import { useConfig } from '@expoBoiler/app/src/hooks/useConfig' 5 | import { JSObject } from '@expoBoiler/utils' 6 | import * as React from 'react' 7 | import { ImageBackground } from 'react-native' 8 | 9 | export const Background: React.FC = () => { 10 | const { layout } = useConfig() 11 | const dark = useColorScheme() === 'dark' 12 | 13 | return ( 14 | 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /test/setupTestFramework.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-default-export, @typescript-eslint/no-var-requires */ 2 | 3 | // import '@testing-library/jest-native/extend-expect'; 4 | 5 | // global.fetch = require('jest-fetch-mock'); 6 | // global.WebSocket = require('ws'); 7 | 8 | import 'react-native-gesture-handler/jestSetup' 9 | import fetchMock from 'jest-fetch-mock' 10 | 11 | // jest.mock('react-native-reanimated', () => { 12 | // const Reanimated = require('react-native-reanimated/mock') 13 | 14 | // // The mock for `call` immediately calls the callback which is incorrect 15 | // // So we override it with a no-op 16 | // Reanimated.default.call = () => {} 17 | 18 | // return Reanimated 19 | // }) 20 | 21 | // Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing 22 | jest.mock('react-native/Libraries/Animated/src/NativeAnimatedHelper') 23 | 24 | // @ts-ignore mocking 25 | global.fetch = fetchMock 26 | -------------------------------------------------------------------------------- /packages/app/src/store/slices/__tests__/fruits.spec.ts: -------------------------------------------------------------------------------- 1 | import { listReducer } from '@expoBoiler/app/src/store/slices/questions' 2 | import { Fruits } from '@expoBoiler/utils' 3 | 4 | describe('list reducer has some lists, one of them is a list of fruits', () => { 5 | it('initial state', () => { 6 | const initialState = listReducer(undefined, { type: 'init' }) 7 | expect(Object.keys(initialState.fruits).length).toBe(2) 8 | }) 9 | it('addFruit actions adds fruits in state', () => { 10 | const payload: Fruits = Fruits.avocado 11 | const result = listReducer(undefined, { type: 'list/addFruit', payload }) 12 | expect(result.fruits.includes(Fruits.avocado)).toBe(true) 13 | }) 14 | it('removeFruit actions removes fruits from state', () => { 15 | const payload: Fruits = Fruits.apple 16 | const result = listReducer(undefined, { type: 'list/removeFruit', payload }) 17 | expect(result.fruits.includes(Fruits.apple)).toBe(false) 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/app/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "app", 4 | "slug": "app", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/images/icon.png", 8 | "scheme": "myapp", 9 | "userInterfaceStyle": "automatic", 10 | "splash": { 11 | "image": "./assets/images/splash.png", 12 | "resizeMode": "contain", 13 | "backgroundColor": "#117eeb" 14 | }, 15 | "updates": { 16 | "fallbackToCacheTimeout": 0 17 | }, 18 | "assetBundlePatterns": ["**/*"], 19 | "ios": { 20 | "supportsTablet": true 21 | }, 22 | "web": { 23 | "favicon": "./assets/images/favicon.png" 24 | }, 25 | "hooks": { 26 | "postPublish": [ 27 | { 28 | "file": "sentry-expo/upload-sourcemaps", 29 | "config": { 30 | "organization": "@expoBoiler", 31 | "project": "mobile", 32 | "authToken": "your auth token here" 33 | } 34 | } 35 | ] 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/utils/index.ts: -------------------------------------------------------------------------------- 1 | export type TypedFunction = (...args: Args) => Return 2 | export type TypedAsyncFunction> = (...args: Args) => Promise 3 | export type JSObject = Record 4 | 5 | export const isTest = () => process.env.NODE_ENV === 'test' 6 | export const isDev = () => __DEV__ 7 | 8 | export type RootNavigatorKeys = { 9 | Root: undefined 10 | Screen: undefined 11 | NotFound: undefined 12 | } 13 | 14 | export enum Fruits { 15 | apple = 'apple', 16 | banana = 'banana', 17 | avocado = 'avocado', 18 | pear = 'pear', 19 | } 20 | 21 | export type BottomTabParamList = { 22 | TabOne: undefined 23 | TabTwo: undefined 24 | } 25 | 26 | export type TabOneParamList = { 27 | TabOneScreen: undefined 28 | } 29 | 30 | export type TabTwoParamList = { 31 | TabTwoScreen: undefined 32 | } 33 | 34 | export type ThemeProps = { 35 | lightColor?: string 36 | darkColor?: string 37 | } 38 | -------------------------------------------------------------------------------- /packages/app/src/store/slices/questions.ts: -------------------------------------------------------------------------------- 1 | import { State } from '@expoBoiler/app/src/store/store' 2 | import { Fruits } from '@expoBoiler/utils' 3 | import { createSlice, SliceCaseReducers } from '@reduxjs/toolkit' 4 | 5 | export type ListState = { 6 | fruits: Fruits[] 7 | } 8 | 9 | const initialState = { 10 | fruits: [Fruits.banana, Fruits.apple], 11 | } 12 | 13 | export const listSlice = createSlice>({ 14 | name: 'list', 15 | initialState, 16 | reducers: { 17 | addFruit: (state, act) => { 18 | state.fruits.push(act.payload) 19 | }, 20 | removeFruit: (state, act) => { 21 | const index = state.fruits.findIndex(fruit => fruit === act.payload) 22 | if (index === -1) { 23 | return 24 | } 25 | state.fruits.splice(index, index + 1) 26 | }, 27 | }, 28 | }) 29 | 30 | export const action = listSlice.actions 31 | 32 | export const select = { 33 | fruits: (state: State) => state.list.fruits, 34 | } 35 | 36 | export const listReducer = listSlice.reducer 37 | -------------------------------------------------------------------------------- /packages/app/src/components/BaseLayout.tsx: -------------------------------------------------------------------------------- 1 | import { useThemeColor } from '@expoBoiler/app/src/hooks/useThemeColor' 2 | import * as ui from '@expoBoiler/app/src/ui' 3 | import { ThemeProps } from '@expoBoiler/utils' 4 | import * as React from 'react' 5 | import { View } from 'react-native' 6 | import { SafeAreaView } from 'react-native-safe-area-context' 7 | 8 | export type BaseLayoutProps = ThemeProps & View['props'] 9 | 10 | export function BaseLayout(props: BaseLayoutProps) { 11 | const { style, lightColor, darkColor, ...otherProps } = props 12 | const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background') 13 | 14 | return ( 15 | 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /packages/app/src/hooks/useCachedResources.ts: -------------------------------------------------------------------------------- 1 | import { Ionicons } from '@expo/vector-icons' 2 | import * as Font from 'expo-font' 3 | import * as SplashScreen from 'expo-splash-screen' 4 | import * as React from 'react' 5 | 6 | export function useCachedResources() { 7 | const [isLoadingComplete, setLoadingComplete] = React.useState(false) 8 | 9 | // Load any resources or data that we need prior to rendering the app 10 | React.useEffect(() => { 11 | async function loadResourcesAndDataAsync() { 12 | try { 13 | SplashScreen.preventAutoHideAsync() 14 | 15 | // Load fonts 16 | await Font.loadAsync({ 17 | ...Ionicons.font, 18 | 'space-mono': require('@expoBoiler/app/assets/fonts/SpaceMono-Regular.ttf'), 19 | }) 20 | } catch (e) { 21 | // We might want to provide this error information to an error reporting service 22 | console.warn(e) 23 | } finally { 24 | setLoadingComplete(true) 25 | SplashScreen.hideAsync() 26 | } 27 | } 28 | 29 | loadResourcesAndDataAsync() 30 | }, []) 31 | 32 | return isLoadingComplete 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Thom 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/app/src/screens/NotFoundScreen.tsx: -------------------------------------------------------------------------------- 1 | import { RootNavigatorKeys } from '@expoBoiler/utils' 2 | import { StackScreenProps } from '@react-navigation/stack' 3 | import * as React from 'react' 4 | import { StyleSheet, Text, TouchableOpacity, View } from 'react-native' 5 | 6 | const styles = StyleSheet.create({ 7 | container: { 8 | flex: 1, 9 | backgroundColor: '#fff', 10 | alignItems: 'center', 11 | justifyContent: 'center', 12 | padding: 20, 13 | }, 14 | title: { 15 | fontSize: 20, 16 | fontWeight: 'bold', 17 | }, 18 | link: { 19 | marginTop: 15, 20 | paddingVertical: 15, 21 | }, 22 | linkText: { 23 | fontSize: 14, 24 | color: '#2e78b7', 25 | }, 26 | }) 27 | 28 | export function NotFoundScreen({ navigation }: StackScreenProps) { 29 | return ( 30 | 31 | This screen doesn't exist. 32 | navigation.replace('Root')} style={styles.link}> 33 | Go to home screen! 34 | 35 | 36 | ) 37 | } 38 | -------------------------------------------------------------------------------- /packages/app/src/components/Button.tsx: -------------------------------------------------------------------------------- 1 | import { useColorScheme } from '@expoBoiler/app/src/hooks/useColorScheme' 2 | import * as ui from '@expoBoiler/app/src/ui' 3 | import { ThemeProps, JSObject } from '@expoBoiler/utils' 4 | import * as React from 'react' 5 | import { StyleProp, TextStyle } from 'react-native' 6 | import { Button as PaperButton } from 'react-native-paper' 7 | import { useTheme } from 'styled-components' 8 | import { Text } from './Text' 9 | 10 | export type ButtonProps = ThemeProps & { 11 | textStyle?: StyleProp 12 | title: string 13 | } 14 | 15 | const defaulTextStyle = { 16 | fontFamily: ui.fontFamily['600'], 17 | padding: ui.w(2), 18 | fontSize: ui.w(5), 19 | } 20 | 21 | const defaulButtonStyle = { 22 | padding: ui.w(1), 23 | borderRadius: ui.w(5.3), 24 | } 25 | 26 | export function Button(props: JSObject & ButtonProps) { 27 | const { textStyle = {}, title, style, ...otherProps } = props 28 | const dark = useColorScheme() === 'dark' 29 | const theme = useTheme() 30 | 31 | return ( 32 | 39 | 40 | {title} 41 | 42 | 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /packages/app/src/components/ResultListItem.tsx: -------------------------------------------------------------------------------- 1 | import { FruitCard } from '@expoBoiler/app/src/components/FruitCard' 2 | import { Text } from '@expoBoiler/app/src/components/Text' 3 | import { colors } from '@expoBoiler/app/src/ui' 4 | import * as ui from '@expoBoiler/app/src/ui' 5 | import { Fruits } from '@expoBoiler/utils' 6 | import * as React from 'react' 7 | import { Appearance } from 'react-native' 8 | import styled from 'styled-components/native' 9 | import { Space } from './Space' 10 | 11 | const Fruit = styled(Text)` 12 | font-size: ${ui.wpx(5)}; 13 | text-align: left; 14 | ` 15 | interface PublicProps { 16 | item: Fruits 17 | } 18 | 19 | type Props = PublicProps 20 | 21 | const ResultListItemComponent: React.FC = ({ item }) => { 22 | const scheme = Appearance.getColorScheme() 23 | let theme: typeof colors.dark 24 | if (scheme) { 25 | theme = colors[scheme] 26 | } else { 27 | theme = colors.light 28 | } 29 | 30 | return ( 31 | <> 32 | 40 | {item} 41 | 42 | 43 | 44 | ) 45 | } 46 | 47 | export const ResultListItem = ResultListItemComponent as React.FC 48 | -------------------------------------------------------------------------------- /packages/docs/dev-setup.md: -------------------------------------------------------------------------------- 1 | # Dev setup 2 | 3 | ### 1 - Get the code 4 | 5 | clone from `https://github.com/Thomazella/managed-expo-boiler.git` 6 | 7 | ### 2 - Install dependencies 8 | 9 | run `yarn` at root. 10 | 11 | if you don't have yarn, [install it](https://classic.yarnpkg.com/en/docs/install#mac-stable) 12 | 13 | ## Android 14 | 15 | ### 3.1 - Create an emulator 16 | 17 | You can use the [AVD Manager feature of Android studio](https://developer.android.com/studio/run/managing-avds), or use the Android SDK direcly. 18 | 19 | Launch your emulator. 20 | 21 | If using Genymotion, run `adb connect ` ip is visible in window title bar 22 | 23 | run `yarn app:android`, expo should launch the app 24 | 25 | ## iOS 26 | 27 | ### 3.2 - iOS Simulator 28 | 29 | Install Xcode from App Store if you haven't already, make sure you have some simulators available. [See this](https://developer.apple.com/documentation/xcode/running_your_app_in_the_simulator_or_on_a_device) 30 | 31 | run `yarn app:ios`, expo should launch the simulator and the app 32 | 33 | ## Manually launching app 34 | 35 | ### 4 - In the terminal tab you used `yarn app` 36 | 37 | press `a` to launch in Android or `i` to launch in iOS 38 | 39 | press `?` for options 40 | 41 | ## Node version 42 | 43 | Use any 10x, 12x or 14x version 44 | 45 | ```bash 46 | expo-cli supports following Node.js versions: 47 | * >=10.13.0 <11.0.0 (Maintenance LTS) 48 | * >=12.13.0 <13.0.0 (Active LTS) 49 | * >=14.0.0 <15.0.0 (Current Release) 50 | ``` 51 | -------------------------------------------------------------------------------- /packages/app/src/components/FruitCard.tsx: -------------------------------------------------------------------------------- 1 | import { View } from '@expoBoiler/app/src/components/View' 2 | import * as ui from '@expoBoiler/app/src/ui' 3 | import { ThemeProps, JSObject } from '@expoBoiler/utils' 4 | import * as React from 'react' 5 | import { StyleProp, ViewStyle } from 'react-native' 6 | import { Card } from 'react-native-paper' 7 | import styled, { useTheme } from 'styled-components/native' 8 | 9 | export type QuestionCardProps = ThemeProps & { 10 | style?: StyleProp 11 | contentStyle?: StyleProp 12 | } 13 | 14 | const CardWrapper = styled(View)` 15 | justify-content: flex-start; 16 | align-items: center; 17 | width: ${ui.wpx(88)}; 18 | ` 19 | 20 | const defaultCardContentStyle = { 21 | justifyContent: 'space-between', 22 | alignItems: 'flex-start', 23 | flex: 1, 24 | } as const 25 | 26 | export function FruitCard(props: JSObject & QuestionCardProps) { 27 | const { style, contentStyle, children, ...otherProps } = props 28 | const theme = useTheme() 29 | 30 | return ( 31 | 32 | 45 | {children} 46 | 47 | 48 | ) 49 | } 50 | -------------------------------------------------------------------------------- /packages/app/src/ui.ts: -------------------------------------------------------------------------------- 1 | import { widthPercentageToDP, heightPercentageToDP } from 'react-native-responsive-screen' 2 | import 'styled-components' 3 | 4 | /** 5 | * return a number % of screen width 6 | */ 7 | export const w = widthPercentageToDP 8 | /** 9 | * return a number % of screen height 10 | */ 11 | export const h = heightPercentageToDP 12 | /** 13 | * return a string % of screen height + "px" 14 | */ 15 | export const hpx = (n: string | number) => `${heightPercentageToDP(n)}px` 16 | /** 17 | * return a string % of screen width + "px" 18 | */ 19 | export const wpx = (n: string | number) => `${widthPercentageToDP(n)}px` 20 | export const fontFamily = { 21 | 300: 'TitilliumWeb_300Light', 22 | 400: 'TitilliumWeb_400Regular', 23 | 600: 'TitilliumWeb_600SemiBold', 24 | } 25 | const darkColors = { 26 | text: '#eceeef', 27 | background: '#252c4a', 28 | cardBackground: '#1A1E33', 29 | notImportantBackground1: '#979BA6', 30 | notImportantBackground2: '#ACB0BD', 31 | correct: '#15B35F', 32 | incorrect: '#F03A52', 33 | interactive: '#117eeb', 34 | } 35 | 36 | const lightColors = { 37 | ...darkColors, 38 | text: '#333333', 39 | background: '#fafafa', 40 | notImportantBackground2: darkColors.notImportantBackground1, 41 | cardBackground: '#f6f6f6', 42 | correct: '#19d974', 43 | incorrect: '#ff3d58', 44 | interactive: '#1288FF', 45 | } 46 | export const colors = { 47 | light: lightColors, 48 | dark: darkColors, 49 | } 50 | 51 | declare module 'styled-components' { 52 | type MyTheme = typeof colors.dark 53 | // eslint-disable-next-line 54 | export interface DefaultTheme extends MyTheme {} 55 | } 56 | -------------------------------------------------------------------------------- /packages/app/src/containers/AppContainer.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | TitilliumWeb_300Light, 3 | TitilliumWeb_400Regular, 4 | TitilliumWeb_600SemiBold, 5 | } from '@expo-google-fonts/titillium-web' 6 | import { TopLevelDataContext } from '@expoBoiler/app/src/context' 7 | import { useCachedResources } from '@expoBoiler/app/src/hooks/useCachedResources' 8 | import { useColorScheme } from '@expoBoiler/app/src/hooks/useColorScheme' 9 | import { useConfig } from '@expoBoiler/app/src/hooks/useConfig' 10 | import { Navigation } from '@expoBoiler/app/src/navigation' 11 | import { JSObject } from '@expoBoiler/utils' 12 | import { useFonts } from 'expo-font' 13 | import * as React from 'react' 14 | import { useDispatch } from 'react-redux' 15 | 16 | type PublicProps = JSObject 17 | 18 | type Props = PublicProps 19 | 20 | const AppContainerComponent: React.FC = () => { 21 | const dispatch = useDispatch() 22 | const { 23 | /* access config here */ 24 | } = useConfig() 25 | React.useEffect(() => { 26 | /** 27 | * set up App mount logic here 28 | */ 29 | }, []) 30 | const colorScheme = useColorScheme() 31 | const isLoadingComplete = useCachedResources() 32 | let [fontsLoaded] = useFonts({ 33 | TitilliumWeb_300Light, 34 | TitilliumWeb_400Regular, 35 | TitilliumWeb_600SemiBold, 36 | }) 37 | 38 | if (!isLoadingComplete || !fontsLoaded) { 39 | return null 40 | } 41 | 42 | return ( 43 | 44 | 45 | 46 | ) 47 | } 48 | 49 | export const AppContainer = AppContainerComponent as React.FC 50 | -------------------------------------------------------------------------------- /packages/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@expoBoiler/app", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "main": "src/__generated__/AppEntry.js", 6 | "scripts": { 7 | "android": "expo start --android", 8 | "eject": "expo eject", 9 | "ios": "expo start --ios", 10 | "start": "expo start", 11 | "web": "expo start --web" 12 | }, 13 | "dependencies": { 14 | "@expo-google-fonts/titillium-web": "^0.1.0", 15 | "@expo/vector-icons": "^10.0.0", 16 | "@react-native-community/masked-view": "0.1.10", 17 | "@react-navigation/bottom-tabs": "^5.8.0", 18 | "@react-navigation/native": "^5.7.3", 19 | "@react-navigation/stack": "^5.9.0", 20 | "@reduxjs/toolkit": "^1.4.0", 21 | "expo": "~38.0.9", 22 | "expo-asset": "~8.1.7", 23 | "expo-constants": "~9.1.1", 24 | "expo-font": "~8.2.1", 25 | "expo-linking": "^1.0.3", 26 | "expo-splash-screen": "~0.3.1", 27 | "expo-status-bar": "^1.0.2", 28 | "expo-web-browser": "~8.3.1", 29 | "html-decoder": "1.0.2", 30 | "react": "~16.13.1", 31 | "react-dom": "~16.13.1", 32 | "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz", 33 | "react-native-gesture-handler": "~1.6.0", 34 | "react-native-paper": "^4.0.1", 35 | "react-native-responsive-screen": "^1.4.1", 36 | "react-native-safe-area-context": "~3.0.7", 37 | "react-native-screens": "~2.9.0", 38 | "react-native-vector-icons": "^7.0.0", 39 | "react-native-web": "~0.13.5", 40 | "react-redux": "^7.2.1", 41 | "sentry-expo": "2.1.2", 42 | "styled-components": "5.1.1", 43 | "swr": "^0.3.0" 44 | }, 45 | "devDependencies": { 46 | "@types/react-native": "0.63.4", 47 | "@types/react-redux": "7.1.9", 48 | "@types/redux-logger": "3.0.8", 49 | "@types/styled-components": "5.1.2", 50 | "expo-yarn-workspaces": "1.2.1", 51 | "metro-config": "0.61.0", 52 | "react-native-testing-library": "6.0.0", 53 | "react-test-renderer": "16.13.1", 54 | "redux-logger": "3.0.6" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /packages/config/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @expoBoiler/config injects configuration of the app, interacts and validates env 3 | */ 4 | import { Dimensions } from 'react-native' 5 | 6 | const questions = { 7 | amount: 10, 8 | difficulty: 'hard', 9 | type: 'boolean', 10 | } 11 | const results = { 12 | heading: 'You scored', 13 | buttonText: 'Play again?', 14 | } 15 | const landing = { 16 | heading: 'Welcome to the expoBoiler Challenge!', 17 | body: `You will be presented with ${questions.amount} true or false questions.`, 18 | punchLine: `Can you score 10/10 ?`, 19 | buttonText: 'Begin', 20 | } 21 | const apiUrl = 'opentdb.com/api.php' 22 | /** 23 | * Layout 24 | */ 25 | const width = Dimensions.get('window').width 26 | const height = Dimensions.get('window').height 27 | const layout = { 28 | window: { 29 | width, 30 | height, 31 | }, 32 | isSmallDevice: width < 375, 33 | } 34 | 35 | const dev = { 36 | questions, 37 | results, 38 | landing, 39 | apiUrl, 40 | layout, 41 | } 42 | 43 | export type expoBoilerConfig = typeof dev 44 | let configValue: expoBoilerConfig 45 | const prod = dev 46 | configValue = __DEV__ ? dev : prod 47 | 48 | /** 49 | * Valid expoBoiler configuration. Set by configure 50 | */ 51 | export function config() { 52 | return configValue 53 | } 54 | 55 | /** 56 | * Resets configuration to initial state 57 | */ 58 | export function unconfigure() { 59 | configValue = (null as unknown) as expoBoilerConfig 60 | } 61 | 62 | /**` 63 | * Validates and decouples essential configuration. 64 | * call first before doing anything else 65 | */ 66 | export function configure(envConfig: Partial) { 67 | const abort = (message: string) => { 68 | throw Error(`Invalid expoBoiler configuration: ${message}.`) 69 | } 70 | if (!envConfig) abort('required argument envConfig not passed') 71 | if (!envConfig.apiUrl) abort(`invalid apiUrl, received: "${envConfig.apiUrl}"`) 72 | /** 73 | * any other validation logic here 74 | */ 75 | const definedConfig = envConfig as expoBoilerConfig 76 | configValue = definedConfig 77 | } 78 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "expoBoiler", 3 | "version": "0.0.1", 4 | "private": true, 5 | "description": "technical showcase/boilerplate", 6 | "repository": "git@github.com:Thomazella/expo-boiler.git", 7 | "license": "MIT", 8 | "author": "Raphael Thomazella ", 9 | "type": "module", 10 | "workspaces": { 11 | "packages": [ 12 | "packages/*" 13 | ], 14 | "nohoist": [] 15 | }, 16 | "scripts": { 17 | "app:android": "cd ./packages/app && expo start --android", 18 | "app:eject": "expo eject", 19 | "app:ios": "cd ./packages/app && expo start --ios", 20 | "app:web": "expo start --web", 21 | "build": "yarn workspace @expoBoiler/cli build", 22 | "dev": "yarn workspace @expoBoiler/cli dev", 23 | "postinstall": "yarn workspace @expoBoiler/scripts postinstall", 24 | "lint": "eslint \"packages/**/*.ts*\"", 25 | "lint:fix": "eslint \"packages/**/*.ts*\" --fix", 26 | "lint:staged": "eslint --fix", 27 | "prettier": "prettier --write", 28 | "prettier:all": "prettier --write 'packages/**/*.[tj]s*'", 29 | "start": "expo start", 30 | "test": "jest" 31 | }, 32 | "dependencies": { 33 | "typescript": "3.9.7" 34 | }, 35 | "devDependencies": { 36 | "@types/jest": "26.0.9", 37 | "@types/node": "14.0.27", 38 | "@types/react": "~16.9.44", 39 | "@types/ws": "7.2.6", 40 | "@typescript-eslint/eslint-plugin": "3.8.0", 41 | "@typescript-eslint/parser": "3.8.0", 42 | "babel-eslint": "10.1.0", 43 | "babel-jest": "26.2.2", 44 | "eslint": "7.6.0", 45 | "eslint-import-resolver-typescript": "2.2.0", 46 | "eslint-plugin-import": "2.22.0", 47 | "eslint-plugin-jest": "23.20.0", 48 | "eslint-plugin-react": "7.20.5", 49 | "eslint-plugin-react-hooks": "4.0.8", 50 | "eslint-plugin-react-native": "3.8.1", 51 | "husky": "4.2.5", 52 | "jest": "26.2.2", 53 | "jest-fetch-mock": "3.0.3", 54 | "json5": "2.1.3", 55 | "lint-staged": "10.2.11", 56 | "prettier": "2.0.5", 57 | "rimraf": "3.0.2", 58 | "sort-package-json": "1.44.0", 59 | "ts-jest": "26.1.4" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /packages/app/src/navigation/index.tsx: -------------------------------------------------------------------------------- 1 | import { useConfig } from '@expoBoiler/app/src/hooks/useConfig' 2 | import { Landing } from '@expoBoiler/app/src/screens/Landing' 3 | import { NotFoundScreen } from '@expoBoiler/app/src/screens/NotFoundScreen' 4 | import { Screen } from '@expoBoiler/app/src/screens/Screen' 5 | import { RootNavigatorKeys } from '@expoBoiler/utils' 6 | import { NavigationContainer, DefaultTheme, DarkTheme } from '@react-navigation/native' 7 | import { createStackNavigator, CardStyleInterpolators } from '@react-navigation/stack' 8 | import * as Linking from 'expo-linking' 9 | import * as React from 'react' 10 | import { ColorSchemeName } from 'react-native' 11 | 12 | const Stack = createStackNavigator() 13 | const linkingConfig = { 14 | prefixes: [Linking.makeUrl('/')], 15 | config: { 16 | screens: { 17 | Root: 'Landing', 18 | Screen: 'Screen', 19 | NotFound: '*', 20 | }, 21 | }, 22 | } 23 | const transitionConfig = { 24 | animation: 'spring' as const, 25 | config: { 26 | stiffness: 1100, 27 | damping: 170, 28 | mass: 20, 29 | overshootClamping: true, 30 | restDisplacementThreshold: 1, 31 | restSpeedThreshold: 0.01, 32 | }, 33 | } 34 | 35 | function RootNavigator() { 36 | const { 37 | /* access config here */ 38 | } = useConfig() 39 | 40 | return ( 41 | 48 | 49 | 50 | 51 | 52 | ) 53 | } 54 | 55 | export function Navigation({ colorScheme }: { colorScheme: ColorSchemeName }) { 56 | return ( 57 | 58 | 59 | 60 | ) 61 | } 62 | -------------------------------------------------------------------------------- /packages/app/src/screens/Landing.tsx: -------------------------------------------------------------------------------- 1 | import { Background } from '@expoBoiler/app/src/components/Background' 2 | import { BaseLayout } from '@expoBoiler/app/src/components/BaseLayout' 3 | import { Button } from '@expoBoiler/app/src/components/Button' 4 | import { Space } from '@expoBoiler/app/src/components/Space' 5 | import { Text } from '@expoBoiler/app/src/components/Text' 6 | import { useConfig } from '@expoBoiler/app/src/hooks/useConfig' 7 | import { action } from '@expoBoiler/app/src/store/slices/questions' 8 | import * as ui from '@expoBoiler/app/src/ui' 9 | import { RootNavigatorKeys } from '@expoBoiler/utils' 10 | import { StackScreenProps } from '@react-navigation/stack' 11 | import * as React from 'react' 12 | import { useDispatch } from 'react-redux' 13 | import styled from 'styled-components/native' 14 | 15 | const Wrapper = styled(BaseLayout)` 16 | justify-content: flex-start; 17 | /* align-items: flex-start; */ 18 | ` 19 | const H1 = styled(Text)` 20 | font-size: ${ui.wpx(6)}; 21 | font-family: ${ui.fontFamily['600']}; 22 | color: ${p => p.theme.notImportantBackground2}; 23 | margin-left: ${ui.wpx(5)}; 24 | background-color: ${p => p.theme.background}; 25 | ` 26 | 27 | const Body = styled(Text)` 28 | font-size: ${ui.wpx(8.2)}; 29 | text-align: left; 30 | margin-left: ${ui.wpx(5)}; 31 | background-color: ${p => p.theme.background}; 32 | ` 33 | 34 | interface PublicProps {} 35 | 36 | interface Props extends PublicProps, StackScreenProps {} 37 | 38 | const LandingScreen: React.FC = ({ navigation }) => { 39 | const { 40 | /* access config here */ 41 | } = useConfig() 42 | const dispatch = useDispatch() 43 | 44 | return ( 45 | 46 | 47 | 48 |

This is a managed expo app boilerplate

49 | 50 | See Readme.md for features 51 | 52 |