mosesoak / react-native-hybrid-ts-app

web + native ts app in separate folders

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native Hybrid Typescript App

Let's build a hybrid app using Typescript!

This experiment sets up separate frontend & native packages, with some simple copy scripts to move code back and forth for now.

The idea is that by isolating the projects, top-level configurations can live separately.

Key branches in this repo

a-starter

b-redux

c-glamorous

frontend (Web)

React Native for Web:

https://github.com/necolas/react-native-web

react-native-typescript-transformer:

https://github.com/ds300/react-native-typescript-transformer

Dependencies:

(on top of an ejected Create-React-App)

yarn remove babel-eslint eslint eslint-config-react-app eslint-loader eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react

yarn add react-native-web typescript tslint awesome-typescript-loader babel-plugin-react-native-web babel-jest babel-preset-env babel-preset-react babel-preset-react-native react-test-renderer ts-jest babel-jest canvas-prebuilt prettier @types/node @types/jest @types/react-native @types/react

Configs:

Jest - issues!

  • needed to remove the match |(\\.|/)(test|spec) because it was matching the file scripts/test.js (provided by the ejected CRA)
  • needs special mocks to handle inline svg
  • had to add dependency canvas-prebuilt to avoid error during test
  • was erroring out on Animated code, had to work around by setting style in state

native

Dependencies:

(on top of react-native init)

yarn add -D react-native-typescript-transformer typescript tslint ts-jest prettier @types/node @types/react-native @types/react @types/jest fs-extra

Configs:

Jest: issues here too!

  • Difficult to get images to work, resolved using the assetsTransformer solution from this thread

About

web + native ts app in separate folders


Languages

Language:JavaScript 69.7%Language:TypeScript 17.4%Language:Objective-C 6.2%Language:Python 2.4%Language:HTML 2.3%Language:Java 2.0%