Skip to content

Commit 3f54d89

Browse files
committed
fix for CarouselScreen and ModalScreen
1 parent 747caf2 commit 3f54d89

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

demo/src/screens/componentScreenScreens/ModalScreen.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
import React, {Component} from 'react';
22
import {Alert, StyleSheet} from 'react-native';
33
import {Navigation} from 'react-native-navigation';
4-
import {Colors, Carousel, PageControl, Modal, View, Text, Constants} from 'react-native-ui-lib';//eslint-disable-line
4+
import {Colors, Carousel, PageControl, Modal, View, Text} from 'react-native-ui-lib'; // eslint-disable-line
5+
56

67
export default class ModalScreen extends Component {
78

8-
static options() {
9+
static options() { // stopped working
910
return {
1011
topBar: {
1112
drawBehind: true,
12-
visible: false,
13-
},
13+
visible: false
14+
}
1415
};
1516
}
1617

1718
constructor(props) {
1819
super(props);
1920

2021
this.state = {
21-
currentPage: 0,
22+
currentPage: 0
23+
};
24+
25+
const navigationStyle = {
26+
topBar: {
27+
drawBehind: true,
28+
visible: false
29+
}
2230
};
31+
Navigation.mergeOptions(props.componentId, navigationStyle);
2332
}
2433

2534
closeScreen() {
@@ -36,7 +45,7 @@ export default class ModalScreen extends Component {
3645
color={Colors.dark10}
3746
size={15}
3847
/>
39-
<Carousel onChangePage={currentPage => this.setState({currentPage})}>
48+
<Carousel migrate onChangePage={currentPage => this.setState({currentPage})}>
4049
<View bg-green50 flex style={styles.page}>
4150
<Modal.TopBar
4251
title='modal title'
@@ -101,7 +110,6 @@ export default class ModalScreen extends Component {
101110
</Text>
102111
</View>
103112
</View>
104-
105113
</Carousel>
106114
</View>
107115
);
@@ -110,15 +118,15 @@ export default class ModalScreen extends Component {
110118

111119
const styles = StyleSheet.create({
112120
page: {
113-
width: Constants.screenWidth,
121+
flex: 1
114122
},
115123
pageControl: {
116-
zIndex: 1,
124+
zIndex: 1
117125
},
118126
absoluteContainer: {
119127
position: 'absolute',
120128
bottom: 20,
121129
left: 20,
122-
right: 0,
123-
},
130+
right: 0
131+
}
124132
});

demo/src/screens/componentScreens/CarouselScreen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
22
import {StyleSheet} from 'react-native';
3-
import {Constants, View, Text, Carousel} from 'react-native-ui-lib'; // eslint-disable-line
3+
import {View, Text, Carousel} from 'react-native-ui-lib'; // eslint-disable-line
44

55

66
const INITIAL_PAGE = 0;
@@ -17,7 +17,7 @@ class CarouselScreen extends Component {
1717
render() {
1818
return (
1919
<View flex>
20-
<Carousel loop onChangePage={(index => this.onChangePage(index))} /* initialPage={INITIAL_PAGE} */>
20+
<Carousel migrate loop onChangePage={(index => this.onChangePage(index))} /* initialPage={INITIAL_PAGE} */>
2121
<Page bg-cyan50>
2222
<Text margin-15>PAGE 0</Text>
2323
</Page>
@@ -58,7 +58,7 @@ const Page = ({children, ...others}) => {
5858

5959
const styles = StyleSheet.create({
6060
page: {
61-
width: Constants.screenWidth
61+
flex: 1
6262
}
6363
});
6464

0 commit comments

Comments
 (0)