This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
// https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html | |
export type CancelablePromise = { | |
promise: Promise<any>, | |
cancel: Function, | |
} | |
export const makeCancelablePromise = ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"private": true, | |
// ... | |
"#dependencies": "dependencies are the one shipped to the client", | |
"dependencies": { | |
"babel-polyfill": "^6.7.4", | |
"react": "^15.0.0", | |
// ... | |
"whatwg-fetch": "^0.11.1" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
[options] | |
# webpack loaders | |
module.name_mapper='.*\.css$' -> '<PROJECT_ROOT>/flow/stub/css-modules.js' | |
module.name_mapper='.*\.\(svg\|png\|jpg\|gif\)$' -> '<PROJECT_ROOT>/flow/stub/url-loader.js' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React, { Component } from "react" | |
type Props = Object | |
type State = { | |
hovered: boolean, | |
focused: boolean, | |
depressed: boolean, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// auto scroll to proper active (form) element when keyboard open | |
// may be useless on iOS, but useful on Android | |
function scrollToActiveElement() { | |
if (document.activeElement && document.activeElement.scrollIntoViewIfNeeded) { | |
document.activeElement.scrollIntoViewIfNeeded() | |
} | |
} | |
window.addEventListener("resize", () => { | |
setTimeout(scrollToActiveElement, 200) | |
setTimeout(scrollToActiveElement, 1000) // just in case browser is slow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webpackSimpleConfig from "webpack-simple-config" | |
/* | |
ideas: | |
- simpler config | |
- fix loaders order (imo, more logical order): proof is that every new webpack user don't get this part | |
- no tons of way to provide config via string, query etc | |
- some shortcuts: simple extract, aliases | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEV = process.argv.includes("--dev") | |
const PROD = process.argv.includes("--production") | |
export default { | |
common: "stuff", | |
...DEV && { | |
just: "for dev" | |
}, | |
...PROD && { | |
just: "for prod", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dblTouchTapMaxDelay = 300 | |
let latestTouchTap = { | |
time: 0, | |
target: null, | |
} | |
export default function isDblTouchTap(event) { | |
const touchTap = { | |
time: new Date().getTime(), | |
target: event.currentTarget, |