Skip to content

Instantly share code, notes, and snippets.

View dantman's full-sized avatar

Daniel Friesen dantman

View GitHub Profile
render() {
const {styles, onLogout} = this;
const {onOverlayStateChanged} = this;
const {materialTheme, sections: rawSections, navigation, screenProps: {statusBarHeight}, user, activeCompany, company, teams} = this.props;
const {overlayOpen} = this.state;
const sections = navigation.state.routes::groupBy((route) => this._getScreenOptions(route.key).drawerSection);
const {companyList=[]} = user || {};
const children = [];
let first = true;
@dantman
dantman / example.js
Created April 25, 2017 17:36
react-navigation statusbar height example
export default class App extends PureComponent {
state = {
statusBarHeight: Platform.OS === 'android'
? StatusBar.currentHeight || (Platform.Version < 23 ? 25 : 24)
: 0,
};
render() {
const {styles} = this;
@dantman
dantman / RNMDLK-merge-plan.md
Last active July 10, 2017 14:57
React Native Material Design/Kit merge plan

React Native Material Design/Kit merge plan

Take components from react-native-material-design and react-native-material-kit and create a new library to replace both.

Ripple

Deciding how to handle ripples will be very important as both do it differently.

rnmd does it using a Ripple polyfill:

  • Pro: The native touchable feedback is used where available.
@dantman
dantman / Styles-example.js
Last active March 23, 2018 07:04
React Native `@Styles` decorator
import React, {PureComponent} from 'react';
import {View} from 'react-native';
import Styles from './Styles';
@Styles({
root: {
// ...
},
})
export default class Example extends PureComponent {
@dantman
dantman / react-native-sqlite-storage.js
Created December 20, 2016 02:06
ReactNativeSqliteStorage driver for knex.js
'use strict';
import Promise from 'bluebird';
import { map, clone } from 'lodash';
import Client_SQLite3 from 'knex/lib/dialects/sqlite3';
export default class Client_ReactNativeSqliteStorage extends Client_SQLite3 {
dialect: 'sqlite';
driverName = 'react-native-sqlite-storage';
_driver() {
@dantman
dantman / gist.css
Last active April 17, 2018 22:07
Material Design sp units (px unit that scale to the user's font settings) using rems
html {
font-size: 14px;
}
/**
* PostCSS
* Use a custom PostCSS to convert #sp to rems by dividing the number by 14 and expressing it as #rem
*/
body {
@dantman
dantman / transform-is-browser.js
Created January 9, 2016 05:33
require('is-browser') transform
.transform(transformTools.makeRequireTransform(
{evaluateArguments: true},
(args, opts, cb) => {
if ( args[0] === "is-browser" ) {
return cb(null, 'true');
} else {
return cb();
}
}))
@dantman
dantman / regenerator-runtimeify.js
Last active January 9, 2016 05:22
Transform modules using regenerator-runtime
.transform(transformTools.makeStringTransform(
'regenerator-runtimeify',
{jsFilesOnly: true},
(contents, transformOptions, done) => {
if ( contents.includes('regeneratorRuntime') ) {
contents = contents.replace(
/(['"']use strict['"'];?\n?)/,
"$1\nvar regeneratorRuntime = require('regenerator/runtime');\n");
}
@dantman
dantman / .babelrc
Last active December 24, 2015 21:03
{
"presets": ["es2015", "stage-1"]
}
@dantman
dantman / git.diff
Created December 14, 2015 01:58
Juice styleFilter patch
diff --git a/client.js b/client.js
index 9deb594..44488de 100644
--- a/client.js
+++ b/client.js
@@ -282,7 +282,7 @@ function inlineContent(html, css, options) {
function getStylesData($, options) {
var results = [];
var stylesList = $("style");
- var styleDataList, styleData, styleElement;
+ var styleDataList, styleData, styleElement, filterResult;