Skip to content

Instantly share code, notes, and snippets.

@FDiskas
Last active August 30, 2019 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FDiskas/d23783f7f631ec6a662b4ffbc7503682 to your computer and use it in GitHub Desktop.
Save FDiskas/d23783f7f631ec6a662b4ffbc7503682 to your computer and use it in GitHub Desktop.
VSCode snippets "React-Native"
{
"Component": {
"prefix": "comp",
"body": [
"import * as React from 'react';",
"import { View, StyleSheet, ViewStyle, Text } from 'react-native';",
"",
"interface ComponentProps {}",
"interface ComponentState {}",
"interface Styles {",
" ${2:wrapper}: ViewStyle;",
"}",
"",
"export class ${1:${TM_FILENAME_BASE}}Component extends React.Component<ComponentProps, ComponentState> {",
" state = {};",
"",
" render() {",
" const {} = this.state;",
" const {} = this.props;",
"",
" return (",
" <View style={styles.${2:wrapper}}>",
" <Text>${TM_FILENAME}</Text>",
" </View>",
" );",
" }",
"}",
"",
"const styles = StyleSheet.create<Styles>({",
" ${2:wrapper}: { ${3:flex: 1} },",
"});",
""
],
"description": "Create react-native Component"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment