Skip to content

Instantly share code, notes, and snippets.

@DimitryDushkin
Created December 11, 2018 12:26
Show Gist options
  • Save DimitryDushkin/9a8398de09fed2ddae0b6cf2431bba2e to your computer and use it in GitHub Desktop.
Save DimitryDushkin/9a8398de09fed2ddae0b6cf2431bba2e to your computer and use it in GitHub Desktop.
React Native Typescript Visual Studio Code
{
"react statefull component": {
"prefix": "react-native-statefull",
"body": [
"import React from 'react';",
"import {View, StyleSheet} from 'react-native';",
"",
"type Props = {",
"",
"};",
"",
"export default class ${1:Component} extends React.PureComponent<Props> {",
" public render() {",
" return (",
" <View style={styles.container}>",
" {/**/}",
" </View>",
" );",
" }",
"",
"}",
"",
"const styles = StyleSheet.create({",
" container: {",
"",
" },",
"});",
""
]
},
"react statefull connected component": {
"prefix": "react-native-statefull-connected",
"body": [
"import React from 'react';",
"import {View, StyleSheet} from 'react-native';",
"import {connect} from 'react-redux';",
"import {AppState} from 'types/types-redux';",
"",
"type Props = {",
"",
"};",
"",
"class ${1:Component} extends React.PureComponent<Props> {",
" public render() {",
" return (",
" <View style={styles.container}>",
" {/**/}",
" </View>",
" );",
" }",
"",
"}",
"",
"const styles = StyleSheet.create({",
" container: {",
"",
" },",
"});",
"export default connect((state: AppState) => ({",
"",
"}))(${1:Component});",
]
},
"react stateless component": {
"prefix": "react-native-stateless",
"body": [
"import React from 'react';",
"import {View, StyleSheet} from 'react-native';",
"",
"type Props = {",
"",
"};",
"",
"export default function ${1:Component}({}: Props) {",
" return (",
" <View style={styles.container}>",
" {/**/}",
" </View>",
" );",
"}",
"",
"const styles = StyleSheet.create({",
" container: {",
"",
" },",
"});",
"",
]
},
"react connected stateless comp": {
"prefix": "react-native-connected-stateless",
"body": [
"import React from 'react';",
"import {View, StyleSheet, Button} from 'react-native';",
"import {connect} from 'react-redux';",
"import {AppState} from 'types/types-redux';",
"",
"type Props = {",
"",
"};",
"",
"function ${1:Component}({}: Props) {",
" return (",
" <View style={styles.container}>",
" {/**/}",
" </View>",
" );",
"}",
"",
"const styles = StyleSheet.create({",
" container: {",
"",
" },",
"});",
"",
"export default connect((state: AppState) => ({",
"",
"}))(${1:Component});",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment