Skip to content

Conversation

@ide
Copy link
Contributor

@ide ide commented Jun 25, 2015

When UIManager.measure is called from componentDidMount it causes the error "Attempted to measure layout but offset or dimensions were NaN". Deferring the layout by one frame solves this problem. Layout measurement is already asynchronous anyway, so I believe adding the requestAnimationFrame call doesn't affect the program's correctness.

Fixes #1749

Test Plan: Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".

… error

When `UIManager.measure` is called from `componentDidMount` it causes the error "Attempted to measure layout but offset or dimensions were NaN". Deferring the layout by one frame solves this problem. Layout measurement is already asynchronous anyway, so I believe adding the `requestAnimationFrame` call doesn't affect the program's correctness.

Test Plan: Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 25, 2015
@brentvatne
Copy link
Collaborator

👍

@sahrens
Copy link
Contributor

sahrens commented Jun 26, 2015

@facebook-github-bot import

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/1467647633533815/int_phab to review.

@ide ide closed this in fe7edf0 Jun 26, 2015
@ide ide deleted the listview-measurement-error branch June 26, 2015 22:41
ide added a commit that referenced this pull request Jun 26, 2015
… error

Summary:
When `UIManager.measure` is called from `componentDidMount` it causes the error "Attempted to measure layout but offset or dimensions were NaN". Deferring the layout by one frame solves this problem. Layout measurement is already asynchronous anyway, so I believe adding the `requestAnimationFrame` call doesn't affect the program's correctness.

Fixes #1749

Closes #1750
Github Author: James Ide <[email protected]>

Test Plan:
 Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".
Fanghao pushed a commit to discord/react-native that referenced this pull request Jul 22, 2015
… error

Summary:
When `UIManager.measure` is called from `componentDidMount` it causes the error "Attempted to measure layout but offset or dimensions were NaN". Deferring the layout by one frame solves this problem. Layout measurement is already asynchronous anyway, so I believe adding the `requestAnimationFrame` call doesn't affect the program's correctness.

Fixes facebook#1749

Closes facebook#1750
Github Author: James Ide <[email protected]>

Test Plan:
 Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants