svelte-native
svelte-native copied to clipboard
Use 'context' instead of 'props' in the documentation on navigation
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
propsbycontextin the documentation on navigation when passing properties - Provide an example of
Detail.sveltewhere theon:navigatingToEvent is used to read those properties
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
