How to add react-native in a running cljs project
This tutorial will cover how to add react-native in a running cljs project.
I will flow this repo: souenzzo/cljs-rn-tutorial
To run this app you need to start the repl with all profiles clj -A:dev:cljs
then call (user/-main)
- commit Add the react-native dependencie
yarn add react-native
- commmit Generate react-native files
Createa a app.json
file
{ "name": "cljsrn"
, "displayName": "cljs+rn"}
Append this in your .gitignore
...
android/.gradle/
android/app/build/
run ./node_modules/.bin/react-native eject
and git add ios app.json android
I also do not like to commit generated files, but it is necessary :'(
Create a index.js
this this template.
Then you can run ./node_modules/.bin/react-native start
and ./node_modules/.bin/react-native run-android
To make a ./node_modules/.bin/react-native run-android
, you need to get a emulator running or a phone in the cabble
with android dev stuff configured.
Once you get the app running on android, you can edit the text, save, press r-r
on the emulator and see the reload
- commit Configure shadow-cljs This commit will configure shadow-cljs and move the hello from js to cljs.
After do this, you will need to restart the REPL. That shoud be the only one restart.
- commit Start fulcro app
I started the fulcro. Coping the code from the web and moving the dom ns to react-native.
[WIP] - I need to get the remote working.