|
1 | 1 | # Generated with Atomizr - https://github.com/idleberg/atomizr.rb |
2 | 2 | '.source.js,source.jsx': |
| 3 | + 'componentWillMount()': |
| 4 | + 'prefix': 'cwm' |
| 5 | + 'body': """ |
| 6 | + componentWillMount() { |
| 7 | + ${1} |
| 8 | + }$0 |
| 9 | + """ |
| 10 | + 'componentDidMount()': |
| 11 | + 'prefix': 'cdm' |
| 12 | + 'body': """ |
| 13 | + componentDidMount() { |
| 14 | + ${1} |
| 15 | + }$0 |
| 16 | + """ |
| 17 | + 'componentWillUnmount()': |
| 18 | + 'prefix': 'cwum' |
| 19 | + 'body': """ |
| 20 | + componentWillUnmount() { |
| 21 | + ${1} |
| 22 | + }$0 |
| 23 | + """ |
3 | 24 | 'alignItems: \'center\',': |
4 | 25 | 'prefix': 'ai' |
5 | 26 | 'body': 'alignItems: \'${1:center}\',$0' |
6 | | - 'componentDidMount()': |
7 | | - 'prefix': 'tss' |
| 27 | + 'Create react-native Class': |
| 28 | + 'prefix': 'rncc' |
8 | 29 | 'body': """ |
9 | | - this.setState({ |
10 | | - ${1:key}: ${2:\'value\'}, |
11 | | - });$0 |
| 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 | +
|
| 47 | + const styles = StyleSheet.create({ |
| 48 | +
|
| 49 | + }); |
| 50 | +
|
| 51 | +
|
| 52 | + export default ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}};$0 |
12 | 53 | """ |
13 | | - 'componentDidUpdate(object prevProps, object prevState)': |
14 | | - 'prefix': 'cdud' |
| 54 | + 'componentWillReceiveProps(object nextProps)': |
| 55 | + 'prefix': 'cwrp' |
15 | 56 | 'body': """ |
16 | | - componentDidUpdate(prevProps, prevState) { |
| 57 | + componentWillReceiveProps(nextProps) { |
| 58 | + ${1} |
| 59 | + }$0 |
| 60 | + """ |
| 61 | + 'componentWillUpdate(object nextProps, object nextState)': |
| 62 | + 'prefix': 'cwud' |
| 63 | + 'body': """ |
| 64 | + componentWillUpdate(nextProps, nextState) { |
| 65 | + ${1} |
| 66 | + }$0 |
| 67 | + """ |
| 68 | + 'shouldComponentUpdate(object nextProps, object nextState)': |
| 69 | + 'prefix': 'scud' |
| 70 | + 'body': """ |
| 71 | + shouldComponentUpdate(nextProps, nextState) { |
17 | 72 | ${1} |
18 | 73 | }$0 |
19 | 74 | """ |
|
27 | 82 | /> |
28 | 83 | ${4}$0 |
29 | 84 | """ |
| 85 | + 'PickerIOS': |
| 86 | + 'prefix': 'rnPickerIOS' |
| 87 | + 'body': """ |
| 88 | + <PickerIOS |
| 89 | + onValueChange={${1:this.onValueChange}} |
| 90 | + selectedValue={${2}} |
| 91 | + />$0 |
| 92 | + """ |
30 | 93 | 'DatePickerIOS': |
31 | 94 | 'prefix': 'rnDatePickerIOS' |
32 | 95 | 'body': """ |
|
52 | 115 | /> |
53 | 116 | ${3}$0 |
54 | 117 | """ |
55 | | - 'PickerIOS': |
56 | | - 'prefix': 'rnPickerIOS' |
57 | | - 'body': """ |
58 | | - <PickerIOS |
59 | | - onValueChange={${1:this.onValueChange}} |
60 | | - selectedValue={${2}} |
61 | | - />$0 |
62 | | - """ |
63 | | - 'Image': |
64 | | - 'prefix': 'rnImage' |
65 | | - 'body': """ |
66 | | - <Image |
67 | | - style={${1}} |
68 | | - source={{uri: \'${2}\'}} |
69 | | - /> |
70 | | - ${3}$0 |
71 | | - """ |
72 | | - 'ListView': |
73 | | - 'prefix': 'rnListView' |
74 | | - 'body': """ |
75 | | - <ListView |
76 | | - style={${1}} |
77 | | - dataSource={${2:this.state.dataSource}} |
78 | | - renderRow={${3:(rowData) => ${4:<Text>{rowData\}</Text>}}} |
79 | | - /> |
80 | | - ${5}$0 |
81 | | - """ |
82 | 118 | 'MapView': |
83 | 119 | 'prefix': 'rnMapView' |
84 | 120 | 'body': """ |
|
94 | 130 | /> |
95 | 131 | ${5}$0 |
96 | 132 | """ |
97 | | - 'Navigator': |
98 | | - 'prefix': 'rnNavigator' |
| 133 | + 'ListView': |
| 134 | + 'prefix': 'rnListView' |
99 | 135 | 'body': """ |
100 | | - <Navigator |
101 | | - initialRoute={{name: \'${1:My First Scene}\', index: 0}} |
102 | | - renderScene={(route, navigator) => { |
103 | | - ${2} |
104 | | - }} |
105 | | - />$0 |
| 136 | + <ListView |
| 137 | + style={${1}} |
| 138 | + dataSource={${2:this.state.dataSource}} |
| 139 | + renderRow={${3:(rowData) => ${4:<Text>{rowData\}</Text>}}} |
| 140 | + /> |
| 141 | + ${5}$0 |
| 142 | + """ |
| 143 | + 'View': |
| 144 | + 'prefix': 'rnView' |
| 145 | + 'body': '<View style={styles.${1}}>${2}</View>$0' |
| 146 | + 'Text': |
| 147 | + 'prefix': 'rnText' |
| 148 | + 'body': """ |
| 149 | + <Text style={styles.${1}}> |
| 150 | + ${2} |
| 151 | + </Text>$0 |
106 | 152 | """ |
107 | 153 | 'ScrollView': |
108 | 154 | 'prefix': 'rnScrollView' |
|
113 | 159 | ${3} |
114 | 160 | </ScrollView>$0 |
115 | 161 | """ |
116 | | - 'Text': |
117 | | - 'prefix': 'rnText' |
| 162 | + 'Image': |
| 163 | + 'prefix': 'rnImage' |
118 | 164 | 'body': """ |
119 | | - <Text style={styles.${1}}> |
120 | | - ${2} |
121 | | - </Text>$0 |
| 165 | + <Image |
| 166 | + style={${1}} |
| 167 | + source={{uri: \'${2}\'}} |
| 168 | + /> |
| 169 | + ${3}$0 |
122 | 170 | """ |
123 | 171 | 'TouchableHighlight': |
124 | 172 | 'prefix': 'rnTouchableHighlight' |
|
130 | 178 | ${4} |
131 | 179 | </TouchableHighlight>$0 |
132 | 180 | """ |
133 | | - 'View': |
134 | | - 'prefix': 'rnView' |
135 | | - 'body': '<View style={styles.${1}}>${2}</View>$0' |
136 | | - 'componentWillMount()': |
137 | | - 'prefix': 'cwm' |
138 | | - 'body': """ |
139 | | - componentWillMount() { |
140 | | - ${1} |
141 | | - }$0 |
142 | | - """ |
143 | | - 'componentWillReceiveProps(object nextProps)': |
144 | | - 'prefix': 'cwrp' |
145 | | - 'body': """ |
146 | | - componentWillReceiveProps(nextProps) { |
147 | | - ${1} |
148 | | - }$0 |
149 | | - """ |
150 | | - 'componentWillUnmount()': |
151 | | - 'prefix': 'cwum' |
152 | | - 'body': """ |
153 | | - componentWillUnmount() { |
154 | | - ${1} |
155 | | - }$0 |
156 | | - """ |
157 | | - 'componentWillUpdate(object nextProps, object nextState)': |
158 | | - 'prefix': 'cwud' |
| 181 | + 'Navigator': |
| 182 | + 'prefix': 'rnNavigator' |
159 | 183 | 'body': """ |
160 | | - componentWillUpdate(nextProps, nextState) { |
161 | | - ${1} |
162 | | - }$0 |
| 184 | + <Navigator |
| 185 | + initialRoute={{name: \'${1:My First Scene}\', index: 0}} |
| 186 | + renderScene={(route, navigator) => { |
| 187 | + ${2} |
| 188 | + }} |
| 189 | + />$0 |
163 | 190 | """ |
164 | | - 'constructor()': |
165 | | - 'prefix': 'constructor()' |
| 191 | + 'propTypes': |
| 192 | + 'prefix': 'propTypes' |
166 | 193 | 'body': """ |
167 | | - constructor(props) { |
168 | | - super(props); |
169 | | -
|
170 | | - this.state = {}; |
| 194 | + static propTypes = { |
| 195 | + ${2:prop}: React.PropTypes.${3:Type} |
171 | 196 | }$0 |
172 | 197 | """ |
173 | | - 'Create react-native Class': |
174 | | - 'prefix': 'rncc' |
175 | | - 'body': """ |
176 | | - \'use strict\'; |
177 | | -
|
178 | | - import React, { Component } from \'react\'; |
179 | | -
|
180 | | - import { |
181 | | - StyleSheet, |
182 | | - View, |
183 | | - } from \'react-native\'; |
184 | | -
|
185 | | - class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}} extends Component { |
186 | | - render() { |
187 | | - return ( |
188 | | - ${2:<View />} |
189 | | - ); |
190 | | - } |
191 | | - } |
192 | | -
|
193 | | - const styles = StyleSheet.create({ |
194 | | -
|
195 | | - }); |
196 | | -
|
197 | | -
|
198 | | - export default ${1:${TM_FILENAME/(.+)\..+|.*/$1/:MyComponent}};$0 |
199 | | - """ |
200 | 198 | 'defaultProps': |
201 | 199 | 'prefix': 'defaultProps' |
202 | 200 | 'body': """ |
203 | 201 | static defaultProps = { |
204 | 202 | ${2:prop}: ${3:\'value\'} |
205 | 203 | }$0 |
206 | 204 | """ |
207 | | - 'flex: 1': |
208 | | - 'prefix': 'f1' |
209 | | - 'body': 'flex: ${1:1},$0' |
210 | | - 'justifyContent: \'center\',': |
211 | | - 'prefix': 'jc' |
212 | | - 'body': 'justifyContent: \'${1:center}\',$0' |
213 | | - 'propTypes': |
214 | | - 'prefix': 'propTypes' |
215 | | - 'body': """ |
216 | | - static propTypes = { |
217 | | - ${2:prop}: React.PropTypes.${3:Type} |
218 | | - }$0 |
219 | | - """ |
220 | | - 'React.PropTypes.': |
221 | | - 'prefix': 'rpt' |
222 | | - 'body': 'React.PropTypes.${1}$0' |
223 | | - 'shouldComponentUpdate(object nextProps, object nextState)': |
224 | | - 'prefix': 'scud' |
| 205 | + 'componentDidUpdate(object prevProps, object prevState)': |
| 206 | + 'prefix': 'cdud' |
225 | 207 | 'body': """ |
226 | | - shouldComponentUpdate(nextProps, nextState) { |
| 208 | + componentDidUpdate(prevProps, prevState) { |
227 | 209 | ${1} |
228 | 210 | }$0 |
229 | 211 | """ |
|
234 | 216 | ${1}: ${2}, |
235 | 217 | });$0 |
236 | 218 | """ |
| 219 | + 'flex: 1': |
| 220 | + 'prefix': 'f1' |
| 221 | + 'body': 'flex: ${1:1},$0' |
237 | 222 | 'Create StyleSheet': |
238 | 223 | 'prefix': 'css' |
239 | 224 | 'body': """ |
240 | 225 | /* @flow */ |
241 | 226 | \'use strict\'; |
242 | 227 |
|
243 | | - import { Stylesheet } from \'react-native\'; |
| 228 | + import { StyleSheet } from \'react-native\'; |
244 | 229 |
|
245 | 230 | module.exports = StyleSheet.create({ |
246 | 231 | ${1}: ${2}, |
247 | 232 | });$0 |
248 | 233 | """ |
| 234 | + 'justifyContent: \'center\',': |
| 235 | + 'prefix': 'jc' |
| 236 | + 'body': 'justifyContent: \'${1:center}\',$0' |
| 237 | + 'constructor()': |
| 238 | + 'prefix': 'constructor()' |
| 239 | + 'body': """ |
| 240 | + constructor(props) { |
| 241 | + super(props); |
| 242 | +
|
| 243 | + this.state = {}; |
| 244 | + }$0 |
| 245 | + """ |
| 246 | + 'React.PropTypes.': |
| 247 | + 'prefix': 'rpt' |
| 248 | + 'body': 'React.PropTypes.${1}$0' |
0 commit comments