Skip to content

Commit 1e9cc8e

Browse files
committed
Merge branch 'master' into feat/WheelPicker
2 parents aab4af4 + d45e4a7 commit 1e9cc8e

File tree

161 files changed

+4399
-2195
lines changed

Some content is hidden

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

161 files changed

+4399
-2195
lines changed

.prettierrc

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
// "eslintIntegration": true,
3-
// "printWidth": 120,
4-
// "useTabs": false,
5-
// "semi": true,
6-
// "singleQuote": true,
7-
// "jsxSingleQuote": false,
8-
// "trailingComma": "none",
9-
// "bracketSpacing": false,
10-
// "arrowParens": "avoid"
2+
"trailingComma": "none",
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"bracketSpacing": false
116
}

babel.config.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
module.exports = {
22
env: {
33
test: {
4-
presets: ['module:metro-react-native-babel-preset'],
5-
retainLines: true,
6-
},
4+
presets: ['module:metro-react-native-babel-preset']
5+
}
76
},
8-
presets: ['module:metro-react-native-babel-preset'],
9-
retainLines: true,
10-
plugins: ['transform-inline-environment-variables'],
7+
presets: ['module:metro-react-native-babel-preset']
118
};

demo/src/assets/icons/refresh.png

345 Bytes
Loading
499 Bytes
Loading
578 Bytes
Loading
834 Bytes
Loading
1.1 KB
Loading

demo/src/assets/icons/search.png

334 Bytes
Loading
515 Bytes
Loading
588 Bytes
Loading
845 Bytes
Loading
1.12 KB
Loading

demo/src/demoApp.js

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
import AsyncStorage from '@react-native-community/async-storage';
22
import {Navigation} from 'react-native-navigation';
33
import * as Animatable from 'react-native-animatable';
4-
import {AnimatableManager, ThemeManager, Constants, Assets, Colors, Typography} from 'react-native-ui-lib'; // eslint-disable-line
4+
import {
5+
AnimatableManager,
6+
ThemeManager,
7+
Constants,
8+
Assets,
9+
Colors,
10+
Typography,
11+
Spacings
12+
} from 'react-native-ui-lib'; // eslint-disable-line
513
import {registerScreens} from './screens';
614

15+
Assets.loadAssetsGroup('icons.demo', {
16+
refresh: require('./assets/icons/refresh.png'),
17+
search: require('./assets/icons/search.png')
18+
});
19+
20+
Typography.loadTypographies({
21+
h1: {...Typography.text40},
22+
h2: {...Typography.text50},
23+
h3: {...Typography.text60}
24+
});
25+
26+
Spacings.loadSpacings({
27+
page: Spacings.s5
28+
});
29+
730
/** Examples - uncomment when needed */
831
// Typography.loadTypographies({
932
// h1: {fontSize: 58, fontWeight: '300', lineHeight: 80},
@@ -36,10 +59,6 @@ import {registerScreens} from './screens';
3659
// }
3760
// });
3861

39-
// Assets.loadAssetsGroup('icons.general', {
40-
// camera: require('./assets/icons/cameraSelected.png'),
41-
// });
42-
4362
// AnimatableManager.loadAnimationPresets({
4463
// preset1: {
4564
// animation: 'fadeIn',
@@ -66,7 +85,9 @@ import {registerScreens} from './screens';
6685
// },
6786
// };
6887
// IMPORTANT! Make uilib's animations available globally for the app's use (option to pass adittional animation definitions)
69-
Animatable.initializeRegistryWithDefinitions(AnimatableManager.loadAnimationDefinitions(/** customAnimationsDefinitions */));
88+
Animatable.initializeRegistryWithDefinitions(
89+
AnimatableManager.loadAnimationDefinitions(/** customAnimationsDefinitions */)
90+
);
7091

7192
function getDefaultNavigationStyle() {
7293
return {
@@ -89,13 +110,17 @@ function getDefaultNavigationStyle() {
89110
title: {
90111
color: Colors.white,
91112
fontSize: Typography.text60H.fontSize,
92-
fontFamily: Constants.isAndroid ? Typography.text65H.fontFamily : '.SFUIText-Heavy',
113+
fontFamily: Constants.isAndroid
114+
? Typography.text65H.fontFamily
115+
: '.SFUIText-Heavy',
93116
fontWeight: 'heavy'
94117
},
95118
subtitle: {
96119
color: Colors.white,
97120
fontSize: Typography.text80T.fontSize,
98-
fontFamily: Constants.isAndroid ? Typography.text80.fontFamily : '.SFUIText-Medium',
121+
fontFamily: Constants.isAndroid
122+
? Typography.text80.fontFamily
123+
: '.SFUIText-Medium',
99124
fontWeight: 'medium'
100125
},
101126
backButton: {

demo/src/screens/ExampleScreenPresenter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ export function renderBooleanGroup(title, options) {
5959
);
6060
}
6161

62-
export function renderRadioGroup(title, key, options, {isRow, afterValueChanged} = {}) {
62+
export function renderRadioGroup(title, key, options, {isRow, afterValueChanged, useValueAsLabel} = {}) {
6363
const value = this.state[key];
6464
return (
6565
<View marginB-s2>
66-
<Text text70M marginB-s2>
66+
{!_.isUndefined(title) && <Text text70M marginB-s2>
6767
{title}
68-
</Text>
68+
</Text>}
6969
<RadioGroup
7070
row={isRow}
7171
style={isRow && styles.rowWrap}
@@ -80,7 +80,7 @@ export function renderRadioGroup(title, key, options, {isRow, afterValueChanged}
8080
key={key}
8181
marginB-s2
8282
marginR-s2={isRow}
83-
label={key}
83+
label={useValueAsLabel ? value : key}
8484
value={value}
8585
/>
8686
);

demo/src/screens/MainScreen.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class MainScreen extends Component {
113113
const filteredMenuSection = _.filter(menuSection.screens, menuItem => {
114114
const {title, description, tags} = menuItem;
115115
return (
116-
_.includes(_.lowerCase(title), _.toLower(filterText)) ||
116+
_.includes(_.toLower(title), _.toLower(filterText)) ||
117117
_.includes(_.toLower(description), _.toLower(filterText)) ||
118118
_.includes(_.toLower(tags), _.toLower(filterText))
119119
);
@@ -137,6 +137,7 @@ class MainScreen extends Component {
137137
<TextField
138138
ref={r => (this.input = r)}
139139
value={this.state.filterText}
140+
testID="uilib.search_for_component"
140141
placeholder="Search for your component..."
141142
onChangeText={this.filterExplorerScreens}
142143
onBlur={this.onSearchBoxBlur}
@@ -242,8 +243,8 @@ class MainScreen extends Component {
242243
{showResults && this.renderSearchResults(filteredNavigationData)}
243244

244245
{showCarousel && (
245-
<TabController asCarousel>
246-
<TabController.TabBar testID={'mainScreenTabBar'} items={_.map(data, section => ({label: section.title, testID: `section.${section.title}`}))}/>
246+
<TabController asCarousel items={_.map(data, section => ({label: section.title, testID: `section.${section.title}`}))}>
247+
<TabController.TabBar testID={'mainScreenTabBar'}/>
247248
{this.renderPages(data)}
248249
</TabController>
249250
)}

demo/src/screens/PlaygroundScreen.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
33
import {StyleSheet} from 'react-native';
4-
import {View, Text, Card, Incubator} from 'react-native-ui-lib'; //eslint-disable-line
4+
import {View, Incubator, Text, Card, TextField, Button} from 'react-native-ui-lib'; //eslint-disable-line
55

66
export default class PlaygroundScreen extends Component {
77
render() {
88
return (
9-
<View center bg-dark80 flex>
9+
<View bg-dark80 flex padding-20>
1010
<Incubator.WheelPicker/>
1111
</View>
1212
);
1313
}
1414
}
1515

1616
const styles = StyleSheet.create({
17-
container: {}
17+
container: {},
1818
});

demo/src/screens/componentScreens/CardsScreen.js renamed to demo/src/screens/componentScreens/CardsScreen.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ export default class CardsScreen extends Component {
1515
selected2: true
1616
};
1717

18+
renderCoupon = (options) => {
19+
return (
20+
<Card {...options} flex height={160} onPress={() => {}} useNative activeOpacity={1} activeScale={0.96}>
21+
<Card.Section
22+
backgroundColor={Colors.red30}
23+
padding-20
24+
flex-3
25+
content={[
26+
{text: 'Special sale!', text70: true, white: true},
27+
{text: '10%', text60: true, white: true}
28+
]}
29+
contentStyle={{alignItems: 'center'}}
30+
/>
31+
<Card.Section
32+
padding-20
33+
flex
34+
content={[{text: 'All site', text70: true, dark10: true, flex: 1, textAlign: 'center'}]}
35+
contentStyle={{alignItems: 'center'}}
36+
/>
37+
</Card>
38+
);
39+
};
40+
1841
render() {
1942
const {selected1, selected2} = this.state;
2043

@@ -37,7 +60,7 @@ export default class CardsScreen extends Component {
3760
contentContainerStyle={{padding: 5}}
3861
showsHorizontalScrollIndicator={false}
3962
>
40-
{_.times(4, i => {
63+
{_.times(4, (i) => {
4164
return (
4265
<Card key={i} width={100} style={{marginRight: 20}}>
4366
<View padding-15>
@@ -209,6 +232,10 @@ export default class CardsScreen extends Component {
209232
</Card>
210233
);
211234
})}
235+
<View row spread>
236+
{this.renderCoupon({'marginR-10': true})}
237+
{this.renderCoupon({'marginL-10': true})}
238+
</View>
212239
</View>
213240
</ScrollView>
214241
</View>

demo/src/screens/componentScreens/CheckboxScreen.js renamed to demo/src/screens/componentScreens/CheckboxScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CheckboxScreen extends Component {
1010
value4: true,
1111
value5: false
1212
};
13-
13+
1414
render() {
1515
return (
1616
<View useSafeArea flex>

demo/src/screens/componentScreens/DateTimePickerScreen.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
import React, {Component} from 'react';
22
import {DateTimePicker, View, Text} from 'react-native-ui-lib'; // eslint-disable-line
33

4-
54
export default class DateTimePickerScreen extends Component {
6-
75
render() {
86
return (
9-
<View flex padding-20>
10-
<Text text40 marginB-40>Date Time Picker</Text>
11-
12-
<DateTimePicker
13-
title={'Date'}
14-
placeholder={'Select a date'}
7+
<View flex padding-s5>
8+
<Text text40>Date Time Picker</Text>
9+
<DateTimePicker
10+
containerStyle={{marginVertical: 20}}
11+
title={'Date'}
12+
placeholder={'Select a date'}
1513
// dateFormat={'MMM D, YYYY'}
16-
// value={new Date('October 13, 2014')}
14+
// value={new Date('October 13, 2014')}
1715
/>
18-
<DateTimePicker
19-
mode={'time'}
20-
title={'Time'}
16+
<DateTimePicker
17+
mode={'time'}
18+
title={'Time'}
2119
placeholder={'Select time'}
2220
// timeFormat={'h:mm A'}
2321
// value={new Date('2015-03-25T12:00:00-06:30')}
2422
/>
23+
24+
<Text text60R marginT-40>
25+
Disabled
26+
</Text>
27+
<DateTimePicker
28+
containerStyle={{marginBottom: 20}}
29+
editable={false}
30+
title={'Date'}
31+
placeholder={'Select a date'}
32+
/>
33+
<DateTimePicker
34+
editable={false}
35+
mode={'time'}
36+
title={'Time'}
37+
placeholder={'Select time'}
38+
value={new Date('2015-03-25T12:00:00-06:30')}
39+
/>
2540
</View>
2641
);
2742
}

0 commit comments

Comments
 (0)