unicorn-demo-app 6.9.2 → 6.10.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 +1 -1
- package/src/screens/MainScreen.js +1 -1
- package/src/screens/SettingsScreen.js +15 -14
- package/src/screens/componentScreens/CardScannerScreen.js +2 -1
- package/src/screens/componentScreens/GridViewScreen.tsx +110 -117
- package/src/screens/componentScreens/TabControllerScreen/index.tsx +20 -20
- package/src/screens/incubatorScreens/IncubatorChipsInputScreen.tsx +11 -12
package/package.json
CHANGED
|
@@ -20,12 +20,10 @@ class SettingsScreen extends Component {
|
|
|
20
20
|
screens: [
|
|
21
21
|
none,
|
|
22
22
|
playground,
|
|
23
|
-
..._.
|
|
24
|
-
.
|
|
25
|
-
.
|
|
26
|
-
.
|
|
27
|
-
.map(screen => ({label: screen.title, value: screen.screen}))
|
|
28
|
-
.value()
|
|
23
|
+
..._.flow(_.values,
|
|
24
|
+
screens => _.map(screens, 'screens'),
|
|
25
|
+
_.flatten,
|
|
26
|
+
screens => _.map(screens, screen => ({label: screen.title, value: screen.screen})))(data)
|
|
29
27
|
]
|
|
30
28
|
};
|
|
31
29
|
}
|
|
@@ -51,7 +49,7 @@ class SettingsScreen extends Component {
|
|
|
51
49
|
});
|
|
52
50
|
};
|
|
53
51
|
|
|
54
|
-
setDefaultScreen =
|
|
52
|
+
setDefaultScreen = screen => {
|
|
55
53
|
this.setState({defaultScreen: screen});
|
|
56
54
|
AsyncStorage.setItem('uilib.defaultScreen', screen.value);
|
|
57
55
|
setTimeout(() => {
|
|
@@ -85,25 +83,28 @@ class SettingsScreen extends Component {
|
|
|
85
83
|
|
|
86
84
|
<View style={{borderWidth: 1, borderColor: Colors.grey70, marginTop: 40}}>
|
|
87
85
|
<View style={[{padding: 5, borderBottomWidth: 1}, styles.block]}>
|
|
88
|
-
<Text text80 grey20>
|
|
86
|
+
<Text text80 grey20>
|
|
87
|
+
Current layout direction
|
|
88
|
+
</Text>
|
|
89
89
|
</View>
|
|
90
90
|
<View center margin-5 padding-10>
|
|
91
91
|
<Text text70>{isRTL ? 'RIGHT to LEFT' : 'LEFT to RIGHT'}</Text>
|
|
92
92
|
</View>
|
|
93
93
|
|
|
94
94
|
<View row spread centerV style={[{padding: 12, borderTopWidth: 1}, styles.block]}>
|
|
95
|
-
<Switch
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<Text text80 grey20>Force RTL</Text>
|
|
95
|
+
<Switch value={isRTL} onValueChange={this.onDirectionChange}/>
|
|
96
|
+
<Text text80 grey20>
|
|
97
|
+
Force RTL
|
|
98
|
+
</Text>
|
|
100
99
|
</View>
|
|
101
100
|
</View>
|
|
102
101
|
|
|
103
102
|
{extraSettingsUI?.()}
|
|
104
103
|
</View>
|
|
105
104
|
|
|
106
|
-
<Text text30 grey10>
|
|
105
|
+
<Text text30 grey10>
|
|
106
|
+
Settings
|
|
107
|
+
</Text>
|
|
107
108
|
<Toast visible={showRefreshMessage} position="bottom" message="Refresh the app!"/>
|
|
108
109
|
</View>
|
|
109
110
|
);
|
|
@@ -56,7 +56,8 @@ export default class CardScannerScreen extends Component {
|
|
|
56
56
|
<View paddingL-40 marginB-20>
|
|
57
57
|
<AnimatedScanner
|
|
58
58
|
backgroundColor={Colors.purple30}
|
|
59
|
-
progress={98}
|
|
59
|
+
progress={98}
|
|
60
|
+
duration={1600}
|
|
60
61
|
containerStyle={{backgroundColor: Colors.violet50, height: 6}}
|
|
61
62
|
/>
|
|
62
63
|
</View>
|
|
@@ -7,124 +7,119 @@ import products from '../../data/products';
|
|
|
7
7
|
|
|
8
8
|
class GridViewScreen extends Component {
|
|
9
9
|
state = {
|
|
10
|
-
contacts: _.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
style: {backgroundColor: Colors.grey60, borderWidth: 1, borderColor: Colors.grey50}
|
|
25
|
-
},
|
|
26
|
-
title: product.name,
|
|
27
|
-
titleTypography: 'subtextBold',
|
|
28
|
-
onPress: () => Alert.alert('My price is ' + product.formattedPrice),
|
|
29
|
-
renderOverlay: () => {
|
|
30
|
-
if (index < 7) {
|
|
31
|
-
return <Text text={product.price} style={{alignSelf: 'center', marginTop: 3}}/>;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}))
|
|
35
|
-
.value(),
|
|
36
|
-
pairs: _.chain(products)
|
|
37
|
-
.take(2)
|
|
38
|
-
.map(product => ({
|
|
39
|
-
containerProps: {useNative: true, activeScale: 0.97, activeOpacity: 1},
|
|
40
|
-
renderCustomItem: () => {
|
|
41
|
-
return (
|
|
42
|
-
<Card height={150} activeOpacity={1}>
|
|
43
|
-
<Card.Image style={{flex: 1}} source={{uri: product.mediaUrl}}/>
|
|
44
|
-
</Card>
|
|
45
|
-
);
|
|
46
|
-
},
|
|
47
|
-
title: product.name,
|
|
48
|
-
subtitle: (
|
|
49
|
-
<Text>
|
|
50
|
-
<Text style={{textDecorationLine: 'line-through', color: Colors.grey30}}>{product.formattedPrice}</Text>
|
|
51
|
-
<Text style={{textDecorationLine: 'none'}}> $50</Text>
|
|
52
|
-
</Text>
|
|
53
|
-
),
|
|
54
|
-
description: product.inventory.status,
|
|
55
|
-
descriptionLines: 2,
|
|
56
|
-
alignToStart: true,
|
|
57
|
-
onPress: () => Alert.alert('My price was ' + product.formattedPrice + ', now it is $50')
|
|
58
|
-
}))
|
|
59
|
-
.value(),
|
|
60
|
-
dynamicLayout: _.chain(products)
|
|
61
|
-
.take(3)
|
|
62
|
-
.map(product => ({
|
|
63
|
-
imageProps: {
|
|
64
|
-
source: {
|
|
65
|
-
uri: product.mediaUrl
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
itemSize: {height: 90},
|
|
69
|
-
title: 'Title',
|
|
70
|
-
subtitle: 'subtitle',
|
|
71
|
-
description: product.name,
|
|
72
|
-
descriptionLines: 2,
|
|
73
|
-
alignToStart: true,
|
|
74
|
-
onPress: () => Alert.alert('Click!')
|
|
75
|
-
}))
|
|
76
|
-
.value(),
|
|
77
|
-
overlayText: _.chain(products)
|
|
78
|
-
.take(2)
|
|
79
|
-
.map((product, index) => ({
|
|
80
|
-
imageProps: {
|
|
81
|
-
source: {
|
|
82
|
-
uri: product.mediaUrl
|
|
10
|
+
contacts: _.flow(conversations => _.take(conversations, 15),
|
|
11
|
+
(contacts: any[]) =>
|
|
12
|
+
_.map(contacts, contact => ({
|
|
13
|
+
imageProps: {source: {uri: contact.thumbnail}, borderRadius: 999, style: {backgroundColor: Colors.grey60}},
|
|
14
|
+
title: _.split(contact.name, ' ')[0],
|
|
15
|
+
onPress: () => Alert.alert('My name is ' + contact.name)
|
|
16
|
+
})))(conversations),
|
|
17
|
+
products: _.flow(products => _.take(products, 8),
|
|
18
|
+
(products: any[]) =>
|
|
19
|
+
_.map(products, (product, index) => ({
|
|
20
|
+
imageProps: {
|
|
21
|
+
source: {uri: product.mediaUrl},
|
|
22
|
+
borderRadius: 4,
|
|
23
|
+
style: {backgroundColor: Colors.grey60, borderWidth: 1, borderColor: Colors.grey50}
|
|
83
24
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
alignToStart: true,
|
|
99
|
-
onPress: () => Alert.alert('My price was ' + product.formattedPrice + ', now it is $50'),
|
|
100
|
-
renderOverlay: () => {
|
|
101
|
-
if (index === 0) {
|
|
25
|
+
title: product.name,
|
|
26
|
+
titleTypography: 'subtextBold',
|
|
27
|
+
onPress: () => Alert.alert('My price is ' + product.formattedPrice),
|
|
28
|
+
renderOverlay: () => {
|
|
29
|
+
if (index < 7) {
|
|
30
|
+
return <Text text={product.price} style={{alignSelf: 'center', marginTop: 3}}/>;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})))(products),
|
|
34
|
+
pairs: _.flow(products => _.take(products, 2),
|
|
35
|
+
(products: any[]) =>
|
|
36
|
+
_.map(products, product => ({
|
|
37
|
+
containerProps: {useNative: true, activeScale: 0.97, activeOpacity: 1},
|
|
38
|
+
renderCustomItem: () => {
|
|
102
39
|
return (
|
|
103
|
-
<
|
|
104
|
-
{product.
|
|
105
|
-
</
|
|
40
|
+
<Card height={150} activeOpacity={1}>
|
|
41
|
+
<Card.Image style={{flex: 1}} source={{uri: product.mediaUrl}}/>
|
|
42
|
+
</Card>
|
|
106
43
|
);
|
|
44
|
+
},
|
|
45
|
+
title: product.name,
|
|
46
|
+
subtitle: (
|
|
47
|
+
<Text>
|
|
48
|
+
<Text style={{textDecorationLine: 'line-through', color: Colors.grey30}}>{product.formattedPrice}</Text>
|
|
49
|
+
<Text style={{textDecorationLine: 'none'}}> $50</Text>
|
|
50
|
+
</Text>
|
|
51
|
+
),
|
|
52
|
+
description: product.inventory.status,
|
|
53
|
+
descriptionLines: 2,
|
|
54
|
+
alignToStart: true,
|
|
55
|
+
onPress: () => Alert.alert('My price was ' + product.formattedPrice + ', now it is $50')
|
|
56
|
+
})))(products),
|
|
57
|
+
dynamicLayout: _.flow(products => _.take(products, 3),
|
|
58
|
+
(products: any[]) =>
|
|
59
|
+
_.map(products, product => ({
|
|
60
|
+
imageProps: {
|
|
61
|
+
source: {
|
|
62
|
+
uri: product.mediaUrl
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
itemSize: {height: 90},
|
|
66
|
+
title: 'Title',
|
|
67
|
+
subtitle: 'subtitle',
|
|
68
|
+
description: product.name,
|
|
69
|
+
descriptionLines: 2,
|
|
70
|
+
alignToStart: true,
|
|
71
|
+
onPress: () => Alert.alert('Click!')
|
|
72
|
+
})))(products),
|
|
73
|
+
overlayText: _.flow(products => _.take(products, 2),
|
|
74
|
+
(products: any[]) =>
|
|
75
|
+
_.map(products, (product, index) => ({
|
|
76
|
+
imageProps: {
|
|
77
|
+
source: {
|
|
78
|
+
uri: product.mediaUrl
|
|
79
|
+
},
|
|
80
|
+
overlayType: Image.overlayTypes.VERTICAL,
|
|
81
|
+
overlayColor: Colors.white
|
|
82
|
+
},
|
|
83
|
+
itemSize: {height: 240},
|
|
84
|
+
overlayText: true,
|
|
85
|
+
title: product.name,
|
|
86
|
+
subtitle: (
|
|
87
|
+
<Text>
|
|
88
|
+
<Text style={{textDecorationLine: 'line-through', color: Colors.grey30}}>{product.formattedPrice}</Text>
|
|
89
|
+
<Text style={{textDecorationLine: 'none'}}>{product.formattedPrice}</Text>
|
|
90
|
+
</Text>
|
|
91
|
+
),
|
|
92
|
+
description: '4 items',
|
|
93
|
+
descriptionLines: 2,
|
|
94
|
+
alignToStart: true,
|
|
95
|
+
onPress: () => Alert.alert('My price was ' + product.formattedPrice + ', now it is $50'),
|
|
96
|
+
renderOverlay: () => {
|
|
97
|
+
if (index === 0) {
|
|
98
|
+
return (
|
|
99
|
+
<Text margin-10 text80BO style={{alignSelf: 'flex-start', marginTop: 12, marginLeft: 12}}>
|
|
100
|
+
{product.formattedPrice}
|
|
101
|
+
</Text>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
107
104
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}))
|
|
127
|
-
.value(),
|
|
105
|
+
})))(products),
|
|
106
|
+
|
|
107
|
+
avatars: _.flow(products => _.take(products, 9),
|
|
108
|
+
(products: any[]) =>
|
|
109
|
+
_.map(products, item => ({
|
|
110
|
+
renderCustomItem: () => {
|
|
111
|
+
const imageElementElement = item.thumbnail;
|
|
112
|
+
return (
|
|
113
|
+
<View flex center marginB-10>
|
|
114
|
+
<Avatar size={100} source={{uri: imageElementElement}}/>
|
|
115
|
+
</View>
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
onPress: () => Alert.alert('Your choose is ' + item.name),
|
|
119
|
+
title: item.name,
|
|
120
|
+
titleLines: 2,
|
|
121
|
+
titleTypography: 'bodySmall'
|
|
122
|
+
})))(products),
|
|
128
123
|
squares: [Colors.red30, Colors.yellow30, Colors.blue30, Colors.violet30, Colors.green30].map(color => ({
|
|
129
124
|
renderCustomItem: () => <View height={50} backgroundColor={color}/>
|
|
130
125
|
})),
|
|
@@ -179,9 +174,7 @@ class GridViewScreen extends Component {
|
|
|
179
174
|
<GridView items={pairs} numColumns={2}/>
|
|
180
175
|
<Text marginV-s5 text60BO>
|
|
181
176
|
Dynamic itemSize
|
|
182
|
-
<Text text90>
|
|
183
|
-
{' '} (Using maxItemWidth)
|
|
184
|
-
</Text>
|
|
177
|
+
<Text text90> (Using maxItemWidth)</Text>
|
|
185
178
|
</Text>
|
|
186
179
|
<GridView items={dynamicLayout} maxItemWidth={120}/>
|
|
187
180
|
<Text marginV-s5 text60BO>
|
|
@@ -37,17 +37,16 @@ class TabControllerScreen extends Component<{}, State> {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
generateTabItems = (fewItems = this.state.fewItems): TabControllerItemProps[] => {
|
|
40
|
-
const items: TabControllerItemProps[] = _.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.value();
|
|
40
|
+
const items: TabControllerItemProps[] = _.flow(tabs => _.take(tabs, fewItems ? 3 : TABS.length),
|
|
41
|
+
(tabs: TabControllerItemProps[]) =>
|
|
42
|
+
_.map<TabControllerItemProps>(tabs, (tab: TabControllerItemProps, index: number) => ({
|
|
43
|
+
label: tab,
|
|
44
|
+
key: tab,
|
|
45
|
+
icon: index === 2 ? Assets.icons.demo.dashboard : undefined,
|
|
46
|
+
badge: index === 5 ? {label: '2'} : undefined,
|
|
47
|
+
leadingAccessory: index === 3 ? <Text marginR-4>{Assets.emojis.movie_camera}</Text> : undefined,
|
|
48
|
+
trailingAccessory: index === 4 ? <Text marginL-4>{Assets.emojis.camera}</Text> : undefined
|
|
49
|
+
})))(TABS);
|
|
51
50
|
|
|
52
51
|
const addItem: TabControllerItemProps = {
|
|
53
52
|
icon: Assets.icons.demo.add,
|
|
@@ -134,15 +133,16 @@ class TabControllerScreen extends Component<{}, State> {
|
|
|
134
133
|
<Tab3/>
|
|
135
134
|
</TabController.TabPage>
|
|
136
135
|
|
|
137
|
-
{!fewItems &&
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
{!fewItems &&
|
|
137
|
+
_.map(_.takeRight(TABS, TABS.length - 3), (title, index) => {
|
|
138
|
+
return (
|
|
139
|
+
<TabController.TabPage key={title} index={index + 3}>
|
|
140
|
+
<View padding-s5>
|
|
141
|
+
<Text text40>{title}</Text>
|
|
142
|
+
</View>
|
|
143
|
+
</TabController.TabPage>
|
|
144
|
+
);
|
|
145
|
+
})}
|
|
146
146
|
</Container>
|
|
147
147
|
);
|
|
148
148
|
}
|
|
@@ -31,18 +31,17 @@ export default class ChipsInputScreen extends Component {
|
|
|
31
31
|
chips={this.state.chips}
|
|
32
32
|
leadingAccessory={<Text>TO: </Text>}
|
|
33
33
|
onChange={newChips => {
|
|
34
|
-
_.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.values
|
|
44
|
-
.flatten()
|
|
45
|
-
.value();
|
|
34
|
+
_.flow(newChips => _.groupBy(newChips, 'label'),
|
|
35
|
+
newChips =>
|
|
36
|
+
_.forEach(newChips, group => {
|
|
37
|
+
if (group.length === 1) {
|
|
38
|
+
delete group[0].invalid;
|
|
39
|
+
} else {
|
|
40
|
+
group[group.length - 1].invalid = true;
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
_.values,
|
|
44
|
+
_.flatten)(newChips);
|
|
46
45
|
|
|
47
46
|
this.setState({chips: newChips});
|
|
48
47
|
}}
|