npm install react-native
npm install react-native-cli
brew install watchman
- Optional https://atom.io/packages/react-native-snippets
react-native init AppName
npm install react-native
npm install react-native-cli
brew install watchman
react-native init AppName
"scripts": { | |
"start": "node node_modules/react-native/local-cli/cli.js start", | |
"rc-start": "npm start -- --reset-cache", | |
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean", | |
"clean-start": "npm run clean && npm run rc-start", | |
"fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install", | |
"fresh-start" : "npm run fresh-install && npm run rc-start", | |
"tron": "node_modules/.bin/reactotron" | |
} |
module.exports = { | |
getTransformModulePath() { | |
return require.resolve('react-native-typescript-transformer'); | |
}, | |
getSourceExts() { | |
return ['ts', 'tsx']; | |
} | |
} |
As an ember developer accustomed to the "batteries-included" mentality of sensible defaults and convention over configuration, getting into the groove of react-native can be a little tricky - especially for seemingly should-be-simple things such as including fonts in our app.
In ember-cli land, installing font-awesome (or any font) was done with a simple cli command: ember install ember-cli-font-awesome
. In react native, similar packages exist, but the installation instructions require a little more research on my part. Here's how it's done:
npm install --save react-native-vector-icons
mkdir -p assets/fonts
{ | |
"extends": [ | |
"plugin:flowtype/recommended", | |
"plugin:react/recommended", | |
"plugin:import/errors", | |
"plugin:import/warnings", | |
"prettier", | |
"prettier/flowtype", | |
"prettier/react" | |
], |
"scripts": { | |
"start": "node node_modules/react-native/local-cli/cli.js start --reset-cache", | |
"reset": "rm -rf node_modules/ && npm cache clear && watchman watch-del-all && npm i", | |
"testflight": "fastlane beta", | |
"android-device": "adb reverse tcp:8081 tcp:8081 && react-native run-android", | |
"lint": "jslint **.js", | |
"test": "jest", | |
"generate-apk": "cd android && ./gradlew assembleRelease && open ./app/build/outputs/apk/", | |
"install-apk": "cd android && ./gradlew installRelease" | |
}, |
'use strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv); |