Skip to content

Instantly share code, notes, and snippets.

@sakymar
Created December 6, 2022 10:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sakymar/8b94b28024d61ebc110e9182a768c55f to your computer and use it in GitHub Desktop.
Save sakymar/8b94b28024d61ebc110e9182a768c55f to your computer and use it in GitHub Desktop.
{
"Create stylesheet": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "rnStyle",
"body": [
"import { StyleSheet } from 'react-native'",
"import { colors } from '@internals/theme'",
"import { normalize } from '@internals/helpers'",
"",
"export default StyleSheet.create({",
"",
"})"
]
},
"Create react component with styled": {
"scope": "javascript",
"prefix": "rcs",
"body": [
"import React from 'React';",
"import styled from 'styled-components';",
"",
"const StyledContainer = styled.div``;",
"",
"function $1() {",
" return (",
" <StyledContainer>",
" <div></div>",
" </StyledContainer>",
" );",
"}",
"",
"export default $1;"
]
},
"Create react native component": {
"scope": "typescript,javascript,typescriptreact",
"prefix": "rnComponent",
"body": [
"import React from 'react'",
"import { View } from 'react-native'",
"import styles from './styles'",
"",
"interface Props {",
"}",
"",
"const ${1:${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}} = ({}: Props) => {",
"",
" return (",
" <View>",
" ",
" </View>)",
"}",
"",
"export default ${1:$TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}"
]
},
"Create react native screen": {
"scope": "typescript,javascript,typescriptreact",
"prefix": "rnScreen",
"body": [
"import React from 'react'",
"import { StatusBar, View } from 'react-native'",
"import { globalStyles } from '@internals/styles'",
"",
"const ${1:${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}} = () => {",
"",
" return (",
" <View style={globalStyles.flex}>",
" <StatusBar backgroundColor='white' barStyle='dark-content' />",
" </View>)",
"}",
"",
"export default ${1:${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}}"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment