Skip to content

docs: UI docs #102

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

Merged
merged 92 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
a8fe96c
ci: allow lint failure for now
rigor789 Mar 31, 2023
f738c7d
docs: TextView (#94)
Ombuweb Mar 31, 2023
fa734a0
docs: Switch (#86)
Ombuweb Mar 31, 2023
a641fa3
docs: SegmentedBar (#84)
Ombuweb Mar 31, 2023
56be90a
docs: ScrollView (#82)
Ombuweb Mar 31, 2023
aefc013
docs: Placeholder (#78)
Ombuweb Mar 31, 2023
2b607db
docs: ListPicker (#76)
Ombuweb Mar 31, 2023
72b2db9
docs: Image (#74)
Ombuweb Mar 31, 2023
10997e6
docs: DatePicker (#72)
Ombuweb Mar 31, 2023
8959248
docs: ActionBar (#69)
Ombuweb Mar 31, 2023
287ffd8
docs: GridLayout (#64)
Ombuweb Mar 31, 2023
703ff25
docs: DockLayout (#63)
Ombuweb Mar 31, 2023
03f5dc0
docs: RootLayout (#66)
Ombuweb Mar 31, 2023
0abdb6f
docs: StackLayout (#65)
Ombuweb Mar 31, 2023
5d8b4ea
docs: ActivityIndicator (#70)
Ombuweb Mar 31, 2023
557c285
docs: FlexboxLayout (#68)
Ombuweb Mar 31, 2023
a62e3ed
docs: WrapLayout (#67)
Ombuweb Mar 31, 2023
e8fc036
ci: enable merge group
rigor789 Mar 31, 2023
ddc6fe5
docs: WebView (#91)
Ombuweb Mar 31, 2023
ef4df81
docs: HtmlView (#73)
Ombuweb Mar 31, 2023
2a38e38
docs: Button (#71)
Ombuweb Mar 31, 2023
dd24424
docs: Label (#75)
Ombuweb Mar 31, 2023
a29a597
docs: ListView (#77)
Ombuweb Mar 31, 2023
dc4104e
docs: Progress (#80)
Ombuweb Mar 31, 2023
c4a4bbc
docs: Repeater (#81)
Ombuweb Mar 31, 2023
8818fd0
docs: SearchBar (#83)
Ombuweb Mar 31, 2023
941e724
docs: Slider (#85)
Ombuweb Mar 31, 2023
f43ed20
docs: TabView (#87)
Ombuweb Mar 31, 2023
2320c8d
docs: TextField (#88)
Ombuweb Mar 31, 2023
d2f1387
docs: TimePicker (#90)
Ombuweb Mar 31, 2023
9af6e79
docs: Page (#79)
Ombuweb Mar 31, 2023
7ba9716
chore: initial cleanup pass
rigor789 Mar 31, 2023
fcfbbed
docs: improved StackLayout docs (#96)
ammarahm-ed Apr 1, 2023
5306760
fix: image src type (#97)
vallemar Apr 17, 2023
1c31a48
docs: Showing A Modal (#61)
Ombuweb May 11, 2023
ba67a09
Merge branch 'main' into docs/ui
rigor789 Aug 24, 2023
3bd7cba
chore: cleanup
rigor789 Aug 24, 2023
5aefc5e
chore: cleanup
rigor789 Aug 24, 2023
8fbbee8
chore: cleanup
rigor789 Aug 24, 2023
a94bddb
Merge branch 'main' into docs/ui
rigor789 Aug 26, 2023
6a3a66d
Merge branch 'main' into docs/ui
rigor789 Aug 26, 2023
a49c1d8
chore: cleanup
rigor789 Aug 26, 2023
5286166
Merge branch 'main' into docs/ui
rigor789 Aug 26, 2023
6f82577
chore: cleanup
rigor789 Aug 26, 2023
8fc918f
chore: separate UI docs from main docs
rigor789 Aug 26, 2023
d78e484
Merge branch 'main' into docs/ui
rigor789 Aug 26, 2023
2e0575b
Merge branch 'main' into docs/ui
rigor789 Aug 26, 2023
d50af33
chore: clean up sidebar & breadcrumbs
rigor789 Aug 26, 2023
e5b0718
fix: index page
rigor789 Aug 26, 2023
93137e7
chore: add ui index description
rigor789 Aug 26, 2023
c23d7ff
chore: cleanup Stack/GridLayout
rigor789 Aug 26, 2023
ed903a6
docs: clean up flexbox layout + grid/stack examples
rigor789 Aug 26, 2023
6b0f685
fix: api ref link
rigor789 Aug 26, 2023
c0260e5
docs: cleanup ActivityIndicator
rigor789 Aug 28, 2023
f082103
docs: cleanup button
rigor789 Aug 28, 2023
8a43d52
docs: clean up DatePicker + Button/ActivityIndicator
rigor789 Aug 28, 2023
e229826
docs: cleanup HtmlView
rigor789 Aug 28, 2023
a30d49c
docs: cleanup Image
rigor789 Aug 28, 2023
ecd9d71
feat: add examples app
rigor789 Aug 28, 2023
e7ecd7f
feat: generate new screenshots [wip]
rigor789 Aug 28, 2023
33df615
docs: cleanup Label & use new screenshots/snippets
rigor789 Aug 28, 2023
cb7162c
docs: cleanup ListPicker
rigor789 Aug 28, 2023
4a1cabf
docs: cleanup ListView
rigor789 Aug 28, 2023
a53668d
docs: cleanup Placeholder
rigor789 Aug 28, 2023
e0c54c8
chore: update screenshots
rigor789 Aug 28, 2023
a31c6ba
docs: cleanup Progress
rigor789 Aug 28, 2023
3fa38e4
docs: cleanup ScrollView
rigor789 Aug 28, 2023
0fd4774
docs: cleanup SearchBar
rigor789 Aug 28, 2023
ed699c0
docs: cleanup SegmentedBar
rigor789 Aug 28, 2023
99ae841
docs: cleanup Slider
rigor789 Aug 28, 2023
338f9b7
docs: cleanup Switch
rigor789 Aug 28, 2023
94387b2
docs: cleanup TabView
rigor789 Aug 28, 2023
f03d0db
chore: fix formatting
rigor789 Aug 28, 2023
857f9cf
chore: hyphenate ui component files
rigor789 Aug 28, 2023
1893b95
chore: add contributors to ScrollView
rigor789 Aug 28, 2023
9a74d38
docs: cleanup WebView
rigor789 Aug 28, 2023
f4e1c3e
docs: cleanup TimePicker
rigor789 Aug 28, 2023
aa0cdb5
docs: cleanup TextField
rigor789 Aug 28, 2023
fe7ad3a
chore: cleanup
rigor789 Aug 28, 2023
38c8799
chore: add contributors to TextField
rigor789 Aug 28, 2023
c953fa6
docs: cleanup TextView
rigor789 Aug 28, 2023
122a00a
chore: update TextView contributors
rigor789 Aug 28, 2023
a4ff032
docs: cleanup WrapLayout
rigor789 Aug 28, 2023
ea5517b
docs: cleanup DockLayout
rigor789 Aug 28, 2023
d46c91f
docs: cleanup RootLayout
rigor789 Aug 28, 2023
de2d8f4
docs: cleanup ActionBar, ActionItem, NavigationButton
rigor789 Aug 29, 2023
faccba8
docs: cleanup modals
rigor789 Aug 29, 2023
b9a2c12
docs: cleanup Page
rigor789 Aug 29, 2023
2e8235d
docs: document Frame
rigor789 Aug 29, 2023
b631276
chore: cleanup Native component sections
rigor789 Aug 29, 2023
3a64c03
chore: fix date for DatePicker screenshot
rigor789 Aug 29, 2023
20ca4d5
Merge branch 'main' into docs/ui
rigor789 Aug 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [main, docs/ui]
pull_request:
branches: [main, docs/ui]
merge_group:
branches: [main, docs/ui]

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ node_modules
.vitepress/dist
.vitepress/cache

explore/

yarn.lock
.DS_Store
1 change: 1 addition & 0 deletions .textlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
["labelled", "labeled"],
["licence", "license"],
["organise", "organize"],
["optimise", "optimize"],

// Common misspellings
["gaurantee", "guarantee"],
Expand Down
2 changes: 2 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'vitepress'
import apiSidebar from '../content/api/sidebar.json'
import mainSidebar from '../content/sidebar'
import uiSidebar from '../content/ui/sidebar'
import nav from './nav'
import './theme/cliLanguage'
import path from 'node:path'
Expand Down Expand Up @@ -36,6 +37,7 @@ export default defineConfig({
nav,
sidebar: {
'/api': apiSidebar,
'/ui': uiSidebar,
'/': mainSidebar,
},
},
Expand Down
21 changes: 14 additions & 7 deletions .vitepress/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@ export default [
{
text: 'Docs',
link: '/',
activeMatch: '^/(?!plugins|best-practices|api|dev-reference|tutorials)',
activeMatch: '^/(?!plugins|best-practices|api|dev-reference|tutorials|ui)',
icon: 'BookOpenIcon',
},
{
text: 'Preview',
link: 'https://preview.nativescript.org',
icon: 'DevicePhoneMobileIcon',
target: '_blank',
},

{
text: 'Tutorials',
link: '/tutorials/',
activeMatch: '^/tutorials',
icon: 'AcademicCapIcon',
},
{
text: 'Preview',
link: 'https://preview.nativescript.org',
icon: 'DevicePhoneMobileIcon',
target: '_blank',
},
{
text: 'Plugins',
link: '/soon',
Expand All @@ -44,6 +45,12 @@ export default [
link: '/soon',
icon: 'CpuChipIcon',
},
{
text: 'UI Components',
link: '/ui/',
activeMatch: '^/ui',
icon: 'CubeTransparentIcon',
},
{
text: 'API Reference',
link: '/api/',
Expand Down
2 changes: 1 addition & 1 deletion content/api/class/Image.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ breadcrumbs:
- name: 'Image'
layout: api
seo:
description: "Represents a class that provides functionality for loading and streching image(s)."
description: "Represents a class that provides functionality for loading and streching images."
---

<!-- This page is auto generated, do not edit manually. -->
Expand Down
89 changes: 89 additions & 0 deletions content/guide/navigation/modals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Navigation using Modals
description: Navigation using modals - detached from the current backstack.
contributos:
- Ombuweb
- rigor789
---

## Showing a modal

To show a modal, call the [showModal](https://docs.nativescript.org/api-reference/classes/view#showmodal) method on a [View](https://docs.nativescript.org/api-reference/classes/view) instance and pass it the path to the modal view file:

```xml
<Button text="View details" tap="onTap" />
```

```ts
onTap(args: EventData) {
const button = args.object as Button
button.showModal("details-page")
}
```

## Closing a modal

To close a modal, call the `closeModal` method of any `View` from the modal. Optionally pass it data you want to access in the parent page:

```xml
<Button text="Close" tap="onTap" />
```

```ts
onTap(args: EventData) {
const button = args.object as Button
button.closeModal({
name: 'John Doe - EDITED',
})
}
```

## Passing data to and from a modal

Passing data can be done by passing a `context` in the `showModal` options parameter.

```ts
const options: ShowModalOptions = {
context: { name: 'John Doe' },
closeCallback(args: { name: string }) {
console.log('Modal closed', args.name)
},
}
// ...
button.showModal('details-page', options)
```

To access the data in the modal, handle the `shownModally` event, and access it via `args.context`.

```xml
<Page shownModally="onShownModally">
<StackLayout>
<TextField text="{{ name }}" />
<Button text="Close" tap="onClose"/>
</StackLayout>
</Page>
```

```ts
import {
fromObject,
Page,
Button,
ShownModallyData,
EventData,
} from '@nativescript/core'

export function onShownModally(args: ShownModallyData) {
const page = args.object as Page
const context = fromObject({
...args.context,
onClose(args: EventData) {
const button = args.object as Button
button.closeModal({
name: context.name, // 'John Doe - EDITED'
})
},
})
page.bindingContext = context
}
```
2 changes: 1 addition & 1 deletion content/project-structure/src/fonts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A folder for storing custom fonts. Any `.ttf` files placed here are automaticall

## Using Custom Fonts

Place the `.ttf` file(s) in the `src/fonts` folder, then run
Place the `.ttf` files in the `src/fonts` folder, then run

```cli
ns fonts
Expand Down
Binary file added content/screenshots/android/ActionBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/Button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/DatePicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/HtmlView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/Image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/Label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/ListPicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/ListView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/Placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/Progress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/ScrollView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/SearchBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/SegmentedBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/Slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/Switch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/TabView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/TextField.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/TextView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/TimePicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/android/WebView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/ios/ActionBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/ios/ActivityIndicator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/ios/Button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/ios/DatePicker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/ios/HtmlView.png
Binary file added content/screenshots/ios/Image.png
Binary file added content/screenshots/ios/Label.png
Binary file added content/screenshots/ios/ListPicker.png
Binary file added content/screenshots/ios/ListView.png
Binary file added content/screenshots/ios/Placeholder.png
Binary file added content/screenshots/ios/Progress.png
Binary file added content/screenshots/ios/ScrollView.png
Binary file added content/screenshots/ios/SearchBar.png
Binary file added content/screenshots/ios/SegmentedBar.png
Binary file added content/screenshots/ios/Slider.png
Binary file added content/screenshots/ios/Switch.png
Binary file added content/screenshots/ios/TabView.png
Binary file added content/screenshots/ios/TextField.png
Binary file added content/screenshots/ios/TextView.png
Binary file added content/screenshots/ios/TimePicker.png
Binary file added content/screenshots/ios/WebView.png
12 changes: 4 additions & 8 deletions content/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export default [
text: 'Creating a Project',
link: '/guide/creating-a-project',
},
// {
// text: 'Tutorials',
// link: '/tutorials/',
// },
{
text: 'Using Modals',
link: '/guide/navigation/modals',
},
{
text: 'Troubleshooting',
link: '/troubleshooting',
Expand Down Expand Up @@ -162,8 +162,4 @@ export default [
},
],
},
{
text: 'UI / Layout Containers',
items: [{ text: 'AbsoluteLayout', link: '/ui/absolute-layout' }],
},
] as NSSidebarGroup[]
24 changes: 12 additions & 12 deletions content/tutorials/build-a-master-detail-app-with-angular.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Let's start with creating the files for our home feature with the following cont

<!-- tab:home.component.html -->

```html
```xml
<!-- src/app/features/home/home.component.html -->
```

Expand Down Expand Up @@ -336,7 +336,7 @@ Next, let's break down the layout and UI elements of the home page.

The home page can be divided into two main parts, the ActionBar with the title and the scrollable main content area with the cards (we will talk about the cards in the next section). Let's start with creating the ActionBar with the title. Open `home.component.html` and add the following code:

```html
```xml
<!-- src/app/features/home/home.component.html -->

<ActionBar title="NativeFlix"></ActionBar>
Expand Down Expand Up @@ -370,7 +370,7 @@ export class HomeComponent {

Next, open your `home.component.html` and add the `ListView` component:

```html{6-12}
```xml{6-12}
<!-- src/app/features/home/home.component.html -->

<ActionBar title="NativeFlix"></ActionBar>
Expand Down Expand Up @@ -427,7 +427,7 @@ Before we dive into creating the card below, let's create some classes for our b

As you can see in the image above, each card is made up of 3 components, the preview image, a title, and a description. We will be using a `GridLayout` as our container and use the `Image` and `Label` components for the preview image and texts. Open your `home.component.html` and add the following:

```html{8-35}
```xml{8-35}
<!-- src/app/features/home/home.component.html -->

<ActionBar title="NativeFlix"></ActionBar>
Expand Down Expand Up @@ -479,7 +479,7 @@ Let's start with creating the files for our details feature with the following c

<!-- tab:details.component.html -->

```html
```xml
<!-- src/app/features/details/details.component.html -->
```

Expand Down Expand Up @@ -610,7 +610,7 @@ export class HomeComponent {

Next, let's add the tap event to the ListView items. Open `home.component.html` and add the following:

```html{10}
```xml{10}
<!-- src/app/features/home/home.component.html -->

<ActionBar title="NativeFlix"></ActionBar>
Expand Down Expand Up @@ -701,7 +701,7 @@ Let's break down the layout and UI elements of the details page.

The details page can be divided into three main parts, the ActionBar with the flick title, the hero image, and the main content with the flick details. We will use the `details` array from our `flicks` object to populate the flick details section. The `details` array contains objects with a `title` and `body` which are rendered uniformly, each with their style. We can use Angular's `*ngFor` directive to loop through the array and create a UI element or set of elements for each entry in the array. Open `details.component.html` and add the following code:

```html
```xml
<!-- src/app/features/details/details.component.html -->

<!-- actionbar -->
Expand All @@ -710,25 +710,25 @@ The details page can be divided into three main parts, the ActionBar with the fl
<ScrollView height="100%">
<StackLayout>
<!-- hero image -->
<image margin="0" stretch="aspectFill" [src]="flick?.image"></image>
<Image margin="0" stretch="aspectFill" [src]="flick?.image"></Image>

<!-- main content -->
<StackLayout padding="10 20">
<ng-container *ngFor="let detail of flick?.details">
<label
<Label
marginTop="15"
fontSize="16"
fontWeight="700"
class="text-primary"
textWrap="true"
[text]="detail.title"
></label>
<label
></Label>
<Label
fontSize="14"
class="text-secondary"
textWrap="true"
[text]="detail.body"
></label>
></Label>
</ng-container>
</StackLayout>
</StackLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ Next, let's add the tap event to the ListView items. Open `home-page.xml` and ad

### Access navigation props

We passed in the `id` of the flick card the user tapped on in the previous section as we navigate to the details page. We can access the passed in `id` via the page's `navigationContext`. We will first get the `navigationContext` on our details page and pass it along to our `DetailsViewModel`. We can then use the `id` to get the selected flick information to be displayed in our details component's template. Open `details-page.js` and add the following:
We passed in the `id` of the flick card the user tapped on in the previous section as we navigate to the details page. We can access the passed-in `id` via the page's `navigationContext`. We will first get the `navigationContext` on our details page and pass it along to our `DetailsViewModel`. We can then use the `id` to get the selected flick information to be displayed in our details component's template. Open `details-page.js` and add the following:

```javascript{9}
// app/details/details-page.js
Expand All @@ -547,7 +547,7 @@ import { FlickService } from '../services/flick.service'
export class DetailsViewModel extends Observable {
#flick

// the passed in context object during the navigation will be here
// the passed-in context object during the navigation will be here
constructor(_context) {
super()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ Next, let's add the tap event to the ListView items. Open `home-page.xml` and ad

### Access navigation props

We passed in the `id` of the flick card the user tapped on in the previous section as we navigate to the details page. We can access the passed in `id` via the page's `navigationContext`. We will first get the `navigationContext` on our details page and pass it along to our `DetailsViewModel`. We can then use the `id` to get the selected flick information to be displayed in our details component's template. Open `details-page.ts` and add the following:
We passed in the `id` of the flick card the user tapped on in the previous section as we navigate to the details page. We can access the passed-in `id` via the page's `navigationContext`. We will first get the `navigationContext` on our details page and pass it along to our `DetailsViewModel`. We can then use the `id` to get the selected flick information to be displayed in our details component's template. Open `details-page.ts` and add the following:

```typescript{9}
// app/details/details-page.ts
Expand Down Expand Up @@ -578,7 +578,7 @@ import { FlickModel } from '../models'
export class DetailsViewModel extends Observable {
private _flick: FlickModel

// the passed in context object during the navigation will be here
// the passed-in context object during the navigation will be here
constructor(private _context: { flickId: number }) {
super()

Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/build-a-master-detail-app-with-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ export function HomeScreen({ navigation }: HomeScreenProps) {

### Access navigation props

We passed in the `id` of the flick card the user tapped on in the previous section as we navigate to the details page. We can access the passed in `id` via the `route.params` property. We can then use the `id` to get the selected flick information to be displayed in our details component's template. Open `DetailsScreen.tsx` and add the following:
We passed in the `id` of the flick card the user tapped on in the previous section as we navigate to the details page. We can access the passed-in `id` via the `route.params` property. We can then use the `id` to get the selected flick information to be displayed in our details component's template. Open `DetailsScreen.tsx` and add the following:

```tsx{9,17,19}
// src/components/DetailsScreen.tsx
Expand Down
Loading