Skip to content

Commit b18208c

Browse files
committed
Export default snippet
1 parent a444c9d commit b18208c

File tree

2 files changed

+162
-153
lines changed

2 files changed

+162
-153
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[export default ${1}]]></content>
3+
<tabTrigger>ed</tabTrigger>
4+
<scope>source.js,source.jsx</scope>
5+
<description>export default</description>
6+
</snippet>

snippets/snippets.cson

Lines changed: 156 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,93 @@
11
# Generated with Atomizr - https://github.com/idleberg/atomizr.rb
2-
'.source.js,source.jsx':
3-
'componentWillMount()':
4-
'prefix': 'cwm'
5-
'body': """
6-
componentWillMount() {
7-
${1}
8-
}$0
9-
"""
2+
'.source.jssource.jsx':
103
'componentDidMount()':
114
'prefix': 'cdm'
125
'body': """
136
componentDidMount() {
147
${1}
158
}$0
169
"""
10+
'flex: 1':
11+
'prefix': 'f1'
12+
'body': 'flex: ${1:1},$0'
13+
'React.PropTypes.':
14+
'prefix': 'rpt'
15+
'body': 'React.PropTypes.${1}$0'
1716
'componentWillUnmount()':
1817
'prefix': 'cwum'
1918
'body': """
2019
componentWillUnmount() {
2120
${1}
2221
}$0
2322
"""
24-
'alignItems: \'center\',':
25-
'prefix': 'ai'
26-
'body': 'alignItems: \'${1:center}\',$0'
27-
'Create react-native Class':
28-
'prefix': 'rncc'
23+
'StyleSheet.create()':
24+
'prefix': 'ssc'
2925
'body': """
30-
\'use strict\';
31-
32-
import React, { Component } from \'react\';
33-
34-
import {
35-
StyleSheet,
36-
View,
37-
} from \'react-native\';
38-
39-
class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}} extends Component {
40-
render() {
41-
return (
42-
${2:<View />}
43-
);
44-
}
45-
}
46-
4726
const styles = StyleSheet.create({
48-
49-
});
50-
51-
52-
export default ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}};$0
27+
${1}: ${2},
28+
});$0
5329
"""
54-
'componentWillReceiveProps(object nextProps)':
55-
'prefix': 'cwrp'
30+
'Create StyleSheet':
31+
'prefix': 'css'
5632
'body': """
57-
componentWillReceiveProps(nextProps) {
58-
${1}
59-
}$0
33+
/* @flow */
34+
\'use strict\';
35+
36+
import { StyleSheet } from \'react-native\';
37+
38+
module.exports = StyleSheet.create({
39+
${1}: ${2},
40+
});$0
6041
"""
61-
'componentWillUpdate(object nextProps, object nextState)':
62-
'prefix': 'cwud'
42+
'componentDidUpdate(object prevProps, object prevState)':
43+
'prefix': 'cdud'
6344
'body': """
64-
componentWillUpdate(nextProps, nextState) {
45+
componentDidUpdate(prevProps, prevState) {
6546
${1}
6647
}$0
6748
"""
68-
'shouldComponentUpdate(object nextProps, object nextState)':
69-
'prefix': 'scud'
49+
'constructor()':
50+
'prefix': 'constructor()'
7051
'body': """
71-
shouldComponentUpdate(nextProps, nextState) {
72-
${1}
52+
constructor(props) {
53+
super(props);
54+
55+
this.state = {};
7356
}$0
7457
"""
75-
'ActivityIndicatorIOS':
76-
'prefix': 'rnActivityIndicatorIOS'
58+
'export default':
59+
'prefix': 'ed'
60+
'body': 'export default ${1}$0'
61+
'propTypes':
62+
'prefix': 'propTypes'
7763
'body': """
78-
<ActivityIndicatorIOS
79-
${1:animating={true\}}
80-
${2:color={\'#808080\'\}}
81-
${3:size={\'small\'\}}
82-
/>
83-
${4}$0
64+
static propTypes = {
65+
${2:prop}: React.PropTypes.${3:Type}
66+
}$0
8467
"""
85-
'PickerIOS':
86-
'prefix': 'rnPickerIOS'
68+
'defaultProps':
69+
'prefix': 'defaultProps'
8770
'body': """
88-
<PickerIOS
89-
onValueChange={${1:this.onValueChange}}
90-
selectedValue={${2}}
91-
/>$0
71+
static defaultProps = {
72+
${2:prop}: ${3:\'value\'}
73+
}$0
9274
"""
93-
'DatePickerIOS':
94-
'prefix': 'rnDatePickerIOS'
75+
'shouldComponentUpdate(object nextProps, object nextState)':
76+
'prefix': 'scud'
9577
'body': """
96-
<DatePickerIOS
97-
${1:date={Date.now()\}}
98-
${2: minuteInterval={${3:10}\}}
99-
${4: mode={${5:\'datetime\'}\}}
100-
${6: onDateChange={${7}\}}
101-
${8: maximumDate={${9}\}}
102-
${10: minimumDate={${11}\}}
103-
/>
104-
${12}$0
78+
shouldComponentUpdate(nextProps, nextState) {
79+
${1}
80+
}$0
10581
"""
106-
'NavigatorIOS':
107-
'prefix': 'rnNavigatorIOS'
82+
'TouchableHighlight':
83+
'prefix': 'rnTouchableHighlight'
10884
'body': """
109-
<NavigatorIOS
110-
style={${1}}
111-
initialRoute={{
112-
title: \'${1:Title}\',
113-
component: ${2:View}
114-
}}
115-
/>
116-
${3}$0
85+
<TouchableHighlight
86+
onPress={${1}}
87+
style={${2}}
88+
underlayColor=\'${3}\'>
89+
${4}
90+
</TouchableHighlight>$0
11791
"""
11892
'MapView':
11993
'prefix': 'rnMapView'
@@ -130,15 +104,14 @@
130104
/>
131105
${5}$0
132106
"""
133-
'ListView':
134-
'prefix': 'rnListView'
107+
'Image':
108+
'prefix': 'rnImage'
135109
'body': """
136-
<ListView
110+
<Image
137111
style={${1}}
138-
dataSource={${2:this.state.dataSource}}
139-
renderRow={${3:(rowData) => ${4:<Text>{rowData\}</Text>}}}
112+
source={{uri: \'${2}\'}}
140113
/>
141-
${5}$0
114+
${3}$0
142115
"""
143116
'View':
144117
'prefix': 'rnView'
@@ -150,6 +123,26 @@
150123
${2}
151124
</Text>$0
152125
"""
126+
'ListView':
127+
'prefix': 'rnListView'
128+
'body': """
129+
<ListView
130+
style={${1}}
131+
dataSource={${2:this.state.dataSource}}
132+
renderRow={${3:(rowData) => ${4:<Text>{rowData\}</Text>}}}
133+
/>
134+
${5}$0
135+
"""
136+
'Navigator':
137+
'prefix': 'rnNavigator'
138+
'body': """
139+
<Navigator
140+
initialRoute={{name: \'${1:My First Scene}\', index: 0}}
141+
renderScene={(route, navigator) => {
142+
${2}
143+
}}
144+
/>$0
145+
"""
153146
'ScrollView':
154147
'prefix': 'rnScrollView'
155148
'body': """
@@ -159,90 +152,100 @@
159152
${3}
160153
</ScrollView>$0
161154
"""
162-
'Image':
163-
'prefix': 'rnImage'
155+
'DatePickerIOS':
156+
'prefix': 'rnDatePickerIOS'
164157
'body': """
165-
<Image
166-
style={${1}}
167-
source={{uri: \'${2}\'}}
158+
<DatePickerIOS
159+
${1:date={Date.now()\}}
160+
${2: minuteInterval={${3:10}\}}
161+
${4: mode={${5:\'datetime\'}\}}
162+
${6: onDateChange={${7}\}}
163+
${8: maximumDate={${9}\}}
164+
${10: minimumDate={${11}\}}
168165
/>
169-
${3}$0
170-
"""
171-
'TouchableHighlight':
172-
'prefix': 'rnTouchableHighlight'
173-
'body': """
174-
<TouchableHighlight
175-
onPress={${1}}
176-
style={${2}}
177-
underlayColor=\'${3}\'>
178-
${4}
179-
</TouchableHighlight>$0
166+
${12}$0
180167
"""
181-
'Navigator':
182-
'prefix': 'rnNavigator'
168+
'NavigatorIOS':
169+
'prefix': 'rnNavigatorIOS'
183170
'body': """
184-
<Navigator
185-
initialRoute={{name: \'${1:My First Scene}\', index: 0}}
186-
renderScene={(route, navigator) => {
187-
${2}
171+
<NavigatorIOS
172+
style={${1}}
173+
initialRoute={{
174+
title: \'${1:Title}\',
175+
component: ${2:View}
188176
}}
189-
/>$0
177+
/>
178+
${3}$0
190179
"""
191-
'propTypes':
192-
'prefix': 'propTypes'
180+
'PickerIOS':
181+
'prefix': 'rnPickerIOS'
193182
'body': """
194-
static propTypes = {
195-
${2:prop}: React.PropTypes.${3:Type}
196-
}$0
183+
<PickerIOS
184+
onValueChange={${1:this.onValueChange}}
185+
selectedValue={${2}}
186+
/>$0
197187
"""
198-
'defaultProps':
199-
'prefix': 'defaultProps'
188+
'ActivityIndicatorIOS':
189+
'prefix': 'rnActivityIndicatorIOS'
200190
'body': """
201-
static defaultProps = {
202-
${2:prop}: ${3:\'value\'}
203-
}$0
191+
<ActivityIndicatorIOS
192+
${1:animating={true\}}
193+
${2:color={\'#808080\'\}}
194+
${3:size={\'small\'\}}
195+
/>
196+
${4}$0
204197
"""
205-
'componentDidUpdate(object prevProps, object prevState)':
206-
'prefix': 'cdud'
198+
'justifyContent: 'center',':
199+
'prefix': 'jc'
200+
'body': 'justifyContent: \'${1:center}\',$0'
201+
'componentWillMount()':
202+
'prefix': 'cwm'
207203
'body': """
208-
componentDidUpdate(prevProps, prevState) {
204+
componentWillMount() {
209205
${1}
210206
}$0
211207
"""
212-
'StyleSheet.create()':
213-
'prefix': 'ssc'
208+
'Create react-native Class':
209+
'prefix': 'rncc'
214210
'body': """
211+
\'use strict\';
212+
213+
import React, { Component } from \'react\';
214+
215+
import {
216+
StyleSheet,
217+
View,
218+
} from \'react-native\';
219+
220+
class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}} extends Component {
221+
render() {
222+
return (
223+
${2:<View />}
224+
);
225+
}
226+
}
227+
215228
const styles = StyleSheet.create({
216-
${1}: ${2},
217-
});$0
229+
230+
});
231+
232+
233+
export default ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}};$0
218234
"""
219-
'flex: 1':
220-
'prefix': 'f1'
221-
'body': 'flex: ${1:1},$0'
222-
'Create StyleSheet':
223-
'prefix': 'css'
235+
'alignItems: 'center',':
236+
'prefix': 'ai'
237+
'body': 'alignItems: \'${1:center}\',$0'
238+
'componentWillReceiveProps(object nextProps)':
239+
'prefix': 'cwrp'
224240
'body': """
225-
/* @flow */
226-
\'use strict\';
227-
228-
import { StyleSheet } from \'react-native\';
229-
230-
module.exports = StyleSheet.create({
231-
${1}: ${2},
232-
});$0
241+
componentWillReceiveProps(nextProps) {
242+
${1}
243+
}$0
233244
"""
234-
'justifyContent: \'center\',':
235-
'prefix': 'jc'
236-
'body': 'justifyContent: \'${1:center}\',$0'
237-
'constructor()':
238-
'prefix': 'constructor()'
245+
'componentWillUpdate(object nextProps, object nextState)':
246+
'prefix': 'cwud'
239247
'body': """
240-
constructor(props) {
241-
super(props);
242-
243-
this.state = {};
248+
componentWillUpdate(nextProps, nextState) {
249+
${1}
244250
}$0
245251
"""
246-
'React.PropTypes.':
247-
'prefix': 'rpt'
248-
'body': 'React.PropTypes.${1}$0'

0 commit comments

Comments
 (0)