@momo-kits/step 0.0.43-beta.26 → 0.0.43-beta.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,11 @@
1
1
  import { Colors, IconSource, Image, Text } from '@momo-kits/core';
2
2
  import PropTypes from 'prop-types';
3
3
  import React, { Component } from 'react';
4
- import { Dimensions, StyleSheet, View } from 'react-native';
5
- import { ScrollView } from 'react-native-gesture-handler';
6
-
4
+ import { View, StyleSheet, Dimensions, ScrollView } from 'react-native';
7
5
 
8
6
  const CIRCLE_SIZE = 24;
9
7
  const SCREEN_WIDTH = Dimensions.get('window').width;
10
8
 
11
- // this is layout of each item (flexdirection row)
12
- // this is left container (flex 0.2, )
13
- // this is value label
14
- // this is image
15
- // this is caption label
16
- // this is desc label
17
- // this is right container (flex 0.8)
18
- // this is line (width flex = 1 or width 100 percent)
19
-
20
9
  const styles = StyleSheet.create({
21
10
  circle: {
22
11
  width: CIRCLE_SIZE,
@@ -34,16 +23,15 @@ const styles = StyleSheet.create({
34
23
  borderColor: Colors.pink_09,
35
24
  },
36
25
  titleDefault: {
26
+ fontSize: 14,
37
27
  color: Colors.black_12,
38
28
  fontWeight: 'normal',
39
29
  },
40
30
  titleActive: {
31
+ fontSize: 14,
41
32
  color: Colors.black_17,
42
33
  fontWeight: 'bold',
43
34
  },
44
- containerStyle: {
45
- minHeight: CIRCLE_SIZE + 20 + CIRCLE_SIZE,
46
- },
47
35
  description: {
48
36
  fontSize: 12,
49
37
  color: Colors.black_12,
@@ -63,7 +51,6 @@ const styles = StyleSheet.create({
63
51
  },
64
52
  lineHorizontal: {
65
53
  height: 2,
66
- marginTop: 26,
67
54
  width: '100%',
68
55
  },
69
56
  minHeight: {
@@ -108,7 +95,9 @@ export default class HorizontalStep extends Component {
108
95
  currentStepColor,
109
96
  date,
110
97
  isVertical,
111
- titleFontSize,
98
+ titleStyle,
99
+ descriptionStyle,
100
+ dateStyle,
112
101
  } = this.props;
113
102
  const icon =
114
103
  currentStep >= index + 2
@@ -146,13 +135,19 @@ export default class HorizontalStep extends Component {
146
135
  flexDirection: 'column',
147
136
  alignItems: 'center',
148
137
  }}>
149
- {currentStep >= index + 1 ? (
150
- <Text style={[styles.date, { marginBottom: 4 }]}>
151
- {date}
152
- </Text>
153
- ) : (
154
- <View style={minHeight}></View>
155
- )}
138
+ {date &&
139
+ (currentStep >= index + 1 ? (
140
+ <Text
141
+ style={[
142
+ styles.date,
143
+ dateStyle,
144
+ { minHeight: 12, marginBottom: 4 },
145
+ ]}>
146
+ {date[index]}
147
+ </Text>
148
+ ) : (
149
+ <View style={minHeight}></View>
150
+ ))}
156
151
  {currentStep <= index + 1 ? (
157
152
  <View>
158
153
  {/* image */}
@@ -181,16 +176,21 @@ export default class HorizontalStep extends Component {
181
176
  <View>
182
177
  <Text.Caption
183
178
  style={[
184
- { marginTop: 4, fontSize: titleFontSize },
179
+ { marginTop: 4 },
185
180
  textFontStyle,
181
+ titleStyle,
186
182
  ]}>
187
183
  {value}
188
184
  </Text.Caption>
189
185
  </View>
190
186
 
191
- <View>
192
- <Text style={[{ fontSize: 10 }]}>{items[index]}</Text>
193
- </View>
187
+ {items && (
188
+ <View>
189
+ <Text style={[{ fontSize: 10 }, descriptionStyle]}>
190
+ {items[index]}
191
+ </Text>
192
+ </View>
193
+ )}
194
194
  </View>
195
195
  {titles?.length - 1 !== index && (
196
196
  <View
@@ -206,6 +206,10 @@ export default class HorizontalStep extends Component {
206
206
  {
207
207
  backgroundColor: lineActive,
208
208
  },
209
+ date
210
+ ? { marginTop: 27 }
211
+ : { marginTop: 27 - 16 },
212
+ /* subtracting spacing from date */
209
213
  ]}
210
214
  />
211
215
  </View>
@@ -223,9 +227,7 @@ export default class HorizontalStep extends Component {
223
227
  const { style = {} } = this.props;
224
228
  return (
225
229
  <ScrollView>
226
- <View
227
- style={[styles.containerStyle, style]}
228
- onLayout={this.onLayout}>
230
+ <View style={[style]} onLayout={this.onLayout}>
229
231
  <View
230
232
  style={{
231
233
  flexDirection: 'row',
@@ -250,6 +252,9 @@ HorizontalStep.propTypes = {
250
252
  lineColorInActive: PropTypes.string,
251
253
  borderColorActive: PropTypes.string,
252
254
  borderColorInActive: PropTypes.string,
255
+ titleStyle: PropTypes.object,
256
+ descriptionStyle: PropTypes.object,
257
+ dateStyle: PropTypes.object,
253
258
  };
254
259
 
255
260
  HorizontalStep.defaultProps = {
@@ -1,5 +1,5 @@
1
1
  import React, { Component } from 'react';
2
- import { View, StyleSheet, Image, Dimensions } from 'react-native';
2
+ import { View, StyleSheet, Image, Dimensions, ScrollView } from 'react-native';
3
3
 
4
4
  import PropTypes from 'prop-types';
5
5
  import Colors from '../../core/colors';
@@ -9,15 +9,6 @@ import { Icons as IconSource } from '../../core/icons';
9
9
  const CIRCLE_SIZE = 24;
10
10
  const SCREEN_WIDTH = Dimensions.get('window').width;
11
11
 
12
- // this is layout of each item (flexdirection row)
13
- // this is left container (flex 0.2, )
14
- // this is value label
15
- // this is image
16
- // this is caption label
17
- // this is desc label
18
- // this is right container (flex 0.8)
19
- // this is line (width flex = 1 or width 100 percent)
20
-
21
12
  const styles = StyleSheet.create({
22
13
  circle: {
23
14
  width: CIRCLE_SIZE,
@@ -35,16 +26,15 @@ const styles = StyleSheet.create({
35
26
  borderColor: Colors.pink_09,
36
27
  },
37
28
  titleDefault: {
29
+ fontSize: 14,
38
30
  color: Colors.black_12,
39
31
  fontWeight: 'normal',
40
32
  },
41
33
  titleActive: {
34
+ fontSize: 14,
42
35
  color: Colors.black_17,
43
36
  fontWeight: 'bold',
44
37
  },
45
- containerStyle: {
46
- minHeight: CIRCLE_SIZE + 20 + CIRCLE_SIZE,
47
- },
48
38
  description: {
49
39
  fontSize: 12,
50
40
  color: Colors.black_12,
@@ -64,7 +54,6 @@ const styles = StyleSheet.create({
64
54
  },
65
55
  lineHorizontal: {
66
56
  height: 2,
67
- marginTop: 26,
68
57
  width: '100%',
69
58
  },
70
59
  minHeight: {
@@ -109,7 +98,9 @@ export default class HorizontalStep extends Component {
109
98
  currentStepColor,
110
99
  date,
111
100
  isVertical,
112
- titleFontSize,
101
+ titleStyle,
102
+ descriptionStyle,
103
+ dateStyle,
113
104
  } = this.props;
114
105
  const icon =
115
106
  currentStep >= index + 2
@@ -147,13 +138,19 @@ export default class HorizontalStep extends Component {
147
138
  flexDirection: 'column',
148
139
  alignItems: 'center',
149
140
  }}>
150
- {currentStep >= index + 1 ? (
151
- <Text style={[styles.date, { marginBottom: 4 }]}>
152
- {date}
153
- </Text>
154
- ) : (
155
- <View style={minHeight}></View>
156
- )}
141
+ {date &&
142
+ (currentStep >= index + 1 ? (
143
+ <Text
144
+ style={[
145
+ styles.date,
146
+ dateStyle,
147
+ { minHeight: 12, marginBottom: 4 },
148
+ ]}>
149
+ {date[index]}
150
+ </Text>
151
+ ) : (
152
+ <View style={minHeight}></View>
153
+ ))}
157
154
  {currentStep <= index + 1 ? (
158
155
  <View>
159
156
  {/* image */}
@@ -182,16 +179,21 @@ export default class HorizontalStep extends Component {
182
179
  <View>
183
180
  <Text.Caption
184
181
  style={[
185
- { marginTop: 4, fontSize: titleFontSize },
182
+ { marginTop: 4 },
186
183
  textFontStyle,
184
+ titleStyle,
187
185
  ]}>
188
186
  {value}
189
187
  </Text.Caption>
190
188
  </View>
191
189
 
192
- <View>
193
- <Text style={[{ fontSize: 10 }]}>{items[index]}</Text>
194
- </View>
190
+ {items && (
191
+ <View>
192
+ <Text style={[{ fontSize: 10 }, descriptionStyle]}>
193
+ {items[index]}
194
+ </Text>
195
+ </View>
196
+ )}
195
197
  </View>
196
198
  {titles?.length - 1 !== index && (
197
199
  <View
@@ -207,6 +209,10 @@ export default class HorizontalStep extends Component {
207
209
  {
208
210
  backgroundColor: lineActive,
209
211
  },
212
+ date
213
+ ? { marginTop: 27 }
214
+ : { marginTop: 27 - 16 },
215
+ /* subtracting spacing from date */
210
216
  ]}
211
217
  />
212
218
  </View>
@@ -223,16 +229,16 @@ export default class HorizontalStep extends Component {
223
229
  render() {
224
230
  const { style = {} } = this.props;
225
231
  return (
226
- <View
227
- style={[styles.containerStyle, style]}
228
- onLayout={this.onLayout}>
229
- <View
230
- style={{
231
- flexDirection: 'row',
232
- }}>
233
- {this.renderCircle()}
232
+ <ScrollView>
233
+ <View style={[style]} onLayout={this.onLayout}>
234
+ <View
235
+ style={{
236
+ flexDirection: 'row',
237
+ }}>
238
+ {this.renderCircle()}
239
+ </View>
234
240
  </View>
235
- </View>
241
+ </ScrollView>
236
242
  );
237
243
  }
238
244
  }
@@ -249,6 +255,9 @@ HorizontalStep.propTypes = {
249
255
  lineColorInActive: PropTypes.string,
250
256
  borderColorActive: PropTypes.string,
251
257
  borderColorInActive: PropTypes.string,
258
+ titleStyle: PropTypes.object,
259
+ descriptionStyle: PropTypes.object,
260
+ dateStyle: PropTypes.object,
252
261
  };
253
262
 
254
263
  HorizontalStep.defaultProps = {
package/Step.js CHANGED
@@ -30,7 +30,9 @@ Step.propTypes = {
30
30
  lineColorInActive: PropTypes.string,
31
31
  borderColorActive: PropTypes.string,
32
32
  borderColorInActive: PropTypes.string,
33
- titleFontSize: PropTypes.number,
33
+ titleStyle: PropTypes.object,
34
+ descriptionStyle: PropTypes.object,
35
+ dateStyle: PropTypes.object,
34
36
  };
35
37
 
36
38
  Step.defaultProps = {
package/Step.vertical.js CHANGED
@@ -1,21 +1,10 @@
1
1
  import { Colors, IconSource, Image, Text } from '@momo-kits/core';
2
2
  import PropTypes from 'prop-types';
3
3
  import React, { Component } from 'react';
4
- import { StyleSheet, View } from 'react-native';
5
- import { ScrollView } from 'react-native-gesture-handler';
6
-
4
+ import { View, StyleSheet, ScrollView } from 'react-native';
7
5
 
8
6
  const CIRCLE_SIZE = 24;
9
7
 
10
- // this is layout of each item (flexdirection row)
11
- // this is left container (flex 0.2, )
12
- // this is value label
13
- // this is image
14
- // this is caption label
15
- // this is desc label
16
- // this is right container (flex 0.8)
17
- // this is line (width flex = 1 or width 100 percent)
18
-
19
8
  const styles = StyleSheet.create({
20
9
  circle: {
21
10
  width: CIRCLE_SIZE,
@@ -112,7 +101,9 @@ export default class VerticalStep extends Component {
112
101
  items,
113
102
  currentStepColor,
114
103
  date,
115
- isVertical,
104
+ titleStyle,
105
+ descriptionStyle,
106
+ dateStyle,
116
107
  } = this.props;
117
108
  const icon =
118
109
  currentStep >= index + 2
@@ -181,24 +172,36 @@ export default class VerticalStep extends Component {
181
172
  alignItems: 'center',
182
173
  }}>
183
174
  <Text.Caption
184
- style={[{ marginLeft: 10 }, textFontStyle]}>
175
+ style={[
176
+ { marginLeft: 10 },
177
+ textFontStyle,
178
+ titleStyle,
179
+ ]}>
185
180
  {value}
186
181
  </Text.Caption>
187
- {currentStep >= index + 1 && (
188
- <Text style={styles.date}>{date}</Text>
189
- )}
190
- </View>
191
- <View>
192
- {typeof items[index] == 'string' ? (
193
- <Text style={[styles.description]}>
194
- {items[index]}
182
+ {date && currentStep >= index + 1 && (
183
+ <Text style={[styles.date, dateStyle]}>
184
+ {date[index]}
195
185
  </Text>
196
- ) : (
197
- <View style={[styles.description]}>
198
- {items[index]}
199
- </View>
200
186
  )}
201
187
  </View>
188
+ {items && (
189
+ <View>
190
+ {typeof items[index] == 'string' ? (
191
+ <Text
192
+ style={[
193
+ styles.description,
194
+ descriptionStyle,
195
+ ]}>
196
+ {items[index]}
197
+ </Text>
198
+ ) : (
199
+ <View style={[styles.description]}>
200
+ {items[index]}
201
+ </View>
202
+ )}
203
+ </View>
204
+ )}
202
205
  </View>
203
206
  </View>
204
207
  );
@@ -234,6 +237,9 @@ VerticalStep.propTypes = {
234
237
  lineColorInActive: PropTypes.string,
235
238
  borderColorActive: PropTypes.string,
236
239
  borderColorInActive: PropTypes.string,
240
+ titleStyle: PropTypes.object,
241
+ descriptionStyle: PropTypes.object,
242
+ dateStyle: PropTypes.object,
237
243
  };
238
244
 
239
245
  VerticalStep.defaultProps = {
@@ -1,5 +1,5 @@
1
1
  import React, { Component } from 'react';
2
- import { View, StyleSheet, Image } from 'react-native';
2
+ import { View, StyleSheet, Image, ScrollView } from 'react-native';
3
3
 
4
4
  import PropTypes from 'prop-types';
5
5
  import Colors from '../../core/colors';
@@ -8,15 +8,6 @@ import { Icons as IconSource } from '../../core/icons';
8
8
 
9
9
  const CIRCLE_SIZE = 24;
10
10
 
11
- // this is layout of each item (flexdirection row)
12
- // this is left container (flex 0.2, )
13
- // this is value label
14
- // this is image
15
- // this is caption label
16
- // this is desc label
17
- // this is right container (flex 0.8)
18
- // this is line (width flex = 1 or width 100 percent)
19
-
20
11
  const styles = StyleSheet.create({
21
12
  circle: {
22
13
  width: CIRCLE_SIZE,
@@ -113,7 +104,9 @@ export default class VerticalStep extends Component {
113
104
  items,
114
105
  currentStepColor,
115
106
  date,
116
- isVertical,
107
+ titleStyle,
108
+ descriptionStyle,
109
+ dateStyle,
117
110
  } = this.props;
118
111
  const icon =
119
112
  currentStep >= index + 2
@@ -182,24 +175,36 @@ export default class VerticalStep extends Component {
182
175
  alignItems: 'center',
183
176
  }}>
184
177
  <Text.Caption
185
- style={[{ marginLeft: 10 }, textFontStyle]}>
178
+ style={[
179
+ { marginLeft: 10 },
180
+ textFontStyle,
181
+ titleStyle,
182
+ ]}>
186
183
  {value}
187
184
  </Text.Caption>
188
- {currentStep >= index + 1 && (
189
- <Text style={styles.date}>{date}</Text>
190
- )}
191
- </View>
192
- <View>
193
- {typeof items[index] == 'string' ? (
194
- <Text style={[styles.description]}>
195
- {items[index]}
185
+ {date && currentStep >= index + 1 && (
186
+ <Text style={[styles.date, dateStyle]}>
187
+ {date[index]}
196
188
  </Text>
197
- ) : (
198
- <View style={[styles.description]}>
199
- {items[index]}
200
- </View>
201
189
  )}
202
190
  </View>
191
+ {items && (
192
+ <View>
193
+ {typeof items[index] == 'string' ? (
194
+ <Text
195
+ style={[
196
+ styles.description,
197
+ descriptionStyle,
198
+ ]}>
199
+ {items[index]}
200
+ </Text>
201
+ ) : (
202
+ <View style={[styles.description]}>
203
+ {items[index]}
204
+ </View>
205
+ )}
206
+ </View>
207
+ )}
203
208
  </View>
204
209
  </View>
205
210
  );
@@ -212,9 +217,13 @@ export default class VerticalStep extends Component {
212
217
 
213
218
  render() {
214
219
  return (
215
- <View style={[styles.containerStyle]} onLayout={this.onLayout}>
216
- <View style={[styles.circleColumn]}>{this.renderCircle()}</View>
217
- </View>
220
+ <ScrollView>
221
+ <View style={[styles.containerStyle]} onLayout={this.onLayout}>
222
+ <View style={[styles.circleColumn]}>
223
+ {this.renderCircle()}
224
+ </View>
225
+ </View>
226
+ </ScrollView>
218
227
  );
219
228
  }
220
229
  }
@@ -231,6 +240,9 @@ VerticalStep.propTypes = {
231
240
  lineColorInActive: PropTypes.string,
232
241
  borderColorActive: PropTypes.string,
233
242
  borderColorInActive: PropTypes.string,
243
+ titleStyle: PropTypes.object,
244
+ descriptionStyle: PropTypes.object,
245
+ dateStyle: PropTypes.object,
234
246
  };
235
247
 
236
248
  VerticalStep.defaultProps = {
package/Step.web.js CHANGED
@@ -31,7 +31,9 @@ Step.propTypes = {
31
31
  lineColorInActive: PropTypes.string,
32
32
  borderColorActive: PropTypes.string,
33
33
  borderColorInActive: PropTypes.string,
34
- titleFontSize: PropTypes.number,
34
+ titleStyle: PropTypes.object,
35
+ descriptionStyle: PropTypes.object,
36
+ dateStyle: PropTypes.object,
35
37
  };
36
38
 
37
39
  Step.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/step",
3
- "version": "0.0.43-beta.26",
3
+ "version": "0.0.43-beta.27",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "dependencies": {},