A Vim snippet library for React Native in ES6. You may also want to check out vim-es2015-snippets.
Requires UltiSnips.
Using vim-plug:
" React Native code snippets
Plug 'tellijo/vim-react-native-snippets'
In a JavaScript or JSX file, type a trigger name while in Insert mode, then press Ultisnips trigger key. In my case I have it mapped to <C-l>
.
For example, let's say we have ListItem.js
In Insert mode
rncc<C-l>
Will expand to
import React, { Component } from 'react'
import { PropTypes } from 'prop-types'
import { View, StyleSheet } from 'react-native'
import styles from './ListItem.css'
class ListItem expends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string
}
constructor(props) {
super(props);
}
render() {
return (
<View style={styles.container}>
</View>
);
}
}
const styles = StyleSheet.create({
container: {}
})
export default ListItem
Trigger | Content |
---|---|
rncc→ |
React Native Class Component |