Skip to content

Instantly share code, notes, and snippets.

@EduardoSP6
Created October 22, 2021 11:06
Show Gist options
  • Save EduardoSP6/42773f88505a1ec109d54e9bce16d556 to your computer and use it in GitHub Desktop.
Save EduardoSP6/42773f88505a1ec109d54e9bce16d556 to your computer and use it in GitHub Desktop.
Custom react and react native snippets for VSCode
### Snippet para o VS Code
- Dentro do VS Code tecle `Ctrl + Shift + P`, digite `snippet` e escolha a opção `Preferences: Configure User Snippets`;
- Clicar em New Global Snippets file...
- Digite um nome para o arquivo;
- Apagar o conteudo do arquivo e inserir o json abaixo:
{
"Basic React Native Component": {
"prefix": "rnbc",
"body": [
"import React from 'react';",
"",
"import {",
" View",
"} from 'react-native';",
"",
"import { styles } from './styles';",
"",
"export function ${TM_DIRECTORY/.*[\\\\|\\/]+(.*)/$1/}(){",
" return (",
" <View>",
"",
" </View>",
" );",
"}"
],
"description": "Create the structure of a react native component"
},
"StyleSheet React Native Object": {
"prefix": "rnso",
"body": [
"import { StyleSheet } from 'react-native';",
"",
"export const styles = StyleSheet.create({",
" container: {",
" flex: 1,",
" }",
"});"
],
"description": "Create a style object with Stylesheet to separate file."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment