-
-
Save epcim/f5252867879369e0000dd6b5d2e9ef08 to your computer and use it in GitHub Desktop.
React Native snippets for vim and ultisnip
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
snippet rnccf | |
import React, { PropTypes } from 'react' | |
import { View, StyleSheet, Text } from 'react-native' | |
$1.propTypes = { | |
} | |
export default function ${1:FunctionName} (props) { | |
return ( | |
<View> | |
<Text> | |
$1 | |
</Text> | |
</View> | |
) | |
} | |
const styles = StyleSheet.create({ | |
$0 | |
}) | |
endsnippet | |
snippet rnccs | |
import React, { PropTypes, Component } from 'react' | |
import { View, Text } from 'react-native' | |
export default class ${1:ClassName} extends Component { | |
static propTypes = {} | |
state = {} | |
render () { | |
return ( | |
${0:<View> | |
<Text> | |
$1 | |
</Text> | |
</View>} | |
) | |
} | |
} | |
endsnippet | |
snippet duck | |
const initialState = {} | |
export default function ${1:FunctionName} (state = initialState, action) { | |
switch (action.type) { | |
default : | |
return state | |
} | |
} | |
endsnippet | |
snippet imcon | |
import { connect } from 'react-redux' | |
$0 | |
endsnippet | |
snippet statprop | |
static propTypes = { | |
$0 | |
} | |
endsnippet | |
snippet mapsta | |
function mapStateToProps ({${1:reducerName}}) { | |
return { | |
$1 | |
} | |
} | |
endsnippet | |
snippet mapdis | |
function mapDispatchToProps (dispatch) { | |
return { | |
$1 | |
} | |
} | |
endsnippet | |
snippet expcon | |
export default connect( | |
mapStateToProps | |
)( | |
${1:FileName} | |
) | |
endsnippet | |
snippet imfun | |
import {$1} from '$2' | |
endsnippet | |
snippet imcla | |
import $1 from '$2' | |
endsnippet | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment