An individual item that will be displayed by a StackNavigator component. Provides the view, an optional function to set properties before the view is displayed, and an optional list of events to map to actions (like push, pop, and replace) on the StackNavigator.

The following example creates a new StackItem using the SettingsView class to instantiate the view instance. This item is given am id of "settings". When the view dispatches the SettingsView.SHOW_ADVANCED_SETTINGS event, the StackNavigator will push a different item with the ID "advancedSettings" onto its history stack. When the view instance dispatches Event.COMPLETE, the StackNavigator will pop the view from its history stack and return navigate to the previous view.

var item = StackItem.withClass("settings", SettingsScreen, [
	SettingsScreen.SHOW_ADVANCED_SETTINGS => StackActions.Push("advancedSettings"),
	Event.COMPLETE => StackActions.Pop()
]);
navigator.addItem("settings", item);
Available since

1.0.0

.

See also:

Static methods

staticwithClass(id:String, viewClass:Class<DisplayObject>, ?actions:Map<String, StackAction>, ?returnHandlers:Map<String, (Dynamic, Dynamic) ‑> Void>):StackItem

Creates a StackItem that instantiates a view from a class that extends DisplayObject when the StackNavigator requests the item's view.

staticwithDisplayObject(id:String, viewInstance:DisplayObject, ?actions:Map<String, StackAction>, ?returnHandlers:Map<String, (Dynamic, Dynamic) ‑> Void>):StackItem

Creates a StackItem that always returns the same DisplayObject instance when the StackNavigator requests the item's view.

staticwithFunction(id:String, viewFunction:() ‑> DisplayObject, ?actions:Map<String, StackAction>, ?returnHandlers:Map<String, (Dynamic, Dynamic) ‑> Void>):StackItem

Creates a StackItem that calls a function that returns a DisplayObject when the StackNavigator requests the item's view.

Variables

id:String

The unique ID associated with this item.

Available since

1.0.0

.

popTransition:(DisplayObject, DisplayObject) ‑> IEffectContext

A custom "pop" transition for this item only. If null, the default popTransition defined by the StackNavigator will be used instead.

In the following example, the stack navigator item is given a push transition:

item.popTransition = Slide.createSlideRightTransition();

A number of animated transitions may be found in the feathers.motion.transitions package. However, you are not limited to only these transitions. You may create custom transitions too.

A custom transition function should have the following signature:

(DisplayObject, DisplayObject) -> IEffectContext

Either of the arguments typed as DisplayObject may be null, but never both. The first DisplayObject argument will be null when the first item is displayed or when a new item is displayed after clearing the current item. The second DisplayObject argument will be null when clearing the current item.

Available since

1.0.0

.

See also:

pushTransition:(DisplayObject, DisplayObject) ‑> IEffectContext

A custom "push" transition for this item only. If null, the default pushTransition defined by the StackNavigator will be used instead.

In the following example, the stack navigator item is given a push transition:

item.pushTransition = Slide.createSlideLeftTransition();

A number of animated transitions may be found in the feathers.motion.transitions package. However, you are not limited to only these transitions. You may create custom transitions too.

A custom transition function should have the following signature:

(DisplayObject, DisplayObject) -> IEffectContext

Either of the arguments typed as DisplayObject may be null, but never both. The first DisplayObject argument will be null when the first item is displayed or when a new item is displayed after clearing the current item. The second DisplayObject argument will be null when clearing the current item.

Available since

1.0.0

.

See also:

Methods

setAction(eventType:String, action:StackAction):Void

Sets a new action to perform when the view dispatches an event. If the action is null, removes an action that was set previously.

Available since

1.0.0

.