Skip to content

Instantly share code, notes, and snippets.

# Since React has made jQuery obsolete for me, I use $ to replace JSX.
window.$ = React.create-element
for key, value of React.DOM
window."$#key" = value
# And here's an example of a render function using this syntax.
render: ->
$ Jumbotron, style: styles.welcome.base, [
$h2 key: \tagline, 'this is a catchy tagline'
$p key: \mission, 'here is a short mission statement, expanding on the tagline'
@dbasedow
dbasedow / KeyboardHandler.js
Created May 28, 2016 09:11
Keyboard spacing solution for react-native based on the stackoverflow answer http://stackoverflow.com/a/33585501/1783214
/**
* Based on http://stackoverflow.com/a/33585501/1783214
*
* Handle resizing enclosed View and scrolling to input
* Usage:
* <KeyboardHandler ref='kh' offset={50}>
* <View>
* ...
* <TextInput ref='username'
* onFocus={()=>this.refs.kh.inputFocused(this,'username')}/>