Skip to content

Carousel - fix page width issue #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 10, 2019
Merged

Carousel - fix page width issue #570

merged 4 commits into from
Dec 10, 2019

Conversation

Inbal-Tish
Copy link
Collaborator

fix for Android's call (bug) to onOrientationChange when view disappears

@@ -107,7 +107,8 @@ export default class Carousel extends BaseComponent {

onOrientationChanged = () => {
if (!this.props.pageWidth || this.props.loop) {
this.setState({pageWidth: Constants.screenWidth});
// HACK: setting to containerWidth for Android's call when view disappear
this.setState({pageWidth: this.state.containerWidth || Constants.screenWidth});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both old code and new code looks strange, does it work for non full-width pages?
if we're setting the pageWidth to screenWidth or containerWidth, doesn't it break the non-full page feature?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Inbal-Tish I think this fix breaks iOS when changing orientation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't break the non-full width since there is a condition on line #111. The odd thing is that this.props.pageWidth is undefined there for some reason...
I see an issue with orientation change in the dynamic width feature as well. I'll take a look and talk to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was an issue with the update.initialOffset (used initialPage instead of state.currentPage). That might be the orientation issue you had? I added a fix so let me know if that worked or there was another issue in orientation.

@Inbal-Tish Inbal-Tish requested a review from ethanshar December 8, 2019 12:55
@ethanshar ethanshar merged commit fde0884 into master Dec 10, 2019
@Inbal-Tish Inbal-Tish deleted the fix/Carousel_page_width branch December 18, 2019 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants