Skip to content

Commit 4461645

Browse files
committed
Carousel - resetting page after orientation change
1 parent 6a6c51f commit 4461645

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

demo/src/screens/componentScreenScreens/ModalScreen.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Colors, Carousel, PageControl, Modal, View, Text} from 'react-native-ui-
66

77
export default class ModalScreen extends Component {
88

9-
static options() { // stopped working
9+
static options() {
1010
return {
1111
topBar: {
1212
drawBehind: true,
@@ -21,14 +21,6 @@ export default class ModalScreen extends Component {
2121
this.state = {
2222
currentPage: 0
2323
};
24-
25-
const navigationStyle = {
26-
topBar: {
27-
drawBehind: true,
28-
visible: false
29-
}
30-
};
31-
Navigation.mergeOptions(props.componentId, navigationStyle);
3224
}
3325

3426
closeScreen() {

src/components/carousel/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,8 @@ export default class Carousel extends BaseComponent {
7474

7575
onOrientationChanged = () => {
7676
if (!this.props.pageWidth) {
77-
this.setState({
78-
pageWidth: Constants.screenWidth,
79-
initialOffset: {
80-
x: presenter.calcOffset(this.props, {currentPage: this.state.currentPage, pageWidth: Constants.screenWidth})
81-
}
82-
});
77+
this.setState({pageWidth: Constants.screenWidth});
78+
this.goToPage(this.state.currentPage, true);
8379
}
8480
}
8581

0 commit comments

Comments
 (0)