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

Use 'context' instead of 'props' in the documentation on navigation

Open thedjdoorn opened this issue 4 years ago • 1 comments

Okay, so I have been unable to pass data to a detail page by using the props property in the navigate method. When looking into the documentation on Nativescript's NavigationEntry, I noticed that context was used rather than props to pass data to the component, and that works with no issues whatsoever.

My proposition is as follows:

  • Replace props by context in the documentation on navigation when passing properties
  • Provide an example of Detail.svelte where the on:navigatingTo Event is used to read those properties

thedjdoorn avatar Sep 19 '20 20:09 thedjdoorn

I couldn't reproduce this. in App.svelte:

<label on:tap={() => navigate({
            page: NextPage,
            props: {
                navProp1: "Hi from parent"
            }
        })} >

in NextPage.svelte

<script>
    export let navProp1 = "default"
</script>
<page>
    <gridLayout>
        <label class="info" horizontalAlignment="center" verticalAlignment="middle" >
            Child page with prop: {navProp1}
        </label>
    </gridLayout>
</page>

gives me

image

halfnelson avatar Nov 01 '20 09:11 halfnelson