Skip to content

Commit 1de3ff3

Browse files
committed
Merge branch 'master' into release
2 parents d709be4 + 795528d commit 1de3ff3

File tree

109 files changed

+2041
-375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2041
-375
lines changed

demo/src/assets/icons/add.png

330 Bytes
Loading
516 Bytes
Loading
561 Bytes
Loading
815 Bytes
Loading
1.06 KB
Loading

demo/src/configurations.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Assets, Typography, Spacings} from 'react-native-ui-lib'; // eslint-disable-line
22

33
Assets.loadAssetsGroup('icons.demo', {
4+
add: require('./assets/icons/add.png'),
45
close: require('./assets/icons/close.png'),
56
dashboard: require('./assets/icons/dashboard.png'),
67
image: require('./assets/icons/image.png'),

demo/src/screens/MainScreen.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class MainScreen extends Component {
9898

9999
setDefaultScreen = item => {
100100
AsyncStorage.setItem('uilib.defaultScreen', item.screen);
101+
this.openScreen(item);
101102
};
102103

103104
openScreen = row => {
@@ -158,7 +159,7 @@ class MainScreen extends Component {
158159
hideUnderline
159160
floatingPlaceholder={false}
160161
text70
161-
rightButtonProps={{iconSource: Assets.icons.search, style: {marginRight: 12}}}
162+
rightButtonProps={{iconSource: Assets.icons.search, style: {marginRight: 12, alignSelf: 'center'}}}
162163
/>
163164
);
164165
};

demo/src/screens/MenuStructure.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ export const navigationData = {
100100
tags: 'scroll reach start end',
101101
screen: 'unicorn.components.WithScrollReachedScreen'
102102
},
103+
{
104+
title: 'Fader',
105+
tags: 'scroll fader',
106+
screen: 'unicorn.components.FaderScreen'
107+
},
103108
{title: 'Wizard', tags: 'wizard', screen: 'unicorn.components.WizardScreen'}
104109
]
105110
},
@@ -142,7 +147,8 @@ export const navigationData = {
142147
Incubator: {
143148
title: 'Incubator (Experimental)',
144149
screens: [
145-
{title: 'Native TouchableOpacity', tags: 'touchable native', screen: 'unicorn.incubator.TouchableOpacityScreen'}
150+
{title: 'Native TouchableOpacity', tags: 'touchable native', screen: 'unicorn.incubator.TouchableOpacityScreen'},
151+
{title: '(New) TextField', tags: 'text field input', screen: 'unicorn.components.IncubatorTextFieldScreen'}
146152
]
147153
},
148154
Inspirations: {

demo/src/screens/componentScreens/DrawerScreen.tsx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ const ITEMS = {
2424
read: {
2525
icon: require('../../assets/icons/mail.png'),
2626
text: 'Read',
27-
background: Colors.green30
27+
background: Colors.green30,
28+
testID: "left_item_read"
2829
},
2930
archive: {
3031
icon: require('../../assets/icons/archive.png'),
3132
text: 'Archive',
32-
background: Colors.blue30
33+
background: Colors.blue30,
34+
testID: "right_item_archive"
3335
},
3436
delete: {
3537
icon: require('../../assets/icons/delete.png'),
3638
text: 'Delete',
37-
background: Colors.red30
39+
background: Colors.red30,
40+
testID: "right_item_delete"
3841
}
3942
};
4043

@@ -131,18 +134,21 @@ class DrawerScreen extends Component {
131134
label="Open left"
132135
style={{margin: 3}}
133136
size={'xSmall'}
137+
testID="open_left_btn"
134138
/>
135139
<Button
136140
onPress={this.openLeftDrawerFull}
137141
label="Full left swipe"
138142
style={{margin: 3}}
139143
size={'xSmall'}
144+
testID="swipe_left_btn"
140145
/>
141146
<Button
142147
onPress={this.toggleLeftDrawer}
143148
label="Left toggle"
144149
style={{margin: 3}}
145150
size={'xSmall'}
151+
testID="toggle_left_btn"
146152
/>
147153
</View>
148154

@@ -152,6 +158,7 @@ class DrawerScreen extends Component {
152158
label="Close"
153159
style={{margin: 3}}
154160
size={'xSmall'}
161+
testID="close_btn"
155162
/>
156163
</View>
157164

@@ -161,12 +168,14 @@ class DrawerScreen extends Component {
161168
label="Open right"
162169
style={{margin: 3}}
163170
size={'xSmall'}
171+
testID="open_right_btn"
164172
/>
165173
<Button
166174
onPress={this.openRightDrawerFull}
167175
label="Full right swipe"
168176
style={{margin: 3}}
169177
size={'xSmall'}
178+
testID="swipe_right_btn"
170179
/>
171180
</View>
172181
</View>
@@ -175,6 +184,8 @@ class DrawerScreen extends Component {
175184
}
176185

177186
renderListItem() {
187+
const data = conversations[2];
188+
178189
return (
179190
<View
180191
bg-grey80
@@ -183,13 +194,14 @@ class DrawerScreen extends Component {
183194
row
184195
centerV
185196
style={{borderBottomWidth: 1, borderColor: Colors.grey60}}
197+
testID="drawer_item"
186198
>
187-
{this.state.unread && <Badge size={'pimpleSmall'} backgroundColor={Colors.red30} containerStyle={{marginRight: 8}}/>}
188-
<Avatar source={{uri: conversations[0].thumbnail}}/>
199+
{this.state.unread && <Badge testID="drawer_item_badge" size={'pimpleSmall'} backgroundColor={Colors.red30} containerStyle={{marginRight: 8}}/>}
200+
<Avatar source={{uri: data.thumbnail}}/>
189201
<View marginL-20>
190-
<Text text70R={!this.state.unread} text70BO={this.state.unread}>{conversations[0].name}</Text>
202+
<Text text70R={!this.state.unread} text70BO={this.state.unread}>{data.name}</Text>
191203
<Text text80 marginT-2>
192-
{conversations[0].text}
204+
{data.text}
193205
</Text>
194206
</View>
195207
</View>
@@ -218,14 +230,16 @@ class DrawerScreen extends Component {
218230
fullSwipeLeft,
219231
onWillFullSwipeLeft: this.deleteItem,
220232
onToggleSwipeLeft: this.toggleReadState,
221-
leftToggleHapticTrigger: this.triggerLeftToggleHaptic
233+
leftToggleHapticTrigger: this.triggerLeftToggleHaptic,
234+
testID: 'drawer'
222235
};
223236
if (showRightItems) {
224237
drawerProps.rightItems = [{...ITEMS.delete, onPress: this.deleteItem}, ITEMS.archive];
225238
}
226239

227240
if (showLeftItem) {
228241
drawerProps.leftItem = {
242+
...ITEMS.read,
229243
icon: this.state.unread ? require('../../assets/icons/mail.png') : require('../../assets/icons/refresh.png'),
230244
text: !this.state.unread ? 'Unread' : 'Read',
231245
background: this.state.unread ? Colors.green30 : Colors.orange30,
@@ -245,6 +259,7 @@ class DrawerScreen extends Component {
245259
iconSource={Assets.icons.demo.refresh}
246260
onPress={this.showItem}
247261
disabled={!hideItem}
262+
testID="refresh_btn"
248263
/>
249264
</View>
250265
{!hideItem && (
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import _ from 'lodash';
2+
import React, {Component} from 'react';
3+
import {StyleSheet, ScrollView} from 'react-native';
4+
import {
5+
Colors,
6+
Text,
7+
View,
8+
Fader,
9+
withScrollReached,
10+
WithScrollReachedProps
11+
} from 'react-native-ui-lib';
12+
import {renderHeader} from '../ExampleScreenPresenter';
13+
14+
const numberOfItems = 3;
15+
const faderPosition = Fader.position.BOTTOM;
16+
const itemWidth = 100;
17+
const itemHeight = 100;
18+
const tintColor = undefined;
19+
20+
const horizontal =
21+
faderPosition === Fader.position.LEFT ||
22+
faderPosition === Fader.position.RIGHT;
23+
24+
class FaderScreen extends Component<WithScrollReachedProps> {
25+
renderItem = (index: number) => {
26+
return (
27+
<View key={index} style={styles.item}>
28+
<Text>{index + 1}</Text>
29+
</View>
30+
);
31+
};
32+
33+
render() {
34+
const {scrollReachedProps} = this.props;
35+
const visible =
36+
faderPosition === Fader.position.BOTTOM ||
37+
faderPosition === Fader.position.RIGHT
38+
? !scrollReachedProps.isScrollAtEnd
39+
: !scrollReachedProps.isScrollAtStart;
40+
41+
return (
42+
<View margin-10>
43+
{renderHeader('Fader', {'marginB-10': true})}
44+
<View center>
45+
<View style={styles.container}>
46+
<ScrollView
47+
horizontal={horizontal}
48+
style={styles.scrollView}
49+
showsVerticalScrollIndicator={false}
50+
showsHorizontalScrollIndicator={false}
51+
scrollEventThrottle={16}
52+
onScroll={scrollReachedProps.onScroll}
53+
>
54+
{_.times(numberOfItems, this.renderItem)}
55+
</ScrollView>
56+
<Fader
57+
visible={visible}
58+
position={faderPosition}
59+
tintColor={tintColor}
60+
/>
61+
</View>
62+
</View>
63+
</View>
64+
);
65+
}
66+
}
67+
68+
export default withScrollReached(FaderScreen, {
69+
horizontal
70+
});
71+
72+
const styles = StyleSheet.create({
73+
container: {
74+
width: horizontal ? undefined : itemWidth,
75+
height: horizontal ? itemHeight : undefined
76+
},
77+
scrollView: {
78+
width: horizontal ? 240 : undefined,
79+
height: horizontal ? undefined : 240
80+
},
81+
item: {
82+
height: itemHeight,
83+
width: itemWidth,
84+
backgroundColor: Colors.grey60,
85+
borderColor: Colors.grey40,
86+
borderWidth: 2,
87+
alignItems: 'center',
88+
justifyContent: 'center'
89+
}
90+
});

0 commit comments

Comments
 (0)