Skip to content

Level-Studios: Example App with TypeScript & React Native in Expo (with Styled Components, ESLint etc.)

License

Notifications You must be signed in to change notification settings

levelstudiosuk/TypeScript-Reactnative-Example-App

Repository files navigation

Welcome!

Expo TS White-Label / Boilerplate

Specification

INSTALL

npm install 
// then
open -a Simulator; expo start --clear

Structures

app/
├─ .levelstudio // necessary if using levelstudio-cli
├─ .expo
├─ assets
│  └─ icons // app icons
│  └─ images // app images like background images
├─ node_modules/
├─ src/
│  └─ apis
│  └─ components
│     └─ navigations
│     └─ screen
│     └─ shared
│  └─ contexts
│  └─ utils
│  └─ App.tsx
├─ test/
├─ .buckconfig
├─ .flowconfig
├─ .gitattributes
├─ .gitignore
├─ .watchmanconfig
├─ app.json
├─ babel.config.js
├─ index.js
├─ jest.config.js
├─ package.json
├─ README.md
├─ STRINGS.js
├─ tsconfig.json
└─ tslint.json

Running the project

open -a Simulator; expo start --clear

Testing the project

Testing is also just a command away:

npm test

Result

> jest -u

 PASS  src/components/shared/__tests__/Button.test.tsx
 PASS  src/components/screen/__tests__/Intro.test.tsx
 › 2 snapshots written.

Snapshot Summary
 › 2 snapshots written in 1 test suite.

Test Suites: 2 passed, 2 total
Tests:       5 passed, 5 total
Snapshots:   2 added, 4 passed, 6 total
Time:        3.055s, estimated 6s
Ran all test suites

Writing tests with Jest

We've created test examples with jest-ts in src/components/screen/__tests__ and src/components/shared/__tests__. Since react is component oriented, we've designed to focus on writing test in same level of directory with component. You can simply run npm test to test if it succeeds and look more closer opening the source.


Fixed jest setup by adding following in jestSetup.

import { NativeModules } from 'react-native';

/**

NativeModules.ReactLocalization = { language: 'en_US', };

Vscode prettier and eslint setup

See eslintrc.js


### Expo

35

About

Level-Studios: Example App with TypeScript & React Native in Expo (with Styled Components, ESLint etc.)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages