Skip to content

Commit b4db924

Browse files
committed
Merge branch 'master' into Infra/eslint-v2
* master: (77 commits) Button - refactor into smaller files (#1168) replace @react-native-community/picker with @react-native-picker/picker (#1063) Update generate types fix: catch undefined StatusBarManager (#1189) prop value shape deprecation lint rule (#1094) Infra/expo app fixes (#1166) Safe require blur-view dependency in Card (#1179) Update our stars count Update expo snack link with only supported platforms Export TabBarProps and fix BadgeScreen typescript errors Disable flipper Avoid passing overlayContent in CardSecion (#1187) Fix Carousel typings updating published version no-direct-import eslint rule - adding `applyAutofix` flag (#1183) Feat/image demo broken (#1173) Remove addItems from screen with fewItems Add vertical scroll to Carousel component (#1175) Fix Carousel gif Update Carousel gifs ... # Conflicts: # eslint-rules/lib/rules/typography-deprecation.js # eslint-rules/package.json # eslint-rules/tests/lib/rules/typography-deprecation.js # eslint-rules/tests/typography_deprecation.json
2 parents fe691d3 + db258d5 commit b4db924

File tree

218 files changed

+4659
-2075
lines changed

Some content is hidden

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

218 files changed

+4659
-2075
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
*Enter description to help the reviewer understand what's the change about...*
33

44
## Changelog
5-
*Add a quick message for our users about this change*
5+
*Add a quick message for our users about this change (include Compoennt name, relevant props and general purpose of the PR)*

README.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
<p align="center">
2-
UI Toolset & Components Library for React Native
3-
<img src="https://user-images.githubusercontent.com/1780255/64093084-a11b0300-cd5f-11e9-9175-a7b4d2b717a7.png"/>
2+
<img src="https://user-images.githubusercontent.com/1780255/105469025-56759000-5ca0-11eb-993d-3568c1fd54f4.png" height="250px" style="display:block"/>
3+
</p>
4+
<p align="center">UI Toolset & Components Library for React Native</p>
5+
<p align="center">
6+
<img src="https://user-images.githubusercontent.com/1780255/105469340-bec47180-5ca0-11eb-8986-3eb986f884d9.jpg"/>
47
</p>
58

6-
<table>
7-
<tr>
8-
<td>
9-
<img height="500" src="https://user-images.githubusercontent.com/1780255/72094962-3044b280-3320-11ea-8e41-aa83743bafb9.gif">
10-
</td>
11-
<td>
12-
<img height="500" src="https://user-images.githubusercontent.com/1780255/72094961-3044b280-3320-11ea-95e2-9aa745c8b07d.gif">
13-
</td>
14-
<td>
15-
<img height="500" src="https://user-images.githubusercontent.com/1780255/72094958-2fac1c00-3320-11ea-8f67-9d759cfa4ae1.gif">
16-
</td>
17-
</tr>
18-
</table>
19-
209

2110
---
2211
[![Build Status](https://travis-ci.org/wix/react-native-ui-lib.svg?branch=master)](https://travis-ci.org/wix/react-native-ui-lib)
2312
[![npm](https://img.shields.io/npm/v/react-native-ui-lib.svg)](https://www.npmjs.com/package/react-native-ui-lib)
2413
[![NPM Downloads](https://img.shields.io/npm/dm/react-native-ui-lib.svg?style=flat)](https://www.npmjs.com/package/react-native-ui-lib)
14+
<a href="https://twitter.com/rnuilib"><img src="https://img.shields.io/twitter/follow/rnuilib.svg?style=flat&colorA=1DA1F2&colorB=20303C&label=Follow%20us%20on%20Twitter" alt="Follow on Twitter"></a>
2515

2616

2717
Check out our [Docs](https://wix.github.io/react-native-ui-lib/). <br>
Loading

demo/src/configurations.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@ import {Assets, Typography, Spacings} from 'react-native-ui-lib'; // eslint-disa
22

33
Assets.loadAssetsGroup('icons.demo', {
44
add: require('./assets/icons/add.png'),
5+
camera: require('./assets/icons/cameraSelected.png'),
56
close: require('./assets/icons/close.png'),
67
dashboard: require('./assets/icons/dashboard.png'),
78
image: require('./assets/icons/image.png'),
89
refresh: require('./assets/icons/refresh.png'),
910
search: require('./assets/icons/search.png')
1011
});
1112

13+
Assets.loadAssetsGroup('images.demo', {
14+
brokenImage: require('./assets/images/placeholderMissingImage.png')
15+
});
16+
1217
Typography.loadTypographies({
1318
h1: {...Typography.text40},
1419
h2: {...Typography.text50},

demo/src/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ module.exports = {
3434
get CarouselScreen() {
3535
return require('./screens/componentScreens/CarouselScreen').default;
3636
},
37+
get CarouselVerticalScreen() {
38+
return require('./screens/componentScreens/CarouselVerticalScreen').default;
39+
},
3740
get CheckboxScreen() {
3841
return require('./screens/componentScreens/CheckboxScreen').default;
3942
},
43+
get ChipScreen() {
44+
return require('./screens/componentScreens/ChipScreen').default;
45+
},
4046
get ConnectionStatusBarScreen() {
4147
return require('./screens/componentScreens/ConnectionStatusBarScreen').default;
4248
},
@@ -203,6 +209,10 @@ module.exports = {
203209
get ProgressBarScreen() {
204210
return require('./screens/componentScreens/ProgressBarScreen').default;
205211
},
212+
// Incubator
213+
get IncubatorTextFieldScreen() {
214+
return require('./screens/incubatorScreens/IncubatorTextFieldScreen').default;
215+
},
206216
// realExamples
207217
get AppleMusic() {
208218
return require('./screens/realExamples/AppleMusic').default;

demo/src/screens/MainScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class MainScreen extends Component {
181181
paddingV-s2
182182
onPress={() => this.openScreen(item)}
183183
onLongPress={() => this.setDefaultScreen(item)}
184-
activeBackgroundColor={Colors.blue40}
184+
activeBackgroundColor={Colors.primary}
185185
activeOpacity={1}
186186
>
187187
<Text style={[item.deprecate && styles.entryTextDeprecated]} dark10 text50>

demo/src/screens/MenuStructure.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export const navigationData = {
8686
title: 'Layouts & Templates',
8787
screens: [
8888
{title: 'Carousel', tags: 'carousel', screen: 'unicorn.components.CarouselScreen'},
89+
{title: 'Carousel (Vertical)', tags: 'carousel', screen: 'unicorn.components.CarouselVerticalScreen'},
8990
{title: 'LoadingScreen', tags: 'loading screen', screen: 'unicorn.screens.LoadingScreen'},
9091
{title: 'Modal', tags: 'modal topbar screen', screen: 'unicorn.screens.ModalScreen'},
9192
{title: 'StateScreen', tags: 'empty state screen', screen: 'unicorn.screens.EmptyStateScreen'},

demo/src/screens/componentScreens/ActionBarScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default class ActionBarScreen extends Component {
4545

4646
<View style={styles.page}>
4747
<ActionBar
48-
backgroundColor={Colors.blue30}
48+
backgroundColor={Colors.primary}
4949
actions={[
5050
{label: 'Hide', onPress: () => Alert.alert('hide'), white: true},
5151
{label: 'Add Discount', onPress: () => Alert.alert('add discount'), white: true},

demo/src/screens/componentScreens/BadgesScreen.tsx

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
import React, {Component} from 'react';
22
import {ScrollView, StyleSheet} from 'react-native';
3-
import {Colors, View, Badge, Button, Text} from 'react-native-ui-lib'; //eslint-disable-line
3+
import {Colors, View, Badge, Button, Text, Image} from 'react-native-ui-lib'; //eslint-disable-line
44
const BadgesSpace = 30;
55
const plusIcon = require('../../assets/icons/chevronUp.png');
66
const minusIcon = require('../../assets/icons/chevronDown.png');
77
const star = require('../../assets/icons/star.png');
88
const bell = require('../../assets/icons/bell.png');
99

1010
export default class BadgesScreen extends Component {
11-
constructor(props) {
12-
super(props);
11+
state = {
12+
value: 42
13+
};
1314

14-
this.state = {
15-
value: 42
16-
};
17-
}
18-
19-
changeLabelValue(value) {
15+
changeLabelValue(value: number) {
2016
const currValue = this.state.value;
2117
const newValue = currValue + value;
2218
if (newValue >= 1) {
@@ -25,6 +21,23 @@ export default class BadgesScreen extends Component {
2521
}
2622

2723
render() {
24+
const customElement1 = (
25+
<View row>
26+
<Image source={bell}/>
27+
<Image source={bell}/>
28+
</View>
29+
);
30+
31+
const customElement2 = (
32+
<View row>
33+
<Image source={bell}/>
34+
<Text white text90>
35+
37
36+
</Text>
37+
<Image source={bell}/>
38+
</View>
39+
);
40+
2841
return (
2942
<ScrollView style={{backgroundColor: Colors.dark70}} contentContainerStyle={styles.container}>
3043
<Text text50 row center marginB-15>
@@ -86,7 +99,6 @@ export default class BadgesScreen extends Component {
8699
<View row>
87100
<View
88101
center
89-
column
90102
style={{justifyContent: 'space-around', alignItems: 'flex-start', width: 140, height: 140}}
91103
>
92104
<Text text80 row>
@@ -98,7 +110,7 @@ export default class BadgesScreen extends Component {
98110
</Text>
99111
</View>
100112

101-
<View center column style={{justifyContent: 'space-around', width: 40, height: 140}}>
113+
<View center style={{justifyContent: 'space-around', width: 40, height: 140}}>
102114
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.green30} size={'pimpleSmall'}/>
103115
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.red30} size={'pimpleBig'}/>
104116
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.blue30} size={'pimpleHuge'}/>
@@ -141,10 +153,17 @@ export default class BadgesScreen extends Component {
141153
Counter Icon Badges
142154
</Text>
143155
<View row paddingH-15>
144-
<Badge marginR-10 label={'9999'} labelFormatterLimit={3} icon={bell} backgroundColor={Colors.red30}/>
145-
<Badge marginR-10 label={'4'} icon={bell} backgroundColor={Colors.red30}/>
156+
<Badge marginR-10 label={'9999'} labelFormatterLimit={3} icon={bell} backgroundColor={Colors.red30}/>
157+
<Badge marginR-10 label={'4'} icon={bell} backgroundColor={Colors.red30}/>
146158
</View>
147159

160+
<Text text50 marginB-10 row center marginT-25>
161+
Custom Element Badges
162+
</Text>
163+
<View row paddingH-15>
164+
<Badge marginR-10 label={'17'} customElement={customElement1}/>
165+
<Badge marginR-10 customElement={customElement2} backgroundColor={Colors.grey30}/>
166+
</View>
148167
</ScrollView>
149168
);
150169
}

demo/src/screens/componentScreens/ButtonsScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export default class ButtonsScreen extends Component {
318318

319319
<Button
320320
style={{marginBottom: ButtonSpace}}
321-
blue30
321+
primary
322322
outline
323323
iconSource={plusIcon}
324324
label="Icon"
@@ -339,7 +339,7 @@ export default class ButtonsScreen extends Component {
339339
style={{marginBottom: ButtonSpace}}
340340
>
341341
<Image source={plusIcon} />
342-
<Text style={{marginLeft: 10, color: Colors.blue30}}>
342+
<Text marginL-10 primary>
343343
Custom Icon
344344
</Text>
345345
</Button>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import {Carousel, Constants, Text, View, Colors} from 'react-native-ui-lib';
2+
import React, {Component} from 'react';
3+
import _ from 'lodash';
4+
import {StyleSheet} from 'react-native';
5+
import {
6+
renderBooleanOption,
7+
renderSliderOption
8+
} from '../ExampleScreenPresenter';
9+
10+
interface Props {}
11+
12+
interface State {
13+
numberOfPagesShown: number;
14+
autoplay: boolean;
15+
}
16+
17+
const BACKGROUND_COLORS = [
18+
Colors.red50,
19+
Colors.yellow20,
20+
Colors.purple50,
21+
Colors.green50,
22+
Colors.cyan50,
23+
Colors.purple20,
24+
Colors.blue60,
25+
Colors.red10,
26+
Colors.green20,
27+
Colors.purple60
28+
];
29+
30+
const pageHeight = Constants.windowHeight / 2;
31+
32+
class CarouselVerticalScreen extends Component<Props, State> {
33+
carousel = React.createRef<typeof Carousel>();
34+
35+
constructor(props: Props) {
36+
super(props);
37+
38+
this.state = {
39+
numberOfPagesShown: 5,
40+
autoplay: false
41+
};
42+
}
43+
44+
render() {
45+
const {numberOfPagesShown, autoplay} = this.state
46+
return (
47+
<View flex paddingT-20>
48+
<View marginH-20 marginB-20>
49+
{renderBooleanOption.call(this, 'autoplay', 'autoplay')}
50+
{renderSliderOption.call(
51+
this,
52+
'Number of pages shown',
53+
'numberOfPagesShown',
54+
{
55+
min: 3,
56+
max: 10,
57+
step: 1,
58+
initial: 5
59+
}
60+
)}
61+
</View>
62+
<Carousel
63+
key={'carousel'}
64+
ref={this.carousel}
65+
autoplay={autoplay}
66+
pageWidth={Constants.windowWidth}
67+
pageHeight={pageHeight}
68+
initialPage={0}
69+
containerStyle={{height: pageHeight}}
70+
allowAccessibleLayout
71+
horizontal={false}
72+
>
73+
{_.map([...Array(numberOfPagesShown)], (_, index) => (
74+
<Page
75+
style={{backgroundColor: BACKGROUND_COLORS[index]}}
76+
key={index}
77+
>
78+
<Text style={styles.pageText}>{index}</Text>
79+
</Page>
80+
))}
81+
</Carousel>
82+
</View>
83+
);
84+
}
85+
}
86+
87+
// @ts-ignore
88+
const Page = ({children, style, ...others}) => {
89+
return (
90+
<View center {...others} style={[styles.page, style]}>
91+
{children}
92+
</View>
93+
);
94+
};
95+
96+
const styles = StyleSheet.create({
97+
container: {},
98+
page: {
99+
flex: 1,
100+
height: pageHeight,
101+
width: Constants.windowWidth
102+
},
103+
pageText: {
104+
fontSize: 40,
105+
color: 'white'
106+
}
107+
});
108+
109+
export default CarouselVerticalScreen

demo/src/screens/componentScreens/DateTimePickerScreen.js

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
import React, {Component} from 'react';
2-
import {DateTimePicker, View, Text} from 'react-native-ui-lib'; // eslint-disable-line
2+
import {ScrollView} from 'react-native';
3+
import {DateTimePicker, Text, TouchableOpacity, Colors} from 'react-native-ui-lib'; // eslint-disable-line
34

45
export default class DateTimePickerScreen extends Component {
6+
7+
getCustomInputValue = value => {
8+
if (!value) {
9+
return 'Default';
10+
}
11+
return value.includes(new Date().getFullYear() + 1) ? 'Next Year' : value;
12+
};
13+
14+
renderCustomInput = (props, toggle) => {
15+
const {value} = props;
16+
return (
17+
<TouchableOpacity
18+
flex
19+
row
20+
spread
21+
onPress={() => {
22+
toggle(true);
23+
}}
24+
>
25+
<Text>Valid from</Text>
26+
<Text absR color={Colors.primary} text80BO>{this.getCustomInputValue(value)}</Text>
27+
</TouchableOpacity>
28+
);
29+
};
30+
531
render() {
632
return (
7-
<View flex padding-s5>
33+
<ScrollView style={{padding: 14}}>
834
<Text text40>Date Time Picker</Text>
935
<DateTimePicker
1036
containerStyle={{marginVertical: 20}}
@@ -37,7 +63,18 @@ export default class DateTimePickerScreen extends Component {
3763
placeholder={'Select time'}
3864
value={new Date('2015-03-25T12:00:00-06:30')}
3965
/>
40-
</View>
66+
<Text text60R marginT-40>
67+
Custom Input
68+
</Text>
69+
<DateTimePicker
70+
containerStyle={{marginVertical: 20}}
71+
title={'Date'}
72+
placeholder={'Select a date'}
73+
renderExpandableInput={this.renderCustomInput}
74+
dateFormat={'MMM D, YYYY'}
75+
// value={new Date('2015-03-25T12:00:00-06:30')}
76+
/>
77+
</ScrollView>
4178
);
4279
}
4380
}

0 commit comments

Comments
 (0)