Skip to content

Invalid layout for (1)<RCTRootContentView: 0x7bb9e0c0; reactTag: 1; frame = (0 0; 414 736); gestureRecognizers = <NSArray: 0x7bb72450>; layer = <CALayer: 0x7bb783d0>>. position: {nan, nan}. bounds: {{0, 0}, {nan, nan}} #3406

@nfranzmeier

Description

@nfranzmeier

On the latest releases 0.12.0 (also 0.11.4) - When compiling for iphone 4 or 5 (simulator) I get this error when trying to merge the baseline application - the one that is created by react-native init - into an an existing project.

For some reason it works when building for iphone6....

015-10-14 07:52:03.949 [error][tid:main][UIView+React.m:77] Invalid layout for (1)<RCTRootContentView: 0x7bb9e0c0; reactTag: 1; frame = (0 0; 414 736); gestureRecognizers = <NSArray: 0x7bb72450>; layer = <CALayer: 0x7bb783d0>>. position: {nan, nan}. bounds: {{0, 0}, {nan, nan}}

I tracked this down to this function in RCTUtils.m

CGFloat RCTRoundPixelValue(CGFloat value)
{
CGFloat scale = RCTScreenScale();
return round(value * scale) / scale;
}

Apparently using round() which is for the type double, is the problem.

So, I changed it to roundf() which works with CGFloat and now it all works!

CGFloat RCTRoundPixelValue(CGFloat value)
{
CGFloat scale = RCTScreenScale();
CGFloat res = roundf(value * scale) / scale;
//NSLog(@"Result=%d",res); // NVF Fixed all rounds to roundf() so it computes right!!!!
return res;
}

In my codebase I searched for all other round() instances using float similarly and changed them also to use roundf()

All works consistently now.

Please fix this in the baseline -

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help Wanted :octocat:Issues ideal for external contributors.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions