Skip to content

[RootLayout] TypeError: Cannot read property 'setOnTouchListener' of undefined #10118

@RGBvision

Description

@RGBvision

Issue Description

If two pages have a RootLayout element, then after backward navigation from the second page to the first page, an error will occur when trying to access the RootLayout (e.g. call getRootLayout()).
This is because RootLayout class called on the second page overwrites the global variable:

global.rootLayout = this;

So RootLayout of the first page "becomes" undefined.

Workaround (code for the first page):

export function navigatedTo(data: NavigatedData) {
  const page = <Page>data.object;
  if (data.isBackNavigation) {
    global.rootLayout = <RootLayout>page.getViewById('firstPageRootLayout');
  }
}

Reproduction

No response

Relevant log output (if applicable)

No response

Environment

No response

Please accept these terms

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions