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

Only call -layout and -layoutDidFinish if the node is already loaded #285

Merged
merged 4 commits into from May 19, 2017

Conversation

nguyenhuy
Copy link
Member

After facebookarchive/AsyncDisplayKit#3263, a layout pass can be triggered even before a node is loaded. This is to ensure the node has valid bounds to fetch its content as soon as it enters preload state, regardless of its backing store.

However, the API contracts of -layout and -layoutDidFinish state that those methods are triggered by the view's layoutSubviews. That means the node must be loaded by the time they are called.

This PR adds a node loaded check to __layout that ensures those 2 methods are called only if the condition meets.

Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

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

Change looks good to me!

We should finally push on finding a better way to have layout code path go through one path ...

@nguyenhuy
Copy link
Member Author

@maicki Agreed...

@ghost
Copy link

ghost commented May 19, 2017

🚫 CI failed with log

@nguyenhuy nguyenhuy merged commit 6aa5ad7 into TextureGroup:master May 19, 2017
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…extureGroup#285)

* Only call -layout and -layoutDidFinish if the node is already loaded

* Minor change

* Update CHANGELOG
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

2 participants