Created
May 20, 2023 10:02
-
-
Save AksAman/b5b0820f1ec1d9dc83d45c290f3c12a9 to your computer and use it in GitHub Desktop.
VSCode snippet to generate React Native Function Component (typescript)
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
| { | |
| "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