Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

So what did re-natal add over the react-native template?

The shorter version is:

  • an extra node dependency
  • tweak to where the native apps look for their index file
  • a clojurescript project
  • a configuration file for re-natal

So not a lot of intrusive changes to how react-native works at all.

File changes

modified:   AwesomeProject/.gitignore
modified:   AwesomeProject/android/app/build.gradle
modified:   AwesomeProject/android/app/src/main/java/com/awesomeproject/MainApplication.java
deleted:    AwesomeProject/app.json
deleted:    AwesomeProject/index.js
modified:   AwesomeProject/ios/AwesomeProject/AppDelegate.m
modified:   AwesomeProject/package.json
modified:   AwesomeProject/yarn.lock

File additions

AwesomeProject/.re-natal
AwesomeProject/env/
AwesomeProject/figwheel-bridge.js
AwesomeProject/images/
AwesomeProject/project.clj
AwesomeProject/src/
AwesomeProject/test/

Note: ignoring a few doc/text files and .hgignore

Ignore files

.gitignore gets some clojurescript related additions

React native files

app.json is removed

index.js is removed. (Note: re-natal will generate replacements as index.ios.js & index.android.js depending on need.)

package.json is modified to add a dep. yarn.lock changes as a result.

   "dependencies": {
+    "babel-plugin-transform-es2015-block-scoping": "6.15.0",
     "react": "16.2.0",
     "react-native": "0.53.0"
   },

Re-natal configuration

Adds .re-natal which is the configuration file used by the re-natal script.

{
  "name": "AwesomeProject",
  "interface": "reagent6",
  "envRoots": {
    "dev": "env/dev",
    "prod": "env/prod"
  },
  "modules": [],
  "imageDirs": [
    "images"
  ],
  "platforms": {
    "ios": {
      "host": "localhost",
      "modules": []
    },
    "android": {
      "host": "localhost",
      "modules": []
    }
  },
  "autoRequire": false
}

Clojurescript code

Adds basic clojurescript app:

  • Adds project.clj
  • Adds src/ with source code
  • Adds env/ with build profile specific source code
  • Adds test/ with test code
  • Adds figwheel-bridge.js which facilitates using Figwheel used for REPL and live coding

Android app config

android/app/build.gradle is modified to remove the project.ext.react entryFile setting

-project.ext.react = [
-    entryFile: "index.js"
-]

android/app/src/main/java/com/awesomeproject/MainApplication.java is modified to remove getJSMainModuleName:

-    @Override
-    protected String getJSMainModuleName() {
-      return "index";
-    }

iOS app

ios/AwesomeProject/AppDelegate.h gets an update to didFinishLaunchingWithOptions

-  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
+  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

Images

Adds a few images to images/

Documentation

Few documentation changes:

Adds CHANGELOG.md Adds LICENSE Adds doc/into.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment