unicorn-demo-app 6.12.2 → 6.13.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unicorn-demo-app",
3
- "version": "6.12.2",
3
+ "version": "6.13.0",
4
4
  "main": "src/index.js",
5
5
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
6
6
  "license": "MIT",
@@ -118,6 +118,46 @@ const products = [
118
118
  quantity: 8
119
119
  },
120
120
  mediaUrl: 'https://static.wixstatic.com/media/84770f_c611ded729fd4461a1bb57134d4e9dd2.png_128'
121
+ },
122
+ {
123
+ name: 'I\'m a Product',
124
+ formattedPrice: '$19.99',
125
+ inventory: {
126
+ trackingMethod: 'status',
127
+ status: 'In Stock',
128
+ quantity: 3
129
+ },
130
+ mediaUrl: 'https://images.pexels.com/photos/3612182/pexels-photo-3612182.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=150'
131
+ },
132
+ {
133
+ name: 'I\'m a Product',
134
+ formattedPrice: '$19.99',
135
+ inventory: {
136
+ trackingMethod: 'status',
137
+ status: 'In Stock',
138
+ quantity: 22
139
+ },
140
+ mediaUrl: 'https://images.pexels.com/photos/4841529/pexels-photo-4841529.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=150'
141
+ },
142
+ {
143
+ name: 'I\'m a Product',
144
+ formattedPrice: '$19.99',
145
+ inventory: {
146
+ trackingMethod: 'status',
147
+ status: 'In Stock',
148
+ quantity: 10
149
+ },
150
+ mediaUrl: 'https://images.pexels.com/photos/4173450/pexels-photo-4173450.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=150'
151
+ },
152
+ {
153
+ name: 'I\'m a Product',
154
+ formattedPrice: '$19.99',
155
+ inventory: {
156
+ trackingMethod: 'status',
157
+ status: 'In Stock',
158
+ quantity: 10
159
+ },
160
+ mediaUrl: 'https://images.pexels.com/photos/10513273/pexels-photo-10513273.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=150'
121
161
  }
122
162
  ];
123
163
 
@@ -24,7 +24,7 @@ interface RadioGroupOptions {
24
24
 
25
25
  export function renderHeader(title: string, others: TextProps) {
26
26
  return (
27
- <Text text30 grey10 {...others}>
27
+ <Text text30 $textDefault {...others}>
28
28
  {title}
29
29
  </Text>
30
30
  );
@@ -35,7 +35,7 @@ export function renderBooleanOption(title: string, key: string) {
35
35
  const value = this.state[key];
36
36
  return (
37
37
  <View row centerV spread marginB-s4 key={key}>
38
- <Text flex>{title}</Text>
38
+ <Text $textDefault flex>{title}</Text>
39
39
  <Switch
40
40
  useCustomTheme
41
41
  key={key}
@@ -51,7 +51,7 @@ export function renderBooleanOption(title: string, key: string) {
51
51
  export function renderBooleanGroup(title: string, options: string[]) {
52
52
  return (
53
53
  <View marginB-s2>
54
- <Text text70M marginB-s2>
54
+ <Text text70M $textDefault marginB-s2>
55
55
  {title}
56
56
  </Text>
57
57
  <View row style={styles.rowWrap}>
@@ -69,7 +69,7 @@ export function renderBooleanGroup(title: string, options: string[]) {
69
69
  // @ts-ignore
70
70
  onValueChange={value => this.setState({[key]: value})}
71
71
  />
72
- <Text text70 marginR-s3 marginB-s2>
72
+ <Text text70 marginR-s3 $textDefault marginB-s2>
73
73
  {key}
74
74
  </Text>
75
75
  </View>
@@ -89,7 +89,7 @@ export function renderRadioGroup(title: string,
89
89
  return (
90
90
  <View marginB-s2>
91
91
  {!_.isUndefined(title) && (
92
- <Text text70M marginB-s2>
92
+ <Text text70M $textDefault marginB-s2>
93
93
  {title}
94
94
  </Text>
95
95
  )}
@@ -125,7 +125,7 @@ export function renderColorOption(title: string,
125
125
  const value = this.state[key];
126
126
  return (
127
127
  <View marginV-s2>
128
- <Text text70M>{title}</Text>
128
+ <Text text70M $textDefault>{title}</Text>
129
129
  <ColorPalette
130
130
  value={value}
131
131
  colors={colors}
@@ -143,7 +143,7 @@ export function renderSliderOption(title: string,
143
143
  const value = this.state[key] || initial;
144
144
  return (
145
145
  <View marginV-s2>
146
- <Text marginB-s1 text70M>
146
+ <Text marginB-s1 text70M $textDefault>
147
147
  {title}
148
148
  </Text>
149
149
  <View row centerV>
@@ -157,7 +157,7 @@ export function renderSliderOption(title: string,
157
157
  // @ts-ignore
158
158
  onValueChange={value => this.setState({[key]: value})}
159
159
  />
160
- <Text marginL-s4 text70 style={styles.text}>
160
+ <Text marginL-s4 text70 $textDefault style={styles.text}>
161
161
  {sliderText}
162
162
  {value}
163
163
  </Text>
@@ -173,7 +173,7 @@ export function renderMultipleSegmentOptions(title: string, key: string, options
173
173
 
174
174
  return (
175
175
  <View row centerV spread marginB-s4 key={key}>
176
- {!!title && <Text marginR-s2>{title}</Text>}
176
+ {!!title && <Text $textDefault marginR-s2>{title}</Text>}
177
177
  <SegmentedControl
178
178
  initialIndex={index}
179
179
  segments={options}
@@ -112,6 +112,8 @@ export const navigationData = {
112
112
  screen: 'unicorn.components.FaderScreen'
113
113
  },
114
114
  {title: 'Wizard', tags: 'wizard', screen: 'unicorn.components.WizardScreen'},
115
+ {title: 'GridList', tags: 'grid list', screen: 'unicorn.components.GridListScreen'},
116
+ {title: 'SortableGridList', tags: 'sort grid list drag', screen: 'unicorn.components.SortableGridListScreen'},
115
117
  {title: 'GridView', tags: 'grid view', screen: 'unicorn.components.GridViewScreen'}
116
118
  ]
117
119
  },
@@ -1,19 +1,19 @@
1
1
  import _ from 'lodash';
2
2
  import React, {Component} from 'react';
3
- import {ScrollView, View, Text, StyleSheet, Alert} from 'react-native';
4
- import {Avatar, AvatarHelper, Colors, Typography} from 'react-native-ui-lib'; //eslint-disable-line
3
+ import {ScrollView, StyleSheet, Alert} from 'react-native';
4
+ import {Avatar, AvatarHelper, View, Text, Colors, Typography} from 'react-native-ui-lib'; //eslint-disable-line
5
5
 
6
6
 
7
7
  const star = require('../../assets/icons/star.png');
8
- const onlineColor = Colors.green30;
8
+ const onlineColor = Colors.$backgroundSuccessHeavy;
9
9
  const examples = [
10
10
  {title: 'Custom Background', backgroundColor: Colors.violet60},
11
11
  {title: 'Empty Avatar with ribbon', ribbonLabel: 'New'},
12
12
  {
13
13
  title: 'Initials with Color',
14
14
  label: 'AD',
15
- backgroundColor: Colors.yellow60,
16
- labelColor: Colors.orange20,
15
+ backgroundColor: Colors.$backgroundWarning,
16
+ labelColor: Colors.$textMajor,
17
17
  ribbonLabel: 'New',
18
18
  ribbonStyle: {backgroundColor: Colors.purple30}
19
19
  },
@@ -24,7 +24,7 @@ const examples = [
24
24
  uri:
25
25
  'https://lh3.googleusercontent.com/-cw77lUnOvmI/AAAAAAAAAAI/AAAAAAAAAAA/WMNck32dKbc/s181-c/104220521160525129167.jpg'
26
26
  },
27
- badgeProps: {size: 10, backgroundColor: Colors.yellow30},
27
+ badgeProps: {size: 10, backgroundColor: Colors.$backgroundWarningHeavy},
28
28
  badgePosition: 'BOTTOM_RIGHT'
29
29
  },
30
30
 
@@ -35,7 +35,7 @@ const examples = [
35
35
  uri:
36
36
  'https://lh3.googleusercontent.com/-CMM0GmT5tiI/AAAAAAAAAAI/AAAAAAAAAAA/-o9gKbC6FVo/s181-c/111308920004613908895.jpg'
37
37
  },
38
- badgeProps: {size: 10, backgroundColor: Colors.grey50},
38
+ badgeProps: {size: 10, backgroundColor: Colors.$backgroundDisabled},
39
39
  badgePosition: 'BOTTOM_LEFT'
40
40
  },
41
41
  {
@@ -65,8 +65,8 @@ const examples = [
65
65
  icon: star,
66
66
  size: 14,
67
67
  borderWidth: 1.5,
68
- borderColor: Colors.white,
69
- iconStyle: {backgroundColor: Colors.yellow20}
68
+ borderColor: Colors.$outlineLight,
69
+ iconStyle: {backgroundColor: Colors.$backgroundWarningHeavy}
70
70
  }
71
71
  },
72
72
  {
@@ -79,7 +79,7 @@ const examples = [
79
79
  {
80
80
  title: 'Invalid Gravatar (see logs)',
81
81
  label: '🤦',
82
- backgroundColor: Colors.grey60,
82
+ backgroundColor: Colors.$backgroundNeutralMedium,
83
83
  source: {uri: 'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=404'},
84
84
  onImageLoadStart: () => console.log('AvatarScreen: Invalid avatar load STARTED...'), // eslint-disable-line
85
85
  onImageLoadEnd: () => console.log('AvatarScreen: Invalid avatar load ENDED'), // eslint-disable-line
@@ -88,26 +88,26 @@ const examples = [
88
88
  {
89
89
  title: 'Monitored Avatar (see logs)',
90
90
  label: '?!',
91
- backgroundColor: Colors.blue20,
91
+ backgroundColor: Colors.$backgroundGeneralHeavy,
92
92
  source: {uri: 'https://static.altomusic.com/media/catalog/product/M/A/MAJ100SBK_0.jpg'},
93
93
  onImageLoadStart: () => console.log('AvatarScreen: Monitored avatar load STARTED...'), // eslint-disable-line
94
94
  onImageLoadEnd: () => console.log('AvatarScreen: Monitored avatar load ENDED') // eslint-disable-line
95
95
  },
96
96
  {
97
97
  title: 'Empty Gravatar',
98
- backgroundColor: Colors.red60,
98
+ backgroundColor: Colors.$backgroundDanger,
99
99
  source: {uri: 'https://www.gravatar.com/avatar/2497473d558a37020c558bf26e380a7c?d=blank'}
100
100
  },
101
101
  {
102
102
  title: 'With custom badge label',
103
103
  label: 'LD',
104
- backgroundColor: Colors.red60,
104
+ backgroundColor: Colors.$backgroundDanger,
105
105
  badgePosition: 'BOTTOM_RIGHT',
106
106
  badgeProps: {
107
107
  label: '+2',
108
108
  size: 24,
109
109
  borderWidth: 1.5,
110
- borderColor: Colors.white
110
+ borderColor: Colors.$outlineLight
111
111
  }
112
112
  }
113
113
  ];
@@ -130,7 +130,7 @@ export default class AvatarsScreen extends Component {
130
130
  <ScrollView contentContainerStyle={styles.container}>
131
131
  {_.map(examples, (example, i) => (
132
132
  <View key={i} style={styles.section}>
133
- <Text style={{...Typography.text80}}>{example.title}</Text>
133
+ <Text $textDefault style={{...Typography.text80}}>{example.title}</Text>
134
134
  <Avatar containerStyle={{marginVertical: 5}} {...example} onPress={() => this.onAvatarPress(example)}/>
135
135
  </View>
136
136
  ))}
@@ -141,7 +141,8 @@ export default class AvatarsScreen extends Component {
141
141
 
142
142
  const styles = StyleSheet.create({
143
143
  container: {
144
- padding: 25
144
+ padding: 25,
145
+ backgroundColor: Colors.$backgroundDefault
145
146
  },
146
147
  section: {
147
148
  flexDirection: 'row',
@@ -1,11 +1,8 @@
1
1
  import React, {Component} from 'react';
2
2
  import {ScrollView, StyleSheet} from 'react-native';
3
- import {Colors, View, Badge, Button, Text, Image} from 'react-native-ui-lib'; //eslint-disable-line
4
-
3
+ import {Colors, View, Badge, Text, Image, Stepper} from 'react-native-ui-lib'; //eslint-disable-line
5
4
 
6
5
  const BadgesSpace = 30;
7
- const plusIcon = require('../../assets/icons/chevronUp.png');
8
- const minusIcon = require('../../assets/icons/chevronDown.png');
9
6
  const star = require('../../assets/icons/star.png');
10
7
  const bell = require('../../assets/icons/bell.png');
11
8
 
@@ -22,165 +19,149 @@ export default class BadgesScreen extends Component {
22
19
  }
23
20
  }
24
21
 
25
- render() {
26
- const customElement1 = (
27
- <View row>
28
- <Image source={bell}/>
29
- <Image source={bell}/>
30
- </View>
31
- );
22
+ customElement1 = (
23
+ <View row>
24
+ <Image source={bell}/>
25
+ <Image source={bell}/>
26
+ </View>
27
+ );
28
+
29
+ customElement2 = (
30
+ <View row>
31
+ <Image source={bell}/>
32
+ <Text white text90>
33
+ 37
34
+ </Text>
35
+ <Image source={bell}/>
36
+ </View>
37
+ );
38
+
39
+ onValueChange = (value: number, _?: string) => {
40
+ this.setState({value});
41
+ };
32
42
 
33
- const customElement2 = (
34
- <View row>
35
- <Image source={bell}/>
36
- <Text white text90>
37
- 37
38
- </Text>
39
- <Image source={bell}/>
40
- </View>
41
- );
43
+ render() {
44
+ const {value} = this.state;
42
45
 
43
46
  return (
44
- <ScrollView style={{backgroundColor: Colors.grey70}} contentContainerStyle={styles.container}>
45
- <Text text50 row center marginB-15>
47
+ <View flex>
48
+ <Text h1 $textDefault margin-20>
46
49
  Badges
47
50
  </Text>
48
- <View row center style={{alignItems: 'flex-start'}}>
49
- <View center paddingH-10>
50
- <Badge size={20} label={this.state.value.toString()} backgroundColor={Colors.red30}/>
51
- <Badge
52
- label={this.state.value.toString()}
53
- containerStyle={{marginTop: BadgesSpace}}
54
- backgroundColor={Colors.red30}
55
- borderWidth={1}
56
- />
57
- <Badge
58
- size={16}
59
- label={this.state.value.toString()}
60
- containerStyle={{marginTop: BadgesSpace}}
61
- backgroundColor={Colors.red30}
62
- />
63
- </View>
64
51
 
65
- <View center paddingH-10>
52
+ <ScrollView contentContainerStyle={styles.container} showsVerticalScrollIndicator={false}>
53
+ <View row spread>
66
54
  <Badge label={'9999'} labelFormatterLimit={3}/>
67
55
  <Badge
68
56
  label={'999'}
69
57
  labelFormatterLimit={2}
70
- containerStyle={{marginTop: BadgesSpace}}
71
58
  borderWidth={2}
72
59
  borderColor={Colors.white}
73
60
  />
74
- <Badge labelFormatterLimit={1} size={16} label={'99999999'} containerStyle={{marginTop: BadgesSpace}}/>
75
- </View>
76
- </View>
77
-
78
- <View row paddingT-20 marginB-15>
79
- <Button
80
- bg-grey60
81
- style={{width: 30, height: 30, borderWidth: 1, marginRight: 15}}
82
- iconSource={minusIcon}
83
- avoidMinWidth
84
- onPress={() => this.changeLabelValue(-1)}
85
- onLongPress={() => this.changeLabelValue(-10)}
86
- />
87
- <Button
88
- bg-grey60
89
- style={{width: 30, height: 30, borderWidth: 1}}
90
- iconSource={plusIcon}
91
- avoidMinWidth
92
- onPress={() => this.changeLabelValue(1)}
93
- onLongPress={() => this.changeLabelValue(10)}
94
- />
95
- </View>
96
- <Text center>Press buttons to change red badge value by 1.{'\n'}Long press to change it by 10.</Text>
97
-
98
- <Text text50 row center marginT-40>
99
- Pimple Badges
100
- </Text>
101
- <View row>
102
- <View
103
- center
104
- style={{justifyContent: 'space-around', alignItems: 'flex-start', width: 140, height: 140}}
105
- >
106
- <Text text80 row>
107
- size={'{6}'}
108
- </Text>
109
- <Text text80>size={'{10}'}</Text>
110
- <Text text80 row>
111
- size={'{14}'}
112
- </Text>
61
+ <Badge labelFormatterLimit={1} size={16} label={'99999999'}/>
113
62
  </View>
114
63
 
115
- <View center style={{justifyContent: 'space-around', width: 40, height: 140}}>
116
- <Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.green30} size={6}/>
117
- <Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.red30} size={10}/>
118
- <Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.blue30} size={14}/>
64
+ <View row spread marginV-20>
65
+ <Badge size={20} label={value.toString()} backgroundColor={Colors.red30}/>
66
+ <Badge
67
+ label={value.toString()}
68
+ backgroundColor={Colors.red30}
69
+ borderWidth={1}
70
+ borderColor={Colors.$outlinePrimary}
71
+ />
72
+ <Badge
73
+ size={16}
74
+ label={value.toString()}
75
+ backgroundColor={Colors.red30}
76
+ />
119
77
  </View>
120
- </View>
121
- <Text text50 marginB-10 row center marginT-25>
122
- Icon Badges
123
- </Text>
124
- <View row paddingH-15>
125
- <View style={styles.iconBadgeColumnContainer}>
126
- <Badge size={16} icon={star} borderWidth={1} borderColor={Colors.red30}/>
127
- <Text text80 style={{marginTop: 10}}>
128
- small(16)
129
- </Text>
78
+ <View center>
79
+ <Stepper onValueChange={this.onValueChange} value={value} maxValue={100} minValue={1}/>
130
80
  </View>
131
-
132
- <View style={styles.iconBadgeColumnContainer}>
133
- <Badge icon={star} iconStyle={{tintColor: Colors.red30}}/>
134
- <Text text80 style={{marginTop: 10}}>
135
- default(20)
136
- </Text>
81
+ <Text center $textDefault marginT-10>Press buttons to change red badge value by 1.{'\n'}Long press to change it by 10.</Text>
82
+
83
+ <Text row center text50 $textDefault marginT-40 >
84
+ Pimple Badges
85
+ </Text>
86
+ <View row>
87
+ <View center style={{justifyContent: 'space-around', alignItems: 'flex-start', width: 140, height: 140}}>
88
+ <Text row text80 $textDefault>
89
+ size={'{6}'}
90
+ </Text>
91
+ <Text text80 $textDefault>size={'{10}'}</Text>
92
+ <Text row text80 $textDefault>
93
+ size={'{14}'}
94
+ </Text>
95
+ </View>
96
+ <View center style={{justifyContent: 'space-around', width: 40, height: 140}}>
97
+ <Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.green30} size={6}/>
98
+ <Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.red30} size={10}/>
99
+ <Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.blue30} size={14}/>
100
+ </View>
137
101
  </View>
138
102
 
139
- <View style={styles.iconBadgeColumnContainer}>
140
- <Badge size={24} icon={star} iconStyle={{backgroundColor: Colors.red30}}/>
141
- <Text text80 style={{marginTop: 10}}>
142
- large(24)
143
- </Text>
103
+ <Text row center text50 $textDefault margin-25>
104
+ Icon Badges
105
+ </Text>
106
+ <View row spread>
107
+ <View center>
108
+ <Badge
109
+ size={16}
110
+ icon={star}
111
+ borderWidth={1}
112
+ borderColor={Colors.red30}
113
+ iconStyle={{tintColor: Colors.red30}}
114
+ />
115
+ <Text $textDefault text80 style={{marginTop: 10}}>
116
+ small(16)
117
+ </Text>
118
+ </View>
119
+
120
+ <View center>
121
+ <Badge icon={star} iconStyle={{tintColor: Colors.red30}}/>
122
+ <Text $textDefault text80 style={{marginTop: 10}}>
123
+ default(20)
124
+ </Text>
125
+ </View>
126
+
127
+ <View center>
128
+ <Badge size={24} icon={star} iconStyle={{backgroundColor: Colors.red30}}/>
129
+ <Text $textDefault text80 style={{marginTop: 10}}>
130
+ large(24)
131
+ </Text>
132
+ </View>
133
+
134
+ <View center>
135
+ <Badge icon={star} borderRadius={6} iconStyle={{backgroundColor: Colors.red30}}/>
136
+ <Text $textDefault text80 style={{marginTop: 10}}>
137
+ border radius
138
+ </Text>
139
+ </View>
144
140
  </View>
145
141
 
146
- <View style={styles.iconBadgeColumnContainer}>
147
- <Badge icon={star} borderRadius={6} iconStyle={{backgroundColor: Colors.red30}}/>
148
- <Text text80 style={{marginTop: 10}}>
149
- border radius
150
- </Text>
142
+ <Text row center text50 $textDefault margin-25>
143
+ Counter Icon Badges
144
+ </Text>
145
+ <View row spread marginH-50>
146
+ <Badge marginR-10 label={'9999'} labelFormatterLimit={3} icon={bell} backgroundColor={Colors.red30}/>
147
+ <Badge marginR-10 label={'4'} icon={bell} backgroundColor={Colors.red30}/>
151
148
  </View>
152
- </View>
153
-
154
- <Text text50 marginB-10 row center marginT-25>
155
- Counter Icon Badges
156
- </Text>
157
- <View row paddingH-15>
158
- <Badge marginR-10 label={'9999'} labelFormatterLimit={3} icon={bell} backgroundColor={Colors.red30}/>
159
- <Badge marginR-10 label={'4'} icon={bell} backgroundColor={Colors.red30}/>
160
- </View>
161
149
 
162
- <Text text50 marginB-10 row center marginT-25>
163
- Custom Element Badges
164
- </Text>
165
- <View row paddingH-15>
166
- <Badge marginR-10 label={'17'} customElement={customElement1}/>
167
- <Badge marginR-10 customElement={customElement2} backgroundColor={Colors.grey30}/>
168
- </View>
169
- </ScrollView>
150
+ <Text row center text50 $textDefault margin-25>
151
+ Custom Element Badges
152
+ </Text>
153
+ <View row spread marginH-50>
154
+ <Badge marginR-10 label={'17'} customElement={this.customElement1}/>
155
+ <Badge marginR-10 customElement={this.customElement2} backgroundColor={Colors.grey30}/>
156
+ </View>
157
+ </ScrollView>
158
+ </View>
170
159
  );
171
160
  }
172
161
  }
173
162
 
174
163
  const styles = StyleSheet.create({
175
164
  container: {
176
- alignItems: 'center',
177
- padding: 20,
178
- backgroundColor: Colors.grey70
179
- },
180
- iconBadgeColumnContainer: {
181
- flex: 1,
182
- justifyContent: 'space-between',
183
- alignItems: 'center',
184
- flexDirection: 'column'
165
+ padding: 20
185
166
  }
186
167
  });