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

measure and layout after adding a view to the container #2

Merged
merged 1 commit into from
Feb 12, 2019

Conversation

danilobuerger
Copy link
Contributor

Imported from facebook/react-native#18609

Currently, when adding views to ViewPagerAndroid after it was attached, those views would not show up as they had a size of 0. This fixes that by measuring and layouting after adding a view to the container.

Fixes facebook/react-native#14296

Test Plan

See https://github.com/danilobuerger/react-native-viewpagerandroid-dynamic

  1. yarn install
  2. yarn run android
  3. You will see two pages
  4. Press "ADDPAGE"
  5. Scroll to the third page, it will be empty
  6. Use react-native master with this patch
  7. yarn run android
  8. You will see two pages
  9. Press "ADDPAGE"
  10. Scroll to the third page, it will show "3 page (Scroll Me)"

@satya164
Copy link
Member

Thanks ❤️

Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

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

This looks good to me. Please do make a release of ViewPager on npm before merging this PR though.

@ferrannp
Copy link
Contributor

Awesome! Will merge this after making the first release. After that, we can add your Add Page button to the example here too :)

@ferrannp ferrannp merged commit 6f7f963 into callstack:master Feb 12, 2019
@danilobuerger
Copy link
Contributor Author

@ferrannp Thanks! Could you also cut a new release with this fix please? I guess this repo won't have much activity for the first few weeks until people start migrating, so it would be nice if its already there.

@danilobuerger danilobuerger deleted the measure branch February 12, 2019 13:34
@ferrannp
Copy link
Contributor

Yup, thank you!

@danilobuerger
Copy link
Contributor Author

@ferrannp Awesome, thanks!

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.

ViewPagerAndroid renders empty dynamically added views after upgrade from v0.42.3 to v0.44.2
4 participants