svelte-native icon indicating copy to clipboard operation
svelte-native copied to clipboard

Using ListView with iOS's Large Titles crashes on scroll down

Open lumirth opened this issue 3 years ago • 0 comments

https://user-images.githubusercontent.com/65358837/180636933-7a64d945-dd68-42b7-8b31-8b124d30d540.mov

As can be seen in this video, the application crashes when attempting to scroll down with large titles enabled. This is probably(maybe possibly sorta kinda, not really sure) linked to something going wrong when it tries to move the text to the normal action bar position title upon scrolling down. Strangely enough, it is scrolling down specifically that causes the crash, not scrolling up. Logs and code below.

The code of the functioning scrolling page:

<scrollView>
    <stackLayout class="p-20" height="1000">
      <label text="  PAGE" class="h1 text-center"/>
      <label text="  PAGE" class="h2 text-center" textWrap="true"/>
      <label text="  PAGE" class="h1 text-center"/>
      <label text="  PAGE" class="h2 text-center" textWrap="true"/>
      <label text="  PAGE" class="h1 text-center"/>
      <label text="  PAGE" class="h2 text-center" textWrap="true"/>
    </stackLayout>
  </scrollView>

The code of the offending page:

<listView items="{items}">
  <Template let:item>
    <label text="{item}" />
  </Template>
</listView>

<script>
   ... see below
</script>
  import { ScrollView, StackLayout } from '@nativescript/core'
  import { Template } from 'svelte-native/components'

  let items = ["one", "two", "three"]

I'm using bottom navigation in the following manner, if it's relevant:

<page>
    <actionBar title="ActionBar Large Title" flat=true />

    <bottomNavigation height="400px" selectedIndex="0">
        <tabStrip>
            <tabStripItem>
                <label text="Pagewithnolistview" />
            </tabStripItem>
            <tabStripItem>
                <label text="Pagewithlistview" />
            </tabStripItem>
            ...
        </tabStrip>
        
        <tabContentItem>
            <gridLayout>
                <Pagewithnolistview />
            </gridLayout>
        </tabContentItem>
        <tabContentItem>
            <gridLayout>
                <Pagewithlistview />
            </gridLayout>
        ...
    </bottomNavigation>
</page>

In the script tab of the navigation-containing page is the following(the code to enable large titles):

    export function onLoaded(args: EventData) {
        const page = <Page>args.object;
        
        if (isIOS) {
            page.frame.ios.controller.navigationBar.prefersLargeTitles = true;
        }
    }

Logs(may contain some junk from some console.log's I have lying around):

CONSOLE LOG: Loading inspector modules...
CONSOLE LOG: Finished loading inspector modules.
(RunningBoardServices) [com.apple.runningboard:connection] Identity resolved as application<org.nativescript.myapp>
CONSOLE LOG: *: store -> store()
(UIKitCore) [com.apple.UIKit:AppLifecycle] sceneOfRecord: sceneID: sceneID:org.nativescript.myapp-default  persistentID: E0FB41CC-91EC-4F27-A819-23F7634486D3
CONSOLE LOG: *: store -> init()
(UIKitCore) [com.apple.UIKit:KeyWindow] Window did become application key: UIWindow: 0x1375422a0; contextId: 0x9932CACA; scene identity: com.apple.frontboard.systemappservices::sceneID%3Aorg.nativescript.myapp-default
(UIKitCore) [com.apple.UIKit:AppLifecycle] sceneOfRecord: sceneID: sceneID:org.nativescript.myapp-default  persistentID: E0FB41CC-91EC-4F27-A819-23F7634486D3
(UIKitCore) [com.apple.UIKit:AppLifecycle] sceneOfRecord: sceneID: sceneID:org.nativescript.myapp-default  persistentID: E0FB41CC-91EC-4F27-A819-23F7634486D3
(UIKitCore) [com.apple.UIKit:AppLifecycle] sceneOfRecord: sceneID: sceneID:org.nativescript.myapp-default  persistentID: E0FB41CC-91EC-4F27-A819-23F7634486D3
(UIKitCore) [com.apple.UIKit:KeyWindow] Scene became target of keyboard event deferring environment: UIWindowScene: 0x137535f20; scene identity: com.apple.frontboard.systemappservices::sceneID%3Aorg.nativescript.myapp-default
(UIKitCore) [com.apple.UIKit:AppLifecycle] sceneOfRecord: sceneID: sceneID:org.nativescript.myapp-default  persistentID: E0FB41CC-91EC-4F27-A819-23F7634486D3
CONSOLE LOG: *: store -> activate() 1
CONSOLE LOG: set icon-i
CONSOLE LOG: set icon-a
CONSOLE LOG: set icon-i
CONSOLE LOG: set icon-i
***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: UITableView dataSource returned a nil cell for row at index path: <NSIndexPath: 0xb4b36feb0267431e> {length = 2, path = 0 - 0}. Table view: <UITableView: 0x13c01a600; frame = (0 0; 375 667); clipsToBounds = YES; tag = 30; gestureRecognizers = <NSArray: 0x6000010d3690>; layer = <CALayer: 0x600001ec9540>; contentOffset: {0, -115.5}; contentSize: {375, 132}; adjustedContentInset: {115.5, 0, 49, 0}; dataSource: <DataSource: 0x600001c9cc30>>, dataSource: <DataSource: 0x600001c9cc30>
at
_setNativeViewFrame(file:///app/vendor.js:20839:24)
at layoutNativeView(file:///app/vendor.js:20868:14)
at layout(file:///app/vendor.js:20755:18)
at layoutChild(file:///app/vendor.js:22945:15)
at layoutView(file:///app/vendor.js:22720:69)
at UILayoutViewController.viewDidLayoutSubviews(file:///app/vendor.js:22594:23)
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: UITableView dataSource returned a nil cell for row at index path: <NSIndexPath: 0xb4b36feb0267431e> {length = 2, path = 0 - 0}. Table view: <UITableView: 0x13c01a600; frame = (0 0; 375 667); clipsToBounds = YES; tag = 30; gestureRecognizers = <NSArray: 0x6000010d3690>; layer = <CALayer: 0x600001ec9540>; contentOffset: {0, -115.5}; contentSize: {375, 132}; adjustedContentInset: {115.5, 0, 49, 0}; dataSource: <DataSource: 0x600001c9cc30>>, dataSource: <DataSource: 0x600001c9cc30>
at
_setNativeViewFrame(file:///app/vendor.js:20839:24)
at layoutNativeView(file:///app/vendor.js:20868:14)
at layout(file:///app/vendor.js:20755:18)
at layoutChild(file:///app/vendor.js:22945:15)
at layoutView(file:///app/vendor.js:22720:69)
at UILayoutViewController.viewDidLayoutSubviews(file:///app/vendor.js:22594:23)
', reason: '(null)'
*** First throw call stack:
(
0   CoreFoundation                      0x000000<…>

I have tried things like putting the listView inside a layout or a scrollview, but depending on the type it either causes the same issue, causes the same issue but only if you scroll down farther, or allows scrolling but doesn't change the title size dynamically like it should.

Entirely possible it's an issue with NativeScript itself? Unfortunately, I don't have the expertise to tell. Any help or direction is appreciated.

lumirth avatar Jul 24 '22 07:07 lumirth