Skip to content

Commit f40b900

Browse files
Inbal-Tishethanshar
authored andcommitted
Fix for Carousel defaults and example screen (#622)
1 parent eee164e commit f40b900

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

demo/src/screens/componentScreens/CarouselScreen.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import _ from 'lodash';
12
import React, {Component} from 'react';
23
import {StyleSheet, ScrollView} from 'react-native';
3-
import {Constants, View, Text, Carousel, Image, Card} from 'react-native-ui-lib'; // eslint-disable-line
4-
import _ from 'lodash';
4+
import {Constants, Spacings, View, Text, Carousel, Image} from 'react-native-ui-lib'; // eslint-disable-line
55

6-
const INITIAL_PAGE = 2;
7-
const WIDTH = Constants.screenWidth - 120;
86

7+
const INITIAL_PAGE = 2;
8+
const WIDTH = Constants.screenWidth - (Spacings.s5 * 2);
99
const IMAGES = [
1010
'https://images.pexels.com/photos/1212487/pexels-photo-1212487.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
1111
'https://images.pexels.com/photos/1366630/pexels-photo-1366630.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',
@@ -29,16 +29,15 @@ class CarouselScreen extends Component {
2929
render() {
3030
return (
3131
<ScrollView>
32-
<Text text30 margin-20>
33-
Carousel
34-
</Text>
32+
<Text text30 margin-20>Carousel</Text>
33+
3534
<Carousel
3635
migrate
3736
ref={r => (this.carousel = r)}
3837
// loop
3938
onChangePage={index => this.onChangePage(index)}
4039
pageWidth={WIDTH}
41-
// itemSpacings={20}
40+
// itemSpacings={Spacings.s3}
4241
initialPage={INITIAL_PAGE}
4342
containerStyle={{height: 160/* , flex: 1 */}}
4443
pageControlPosition={'under'}
@@ -106,7 +105,7 @@ const styles = StyleSheet.create({
106105
page: {
107106
flex: 1,
108107
borderWidth: 1,
109-
borderRadius: 4
108+
borderRadius: 8
110109
}
111110
});
112111

src/components/carousel/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default class Carousel extends BaseComponent {
8080

8181
static defaultProps = {
8282
initialPage: 0,
83-
itemSpacings: 12,
83+
itemSpacings: 16,
8484
pagingEnabled: true
8585
};
8686

@@ -270,6 +270,7 @@ export default class Carousel extends BaseComponent {
270270
return (
271271
<PageControl
272272
size={6}
273+
spacing={8}
273274
containerStyle={containerStyle}
274275
inactiveColor={Colors.dark60}
275276
color={Colors.dark20}

0 commit comments

Comments
 (0)