Skip to content
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

SvelteNativeDom: Navigate could not find frame with id #82

Closed
crisgol opened this issue Oct 20, 2019 · 3 comments
Closed

SvelteNativeDom: Navigate could not find frame with id #82

crisgol opened this issue Oct 20, 2019 · 3 comments

Comments

@crisgol
Copy link

crisgol commented Oct 20, 2019

error on

navigate({
page: Tabs,
frame:"firstFrame"
})

not find frame .

@halfnelson
Copy link
Owner

@crisgol Thanks for the report. Upon investigation it seems that this happens when calling navigate before the frame component has been attached to nativescript's view hierarchy. Svelte likes to mount the child components first.
The problem mainly happens when you are trying to navigate the frame to the first page of your application, you can work around this in the following ways:

Wait for the component containing the frame to be added to the main view.

Svelte has the tick method to help with this,

  onMount(async () => {
        await tick();
        navigate({ page: MainPage, frame: "my-frame-id" });
    })

Set the default page using the defautPage attribute of the frame

<frame defaultPage="{MainPage}">

Set the default page as child of frame

  <frame>
      <MainPage />
   </frame>

@halfnelson
Copy link
Owner

I must have had a false positive test, the tick method does not work. Re-opening

@jquesada2016
Copy link

Any progress on this? I had something similar to this issue, but it was that I was navigating to a page (on same frame) as soon as the app opened, and it would crash because the component didn't exist. I did not use, however, the tick() function. I used a timeout with a value of 0 and that worked for me. However, with a frame, it does not work, even if I wait a few seconds...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants