-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(ios): undefined is not an object (evaluating 'measureSpec.setColumn') #7230
fix(ios): undefined is not an object (evaluating 'measureSpec.setColumn') #7230
Conversation
@@ -136,6 +136,11 @@ export class GridLayout extends GridLayoutBase { | |||
|
|||
this.eachLayoutChild((child, last) => { | |||
let measureSpecs = this.map.get(child); | |||
if (!measureSpecs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was reviewing our code and I am not sure trying to fix this exceptional situation by registering layout child here is a good idea. How about just skipping this specific layout child instead (as obviously something is not right with its current state)?
if (!measureSpecs) {
continue;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finally managed to reproduce the problem see: #7226 (comment)
I'm not sure what the best solution is or if we just use components+layouts incorrectly.
Just skipping as you suggest results in the component not being rendered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @m-abs thank you isolating the problem!
So just skipping the iteration when measureSpec is undefined is not an option, ok. Will investigate the code on the nativescript-angular side a bit but if I don't find a better solution I am going to merge yours as is.
Meanwhile, there is also a workaround that you can use -- wrap the contents of your sub1 component (sub1.component.html) in any kind of layout like this:
<GridLayout>
<ns-sub2></ns-sub2>
</GridLayout>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
test |
chore: cherry-pick community pr #7230
We, the rest of the NativeScript community, thank you for your
contribution!
To help the rest of the community review your change, please follow the instructions in the template.
-->
PR Checklist
[ ] Tests for the changes are included - https://github.com/NativeScript/NativeScript/blob/master/WritingUnitTests.mdWhat is the current behavior?
In the past month we've tracked 20+ crashes with this error:
We haven't been able to consistently reproduce the crash locally, but I think it is clear where it does wrong.
What is the new behavior?
GridLayout(ios).onMeasure(...)
will createMeasureSpecs
if missing the forchild
view when it callsthis.eachLayoutChild(...)
Fixes: #7226