I made a little styling lib called glam
(some features are in development)
let's start off with the simplest use case. we'll make an 'index.html' page,
and assume we've setup our js bundler to output bundle.js
I made a little styling lib called glam
(some features are in development)
let's start off with the simplest use case. we'll make an 'index.html' page,
and assume we've setup our js bundler to output bundle.js
| import { View, Text } from 'react-native' | |
| import { css } from 'glamor-native' | |
| export App = () => { | |
| <View style={css({ color: 'red' })}> | |
| <Text>Hello world!</Text> | |
| </View> | |
| } |
| // Add a 401 response interceptor | |
| window.axios.interceptors.response.use(function (response) { | |
| return response; | |
| }, function (error) { | |
| if (401 === error.response.status) { | |
| swal({ | |
| title: "Session Expired", | |
| text: "Your session has expired. Would you like to be redirected to the login page?", | |
| type: "warning", | |
| showCancelButton: true, |
| // this is a generic runner for iterators | |
| // for every yield, it checks to see if any time is remaining | |
| // on the idle loop, and executes more work if so. | |
| // else, it queues up for the next idle period | |
| function go(it, callback){ | |
| requestIdleCallback(deadline => { | |
| let val = it.next() | |
| while(!val.done){ | |
| if(deadline.timeRemaining() <= 0){ |
| // @flow weak | |
| function now() { | |
| return +new Date(); // timestamp in ms | |
| } | |
| // Count the number of events sent over the last period of time. | |
| const count = { | |
| minute: { | |
| slot: 0, |
| // @flow weak | |
| import raven from 'raven-js'; | |
| import config from 'config'; | |
| const SENTRY_DSN = 'https://XXXX@app.getsentry.com/YYYY'; | |
| function sendQueue() { | |
| const sentryOffline = JSON.parse(window.localStorage.sentryOffline); |
| /* intersperse: Return an array with the separator interspersed between | |
| * each element of the input array. | |
| * | |
| * > _([1,2,3]).intersperse(0) | |
| * [1,0,2,0,3] | |
| */ | |
| function intersperse(arr, sep) { | |
| if (arr.length === 0) { | |
| return []; | |
| } |
| RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
| RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
| RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache | |
| npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache | |
| Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache |
| //////////////////////////////////////////////////////////////////////// | |
| // Intro | |
| /////////////////////// | |
| // Tools like Redux-saga, React-redux and Reselect can easily be used without Redux | |
| // For Reselet there's nothing to do, it's just not coupled to Redux | |
| // For the others, you just need to provide an adapter | |
| // At Stample.co we use a legacy framework that is quite close to Redux but with a bad API | |
| // We want to progressively migrate to Redux, so starting now to use Redux tools on new features will make our migration faster |
Table of Contents generated with DocToc