Skip to content
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

Use nativeEvent argument in onLayout instead of container.measure #109

Merged
merged 1 commit into from Mar 24, 2018

Conversation

newtonry
Copy link
Contributor

@newtonry newtonry commented Jun 8, 2017

this.container.measure was not returning the full height and width if the screen was in the middle of a transition. This caused a miscalculation where the full container view was not taken up. Example:
miscalculated-layout

onLayout (http://facebook.github.io/react-native/releases/0.45/docs/view.html#onlayout) receives the same view's dimensions with event.nativeEvent.layout. The docs suggest using those instead
(http://facebook.github.io/react-native/releases/0.45/docs/direct-manipulation.html#measure-callback).

This change sets the correct width and height and gives the expected behavior instead:
correctly-calculated-layout

@yloeza
Copy link

yloeza commented Jun 8, 2017

@phil-r was there any reason for using the container.mesure function? this fix looks good to me, @newtonry nice finding!

@i8wu
Copy link

i8wu commented Oct 26, 2017

+1 is this repo alive?

@newtonry
Copy link
Contributor Author

@i8wu it doesn't seem to be too active. It appears that https://github.com/archriss/react-native-snap-carousel finally added a much wanted loop feature. That's a much more active library, so I might switch over soon.

@i8wu
Copy link

i8wu commented Oct 26, 2017

Thanks for the heads up @newtonry , will check out the other module as well.

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.

None yet

4 participants