This example demonstrates how to display a basic UI screen in the Scripting app using the Navigation.present
API. It also shows how to set up navigation-related features such as the navigation stack and page title.
You will learn how to:
Navigation.present
NavigationStack
and VStack
navigationTitle
Navigation.present(options)
This function displays the given UI element modally as a full screen page. It takes an element
property that defines the root view to show.
NavigationStack
This component provides a navigation container that supports title display, navigation bar buttons, and structured transitions. It must be the outermost wrapper for views that use navigation features.
VStack
A vertical layout container that stacks children in a top-to-bottom arrangement. In this example, it holds a single Text
component.
navigationTitle
Set on VStack
, this prop sets the title shown in the navigation bar.
This example displays a simple page with the title "Present a simple view" and a message reading "Hello Scripting!" in the center of the screen.
NavigationStack
if you want navigation behavior like back buttons, titles, or toolbars.Script.exit()
after Navigation.present()
resolves to avoid memory leaks.