Skip to content

Instantly share code, notes, and snippets.

@AksAman
Created May 20, 2023 10:02
Show Gist options
  • Select an option

  • Save AksAman/b5b0820f1ec1d9dc83d45c290f3c12a9 to your computer and use it in GitHub Desktop.

Select an option

Save AksAman/b5b0820f1ec1d9dc83d45c290f3c12a9 to your computer and use it in GitHub Desktop.
VSCode snippet to generate React Native Function Component (typescript)
{
"React Native Functional Component (Custom)": {
"scope": "typescript,typescriptreact",
"prefix": "rfc",
"body": [
"import React from \"react\";",
"import { View, StyleSheet } from \"react-native\";\n\n",
"type ${TM_FILENAME_BASE}Props = {}\n",
"const defaultProps = {}\n",
"const ${TM_FILENAME_BASE}: React.FC<${TM_FILENAME_BASE}Props> = (props) => {",
"\treturn (",
"\t\t<View style={styles.container}>",
"\t\t$1",
"\t\t</View>",
"\t);",
"}\n",
"${TM_FILENAME_BASE}.defaultProps = defaultProps;\n",
"const styles = StyleSheet.create({",
"\tcontainer: {",
"\t\tflex: 1,",
"\t},",
"});\n",
"",
"export default ${TM_FILENAME_BASE};"
]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment