Skip to content

Instantly share code, notes, and snippets.

View dalcib's full-sized avatar

Dalci de Jesus Bagolin dalcib

View GitHub Profile
@kitze
kitze / flex.js
Created May 15, 2017 22:49
flex helpers
const flex = {
horizontal: {
display: 'flex',
flexDirection: 'row'
},
vertical: {
display: 'flex',
flexDirection: 'column'
},
flexWrap: {
@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.
@parshap
parshap / node-modules-in-react-native.md
Last active March 27, 2025 15:59
Running Node Modules in React Native

Running Node Modules in React Native

How to use packages that depend on Node.js core modules in React Native.

See the [node-libs-react-native][node-libs-react-native] library as a convenience for implementing this method.

Node.js Core Modules

import React from 'react';
import {
View,
Image,
ListView,
ScrollView,
Text,
TouchableHighlight,
TouchableNativeFeedback,
TouchableOpacity,
@kitze
kitze / bind-field.js
Created January 5, 2017 13:18
bindField function for mobx-react-form
export const bindField = (form, field, {error = 'error', value = 'value', floatLabel = false, onChangeFn, onChange = 'onChange', placeholder = 'placeholder'}={}) => ({
name: form.$(field).name,
[value]: form.$(field).value,
[placeholder]: form.$(field).label,
...floatLabel === true && {floatingLabelText: form.$(field).label},
[onChange]: onChangeFn || form.$(field).sync,
[error]: form.$(field).error
});
@danieldunderfelt
danieldunderfelt / StoreContainer.js
Created October 28, 2016 15:36
next.js global store that persists between routes
/**
* PROBLEM:
* In next.js, each route points to a distinct top-level component.
* Since there is no higher-level components in next.js, how to have
* a store that persists between route changes is not immediately
* obvious. One solution is this: a higher-order component that you
* wrap each of your top-level route components with.
*
* This is borrowed from next.js' Redux example from here:
* https://github.com/zeit/next.js/wiki/Redux-example
@MoOx
MoOx / index.web.js
Last active January 7, 2019 16:36
react-native-web partial Picker implementation (using [email protected]) https://github.com/necolas/react-native-web/issues/195
// @flow
// partial dirty implementation of react-native Picker
// should match http://facebook.github.io/react-native/docs/picker.html
// https://github.com/necolas/react-native-web/issues/184
import createDOMElement from "react-native-web/dist/modules/createDOMElement"
import PickerItem from "./item.web.js"
@capaj
capaj / component.js
Last active June 22, 2016 12:40
react stateful function component
import React from 'react'
import {observer} from 'mobx-react'
import {observable} from 'mobx'
const state = observable({
value: 0
})
const Comp = (props) => {
return <div onClick={() => state.value++}>click to increase counter value: {state.value}</div>
import React, { Component } from 'react'
import {
StyleSheet,
Image,
StatusBar,
ListView,
RefreshControl,
Text,
View
} from 'react-native'
@ericjuta
ericjuta / index.jsx
Created May 20, 2016 12:57
Mobx HMR ES6 stores
import React from 'react'
import { render } from 'react-dom'
import { Router, browserHistory, match } from 'react-router'
import createStore from '../shared/lib/create-store.js'
import ContextProvider from '../shared/lib/context-provider.js'
import { fetchDataOnLocationMatch } from '../shared/lib/fetch-data.js'
import Root from './Root.jsx'
import routes from '../shared/routes.jsx'
import { AppContainer } from 'react-hot-loader'
import { observable, computed, autorun } from 'mobx'