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

How to handle rotations #56

Closed
7ynk3r opened this issue Apr 2, 2015 · 4 comments
Closed

How to handle rotations #56

7ynk3r opened this issue Apr 2, 2015 · 4 comments
Labels

Comments

@7ynk3r
Copy link

7ynk3r commented Apr 2, 2015

The component kit is amazing! The amount of code is nothing compared with the traditional.

I'm trying to figure out how to handle rotations. Because all view has to be updated, I would need to update all the models. This works as long as the amount is not big (>100).
Any ideas on this? BTW, I noticed that facebook app for iOS doesn't support rotations.

@benlodotcom
Copy link
Contributor

Sorry for the delay getting back to you.

Because all view has to be updated, I would need to update all the models
Yes or at least they will eventually need to be before they come on screen.

We currently don't have infrastructure to handle rotation in other ways that updating all the models.
But if you want to tackle it, here are a few different approaches that you could pursue :

  • Instead of regenerating the whole component tree, just do a relayout.
  • For your components always compute a landscape and portrait version and switch between them.
  • Recompute only a subset of what is visible synchronously, and start the recomputation of others asynchronously. In your datasource when you're about to show a new cell verify the right layout has been recomputed and otherwise enqueue a synchronous recompute/just wait until the async recomputation is done.

This could be a great addition to the datasources ! Let me know if you need more info.

@7ynk3r
Copy link
Author

7ynk3r commented Apr 2, 2015

Thanks for the response!

I'll try the approaches you mentioned and let you know.

@nihalahmed
Copy link

@7ynk3r Hey, I am facing a similar issue as you have, and was wondering if any of the above suggestions helped you? I am quite new to ComponentKit. I am not sure how to do a relayout as suggested above. @benlodotcom If you could also guide me how to do that, I would appreciate it.

@7ynk3r
Copy link
Author

7ynk3r commented Jul 1, 2015

I end up doing reloading the list after rotation it. The problem is that if the list is long it can take a little time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants