nativescript-angular: SEGFAULT on iOS when ListView not enclosed by layout

I went through the guide (it is fantastic, even unfinished) and started to use it as a template for my own project. So I changed the list view and removed the outer GridLayout so it looks like

<ListView [items]="items" id="grocery-list" class="small-spacing">
  <template #item="item">
    <Label [text]="item.name" class="medium-spacing"></Label>
  </template>
</ListView>

on Android it works fine but in iOS I get a SEGFAULT

Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 1   0x134a10 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 2   0x7fbcd0 ffi_closure_inner
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 3   0x7fc622 ffi_closure_i386
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 4   0x33da059 -[NSObject performSelector:withObject:]
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 5   0x5aed096 -[CALayer layoutSublayers]
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 6   0x5ae08b6 CA::Layer::layout_if_needed(CA::Transaction*)
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 7   0x5ae071a CA::Layer::layout_and_display_if_needed(CA::Transaction*)
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 8   0x5ad2ee7 CA::Context::commit_transaction(CA::Transaction*)
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 9   0x5b07847 CA::Transaction::commit()
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 10  0x5b08108 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 11  0x381d75e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 12  0x381d6be __CFRunLoopDoObservers
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 13  0x381303c __CFRunLoopRun
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 14  0x3812846 CFRunLoopRunSpecific
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 15  0x381265b CFRunLoopRunInMode
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 16  0x5583664 GSEventRunModal
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 17  0x55834a1 GSEventRun
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 18  0x15b7eb9 UIApplicationMain
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: 19  0x7fc4e8 ffi_call_i386
Apr 12 10:20:34 MacBook-Pro picturesapp[7163]: file:///app/tns_modules/ui/content-view/content-view.js:37:91: JS ERROR Error: More than one layout child inside a ContentView
Apr 12 10:20:34 MacBook-Pro com.apple.CoreSimulator.SimDevice.0318C35B-B97F-4347-87AF-511D535BDD31.launchd_sim[5753] (UIKitApplication:org.nativescript.pictures[0xdf16][7163]): Service exited due to signal: Segmentation fault: 11

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@OscarLopezArnaiz @jonnysamps @tjvantoll

How to resolve this issue

The best way to resolve this is by wrapping your content in a GridLayout like so:

<ActionBar title="Sandbox Title">
    <NavigationButton text="Back" android.systemIcon="ic_menu_back" (tap)="routerExtensions.back()"></NavigationButton>
    <ActionItem ios.position="right" text="Done"></ActionItem>
</ActionBar>

<GridLayout rows="*">
    <ListView row="0" [items]="images" (itemTap)="onItemTap($event)">
        <template let-item="item">
            <Image [imageSource]="item"></Image>
        </template>
    </ListView>
</GridLayout>

The rows="*" will stretch your layout vertically %100 of the screen.