Skip to content

Commit 78bdce5

Browse files
ecklfDamian Sznajder
authored and
Damian Sznajder
committed
Add ts function components for react-native
^ title
1 parent feae4b0 commit 78bdce5

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

snippets/ts-snippets.json

+48
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,54 @@
223223
],
224224
"description": "Creates a React component class with PropTypes with connected redux and ES7 module system and TypeScript interfaces"
225225
},
226+
"typescriptReactNativeArrowFunctionComponent": {
227+
"prefix": "tsrnf",
228+
"body": [
229+
"import React from 'react'",
230+
"import { View, Text } from 'react-native'",
231+
"",
232+
"interface Props {",
233+
"\t",
234+
"}",
235+
"",
236+
"const ${1:${TM_FILENAME_BASE}} = (props: Props) => {",
237+
"\treturn (",
238+
"\t\t<View>",
239+
"\t\t\t<Text>$0</Text>",
240+
"\t\t</View>",
241+
"\t)",
242+
"}",
243+
"",
244+
"export default ${1:${TM_FILENAME_BASE}}",
245+
""
246+
],
247+
"description": "Creates a React Native Arrow Function Component with ES7 module system and TypeScript interface"
248+
},
249+
"typescriptReactNativeArrowFunctionComponentWithStyles": {
250+
"prefix": "tsrnfs",
251+
"body": [
252+
"import React from 'react'",
253+
"import { StyleSheet, Text, View } from 'react-native'",
254+
"",
255+
"interface Props {",
256+
"\t",
257+
"}",
258+
"",
259+
"const ${1:${TM_FILENAME_BASE}} = (props: Props) => {",
260+
"\treturn (",
261+
"\t\t<View>",
262+
"\t\t\t<Text>$0</Text>",
263+
"\t\t</View>",
264+
"\t)",
265+
"}",
266+
"",
267+
"export default ${1:${TM_FILENAME_BASE}}",
268+
"",
269+
"const styles = StyleSheet.create({})",
270+
""
271+
],
272+
"description": "Creates a React Native Arrow Function Component with ES7 module system, TypeScript interface and StyleSheet"
273+
},
226274
"Export interface": {
227275
"prefix": "expint",
228276
"body": ["export interface ${1:${TM_FILENAME_BASE}} {$0}"]

0 commit comments

Comments
 (0)