Navigation

Navigation allows you to flow through the app. Whenever you go-to a jig, the jig is added to the history, this allows you to go back and visit the jigs you visited before, and either show the history (data) on the UI or a new (clear) jig. This is helpful in complex flows, for example, adding multiple lines to an invoice and then submitting the invoice, or adding the details for each guest in a booking.

The go-to action is used to configure the flow of jigs in the app using the behaviour property. With the behaviour you determine if you want to push the screen into the app history, by using the new value, or show the one you already have in history by using the existing value.

New - creates a sequential stack showing the progression of navigation. Presents a new screen you are navigating to, allowing you to capture the next data set to add to the stack currently in the history. Typically, this would be used to capture the next line in an invoice. \

State Navigation- New
State Navigation- New

Existing - jumps to previously visited screens by recognizing existing instances. Displays the data of the existing screen you are navigating to, typically used when you want to review the captured lines in an invoice before submitting.

State Navigation- Existing
State Navigation- Existing

How to configure navigation

1

In the go-to action use the behaviour property to select new or existing.

2

Configure the LinkTo property with the jig name you want to open next.

3

Configure inputs if you are wanting to pass data between jigs.

Considerations:

  • By adding an instanceId to the go-to action, you choose if you want to create a new state or you want to reuse the existing state of a jig. Do not confuse this with the behaviour property's functionality.

  • If no inputs and instanceId are specified, the instanceId of the jig is set to no-inputs.

  • If an instanceId is specified, but inputs are not, then the instanceId uses the one specified.

  • If an instanceId and inputs are specified the instanceId uses the one specified.

  • If no instanceId is specified and inputs are specified the instanceId is hash (uuid) of the inputs.

Example and code snippets

go-to using new & existing behaviour

In this example, three jigs are configured to create a stack of data for each guest, including their Name, Age, and Address. Each jig's go-to action is set with the behaviour property as new, enabling new guest details to be pushed into the app history. In the final jig, a secondary go-to action is added. This action introduces a button to review each guest's data by setting the behaviour property to existing and linking to the first jig in the stack via the linkTo property. The review process will cycle through each guest's details in the stack before completing.

Go-to new guest
Go-to new guest
Review guests
Review guests
title: Name
type: jig.default

onFocus:
  type: action.reset-state
  options:
    state: [email protected]

header:
  type: component.jig-header
  options:
    height: medium
    children:
      type: component.image
      options:
        source:
          uri: https://images.unsplash.com/photo-1521336575822-6da63fb45455?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTB8fGFkdmVudHVyZXxlbnwwfHwwfHx8MA%3D%3D

children:
  - type: component.form
    instanceId: form-a
    options:
      isDiscardChangesAlertEnabled: false
      children:
        - type: component.text-field
          instanceId: fullName
          options:
            label: Name

actions:
  - children:
      - type: action.action-list
        options:
          title: NEXT
          isSequential: true
          actions:
            - type: action.execute-entity
              options:
                provider: DATA_PROVIDER_LOCAL
                entity: guests
                method: save
                data:
                  fullName: [email protected]
            # The go-to action is configured to open the next jig in the stack.
            - type: action.go-to
              options:
                # Set the parameters to use the value held in the state,
                # this will be used as an input throughout the stack.
                inputs:
                  fullName: [email protected]
                # Select new to push the jig into the app history,
                # this allows you to capture the next jig's data in the stack.
                behaviour: new
                # Configure which jig must open next.
                linkTo: jig-b

Last updated

Was this helpful?