Skip to content

Instantly share code, notes, and snippets.

@ddanielsantos
Last active April 13, 2022 13:18
Show Gist options
  • Save ddanielsantos/16115301ec07517ebbd330fa10332598 to your computer and use it in GitHub Desktop.
Save ddanielsantos/16115301ec07517ebbd330fa10332598 to your computer and use it in GitHub Desktop.
My snippets for VSCode
"fn jsx": {
"prefix": "fntsx",
"body": [
"import React from 'react'",
"",
"export const $1 = () => {",
"\treturn (",
"",
"\t)",
"}"
],
"description": "function returning a jsx element"
}
"stack navigation": {
"prefix": "stackn",
"body": [
"import React from 'react'",
"import { NavigationContainer } from '@react-navigation/native'",
"import { createNativeStackNavigator } from '@react-navigation/native-stack'",
"",
"import { $1 } from './screens/$1'",
"import { $2 } from './screens/$2'",
"import { $3 } from './screens/$3'",
"",
"export type $0ScreensParams = {",
"\t$1: undefined,",
"\t$2: undefined,",
"\t$3: undefined",
"}",
"",
"const $0Stack = createNativeStackNavigator<$0ScreensParams>()",
"",
"export const $0Route = () => {",
"\treturn (",
"\t\t<NavigationContainer>",
"\t\t\t<$0Stack.Navigator screenOptions={{ headerShown: false }} initialRouteName='$1'>",
"\t\t\t\t<$0Stack.Screen name='$1' component={$1} />",
"\t\t\t\t<$0Stack.Screen name='$2' component={$2} />",
"\t\t\t\t<$0Stack.Screen name='$3' component={$3} />",
"\t\t\t</$0Stack.Navigator>",
"\t\t</NavigationContainer>",
"\t)",
"}",
],
"description": "stack navigation"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment