Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Svelte context API does not work with NativeScript navigators #316

@bretep

Description

@bretep

Problem

Wrapping your app in a svelte context does not work when navigating to a new page:
Example: https://github.com/bretep/context-example

Why

Svelte uses the current component to set the context. All child components have access to the context of the parent components.
https://github.com/sveltejs/svelte/blob/master/src/runtime/internal/lifecycle.ts

When navigating to a new page using NativeScript navigators, the new page begins a new component tree and does not have a parent.

Solution

Other NativeScript frameworks have implemented their own navigation vs. using the NativeScript navigators. Likely because of functionality like parent-child relationships of the framework.
https://react-nativescript.netlify.app/docs/core-concepts/navigation#do-use-react-nativescript-navigation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions