mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 15:18:10 +00:00
[ListView] Defer measurement one frame after componentDidMount to fix 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 https://github.com/facebook/react-native/pull/1750 Github Author: James Ide <ide@jameside.com> Test Plan: Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".
This commit is contained in:
parent
1cca4fb769
commit
fe7edf0860
@ -276,7 +276,9 @@ var ListView = React.createClass({
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
this._measureAndUpdateScrollProps();
|
||||
this.requestAnimationFrame(() => {
|
||||
this._measureAndUpdateScrollProps();
|
||||
});
|
||||
},
|
||||
|
||||
onRowHighlighted: function(sectionID, rowID) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user