-
Notifications
You must be signed in to change notification settings - Fork 210
Update to use modern techniques for React Native + TS #34
Comments
The rough technique to get set up with TS + RN should be: # Init RN folder
react-native init MyAwesomeProject
# Setup TS
npm install --save-dev --dev react-native-typescript-transformer
npm install --save-dev --dev typescript
yarn tsc --init
yarn touch rn-cli.config.js # https://github.com/ds300/react-native-typescript-transformer#step-3-configure-the-react-native-packager
npm install --save-dev --dev @types/react @types/react-native
# rename *.js -> *.ts
# Setup Jest
npm install --save-dev ts-jest
# copy this https://github.com/Microsoft/TypeScript-React-Native-Starter#adding-typescript-testing-infrastructure
npm install --save-dev @types/jest @types/react-test-renderer Thoughts
|
I would be interested in helping out with this; I love documentation and I've been looking for a way to contribute back to the community. I'll begin by really familiarizing myself with the current state of the docs and then get a grasp of Orta's suggestions. |
Exciting :) I was just looking into good resources to get started and bootstrapping is definitely a hard fence to go over |
@orta, I am following your instructions right now, and they seem great so far. My one point of confusion is, I am using create-react-native-app to get my project started. This appears to recommended as this project's README links to the "Getting Started" section of Facebook's React Native page, which recommends using create-react-native-app. So far its been fine, and I don't think this is an issue (probably more a potential point of confusion), but I think with create-react-native-app one uses [EDIT] It looks like
[EDIT EDIT] It looks like Ah, the joys of the ever-changing JS ecosystem. As someone experienced with React but new to React Native, these are all things I am unfamiliar with and which imho would be useful in any documentation meant for newcomers. [EDIT EDIT EDIT] The above steps did not quite work. I was able to start the app with Expo, but the app was broken - I got a very verbose error. I suspect this was because a) I may have needed to make modifications to So, after a little searching, I found the following, which worked perfectly out of the box: |
Yeah, for CRNA that link is definitely the right option - sorry, if I'd have been around to respond I would have recommended that having contributed to keep it up to date also. Think it's a great resource. Maybe it should be linked in the README too, I'm gonna add this to the initial TODO list. If you're coming from a native background CRNA isn't always an option, so I'd like to have this "from scratch" repo set up to fit how the CRNA works too (which is the aim of this issue 👍 ) |
No worries! So far, Webpack config files my list for "most frustrating (yet super-useful!!) JS thing". This repo looks like a cool resource, and it would be great for it to be up to date. In an ideal world I would prefer to learn not using tools like CRN/CRNA, to build from scratch and understand what is going on, but, unfortunately that's often time-consuming/frustrating. So having a non-CRNA "from scratch" repo would be awesome :). And you make a good point about folks coming from the native dev world. |
There is a useful react-native template here: https://github.com/emin93/react-native-template-typescript Maybe that can be linked in the README for non CRNA use cases. |
Agree |
From listening to native devs moving to TS, this repo is often used as the reference for RN + TS, and I think it's time we gave it a spring clean.
This issue is more of a TODO list to bring this up to speed:
The text was updated successfully, but these errors were encountered: