Skip to content

Commit 12a9a64

Browse files
committed
Merge branch 'master' into release
2 parents ecc4b48 + a6bc27d commit 12a9a64

File tree

127 files changed

+1975
-2532
lines changed

Some content is hidden

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

127 files changed

+1975
-2532
lines changed
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/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/BadgesScreen.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ 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) {
@@ -103,7 +99,6 @@ export default class BadgesScreen extends Component {
10399
<View row>
104100
<View
105101
center
106-
column
107102
style={{justifyContent: 'space-around', alignItems: 'flex-start', width: 140, height: 140}}
108103
>
109104
<Text text80 row>
@@ -115,7 +110,7 @@ export default class BadgesScreen extends Component {
115110
</Text>
116111
</View>
117112

118-
<View center column style={{justifyContent: 'space-around', width: 40, height: 140}}>
113+
<View center style={{justifyContent: 'space-around', width: 40, height: 140}}>
119114
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.green30} size={'pimpleSmall'}/>
120115
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.red30} size={'pimpleBig'}/>
121116
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.blue30} size={'pimpleHuge'}/>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import {Carousel, Constants, Text, View, Colors} from 'react-native-ui-lib';
2+
import React, {Component} from 'react';
3+
import {StyleSheet, Animated, TextStyle} from 'react-native';
4+
import _ from 'lodash';
5+
import {renderBooleanOption, renderSliderOption} from '../ExampleScreenPresenter';
6+
7+
interface State {
8+
numberOfPagesShown: number;
9+
autoplay: boolean;
10+
}
11+
12+
const BACKGROUND_COLORS = [
13+
Colors.red50,
14+
Colors.yellow20,
15+
Colors.purple50,
16+
Colors.green50,
17+
Colors.cyan50,
18+
Colors.purple20,
19+
Colors.blue60,
20+
Colors.red10,
21+
Colors.green20,
22+
Colors.purple60
23+
];
24+
25+
const pageHeight = Constants.windowHeight / 2;
26+
27+
class CarouselVerticalScreen extends Component<{}, State> {
28+
carousel = React.createRef<typeof Carousel>();
29+
animatedScrollOffset = new Animated.ValueXY();
30+
31+
constructor(props: {}) {
32+
super(props);
33+
34+
this.state = {
35+
numberOfPagesShown: 5,
36+
autoplay: false
37+
};
38+
}
39+
40+
renderAnimatedCounter = () => {
41+
const {numberOfPagesShown} = this.state;
42+
const animatedStyles = _.times(numberOfPagesShown, page => {
43+
return {
44+
opacity: this.animatedScrollOffset.y.interpolate({
45+
inputRange: [pageHeight * page - 50, pageHeight * page, pageHeight * page + 50],
46+
outputRange: [0, 1, 0]
47+
}),
48+
transform: [
49+
{
50+
translateX: this.animatedScrollOffset.y.interpolate({
51+
inputRange: [pageHeight * page - 50, pageHeight * page, pageHeight * page + 50],
52+
outputRange: [-50, 0, 50]
53+
})
54+
}
55+
]
56+
};
57+
});
58+
return (
59+
<View absT>
60+
{_.times(numberOfPagesShown, page => (
61+
<Text key={page} h1 animated style={[styles.animatedPageCounter, animatedStyles[page]] as TextStyle}>
62+
{page}
63+
</Text>
64+
))}
65+
</View>
66+
);
67+
};
68+
69+
render() {
70+
const {numberOfPagesShown, autoplay} = this.state;
71+
return (
72+
<View flex paddingT-20>
73+
<View marginH-20 marginB-20>
74+
{renderBooleanOption.call(this, 'autoplay', 'autoplay')}
75+
{renderSliderOption.call(this, 'Number of pages shown', 'numberOfPagesShown', {
76+
min: 3,
77+
max: 10,
78+
step: 1,
79+
initial: 5
80+
})}
81+
</View>
82+
<View>
83+
<Carousel
84+
key={'carousel'}
85+
ref={this.carousel}
86+
animatedScrollOffset={this.animatedScrollOffset}
87+
scrollEventThrottle={16}
88+
autoplay={autoplay}
89+
pageWidth={Constants.windowWidth}
90+
pageHeight={pageHeight}
91+
initialPage={0}
92+
containerStyle={{height: pageHeight}}
93+
allowAccessibleLayout
94+
horizontal={false}
95+
>
96+
{_.map([...Array(numberOfPagesShown)], (_, index) => (
97+
<Page style={{backgroundColor: BACKGROUND_COLORS[index]}} key={index}>
98+
<Text style={styles.pageText}>{index}</Text>
99+
</Page>
100+
))}
101+
</Carousel>
102+
{this.renderAnimatedCounter()}
103+
</View>
104+
</View>
105+
);
106+
}
107+
}
108+
109+
// @ts-ignore
110+
const Page = ({children, style, ...others}) => {
111+
return (
112+
<View center {...others} style={[styles.page, style]}>
113+
{children}
114+
</View>
115+
);
116+
};
117+
118+
const styles = StyleSheet.create({
119+
container: {},
120+
page: {
121+
flex: 1,
122+
height: pageHeight,
123+
width: Constants.windowWidth
124+
},
125+
pageText: {
126+
fontSize: 40,
127+
color: 'white'
128+
},
129+
animatedPageCounter: {
130+
position: 'absolute',
131+
top: 20,
132+
left: 20
133+
}
134+
});
135+
136+
export default CarouselVerticalScreen;

0 commit comments

Comments
 (0)