Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cactuslab/native-navigation

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cactuslab/native-navigation

Native navigation for Capacitor apps

  • 0.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
3
Weekly downloads
 
Created
Source

Capacitor Native Navigation Plugin

Native navigation for Capacitor apps.

This package provides a Capacitor plugin for controlling native navigation UI from a React DOM app.

Please see the root of this repository for a discussion of how to use this plugin.

Install

npm install @cactuslab/native-navigation
npx cap sync

API

present(...)

present(options: PresentOptions) => Promise<PresentResult>

Present a new native UI.

ParamType
optionsPresentOptions

Returns: Promise<PresentResult>


dismiss(...)

dismiss(options?: DismissOptions | undefined) => Promise<DismissResult>

Dismiss a native UI.

ParamType
optionsDismissOptions

Returns: Promise<DismissResult>


push(...)

push(options: PushOptions) => Promise<PushResult>

Push a new component onto a stack, or replace an existing component.

ParamType
optionsPushOptions

Returns: Promise<PushResult>


pop(...)

pop(options: PopOptions) => Promise<PopResult>

Pop the top component off a stack

ParamType
optionsPopOptions

Returns: Promise<PopResult>


update(...)

update(options: UpdateOptions) => Promise<void>

Set the options for an existing component

ParamType
optionsUpdateOptions

reset(...)

reset(options?: ResetOptions | undefined) => Promise<void>

Remove all of the native UI and reset back to the root Capacitor webview.

ParamType
optionsResetOptions

get(...)

get(options?: GetOptions | undefined) => Promise<GetResult>

Get the spec and context of a component

ParamType
optionsGetOptions

Returns: Promise<GetResult>


message(...)

message<D>(options: MessageOptions<D>) => Promise<void>

Send a message to a component.

ParamType
optionsMessageOptions<D>

Interfaces

PresentResult
PropType
idComponentId
PresentOptions
PropTypeDescription
componentAnyComponentSpecThe component to present.
stylePresentationStyleThe presentation style. Defaults to 'fullScreen'
cancellablebooleanWhether to allow the user to use system gestures or the back button to unwind the presentation. Useful to prevent the accidental dismissal of a form. Defaults to true
animatedbooleanWhether to animate the presenting. Defaults to true
StackSpec
PropType
type'stack'
componentsViewSpec[]
barBarSpec
titlestring
ViewSpec
PropTypeDescription
type'view'
pathstringThe path representing the view.
stateViewState
titlestring
stackItemStackItemSpecOptions for when the component is used in a stack
StackItemSpec
PropTypeDescription
backItemStackBarButtonItem
leftItemsStackBarButtonItem[]
rightItemsStackBarButtonItem[]
backEnabledbooleanEnables the system gestures and buttons for managing the back action. Useful for preventing the user from exiting a window that is running an important operation. Does not prevent the user from backgrounding the application. Default behaviour is to use the host Stack configuration which behaves as backEnabled is true
barBarSpecCustomise the bar on top of the default options provided by the stack
StackBarButtonItem
PropType
idButtonId
titlestring
imageImageSpec
ImageObject
PropTypeDescription
uristringThe uri for the image.
scalenumberThe scale to use for the image, e.g. 2 for a 2x scale image. If not provided the scale will be determined automatically from the filename, or it will default to 1.
BarSpec
PropType
backgroundFillSpec
titleLabelSpec
buttonsLabelSpec
visibleboolean
FillSpec
PropType
colorstring
LabelSpec
PropType
colorstring
fontFontSpec
FontSpec
PropType
namestring
sizenumber
TabsSpec
PropType
type'tabs'
tabsTabSpec[]
titlestring
TabSpec
PropTypeDescription
idComponentIdThe id to use for the tab, or undefined to automatically generate an id.
titlestring
imageImageSpec
badgeValuestring
componentViewSpec | StackSpec
DismissResult
PropType
idComponentId
DismissOptions
PropType
idComponentId
animatedboolean
PushResult
PropTypeDescription
idComponentIdThe id of the component that was pushed.
stackComponentIdThe stack that was pushed to, if it was pushed to a stack.
PushOptions
PropTypeDescription
componentViewSpecThe options for the view to push onto the stack.
targetComponentIdThe target component to push to, usually a stack, or undefined to push to the current stack or component.
animatedbooleanWhether to animate the push. Defaults to true
modePushModeThe mode to use for the push. Defaults to 'push'. push: Push the component onto the stack. replace: Replace the current top-most component in the stack. root: Reset the stack back to just the new component.
popCountnumberHow many items to pop first
PopResult
PropTypeDescription
stackComponentId
countnumberThe number of components that were popped
idComponentIdThe id of the component that was popped, if any. If multiple components are popped, the id will be of the last component popped.
PopOptions
PropTypeDescription
stackComponentIdThe stack to pop from, or undefined to pop from the current stack.
countnumberHow many items to pop
animatedbooleanWhether to animate the pop. Defaults to true
UpdateOptions
PropTypeDescription
idComponentId
animatedbooleanWhether to animate the changes. Defaults to false
updateStackUpdate | TabsUpdate | TabUpdate | ViewUpdate
StackUpdate

Options for stack components

PropType
componentsViewSpec[]
barBarUpdate
BarUpdate
PropType
backgroundFillUpdate | null
titleLabelUpdate | null
buttonsLabelUpdate | null
visibleboolean | null
FillUpdate
PropType
colorstring | null
LabelUpdate
PropType
colorstring | null
fontFontUpdate | null
FontUpdate
PropType
namestring | null
sizenumber | null
TabsUpdate

Options for tabs components

PropType
tabsTabSpec[]
TabUpdate
PropType
titlestring | null
imageImageSpec | null
badgeValuestring | null
componentViewSpec | StackSpec
ViewUpdate

Options for view components

PropTypeDescription
stackItemStackItemUpdateOptions for when the component is used in a stack
StackItemUpdate
PropTypeDescription
backItemStackBarButtonItem | null
leftItemsStackBarButtonItem[] | null
rightItemsStackBarButtonItem[] | null
backEnabledboolean | nullEnables the system gestures and buttons for managing the back action. Useful for preventing the user from exiting a window that is running an important operation. Does not prevent the user from backgrounding the application. Default behaviour is to use the host Stack configuration which behaves as backEnabled is true
barBarUpdate | nullCustomise the bar on top of the default options provided by the stack
ResetOptions
PropTypeDescription
animatedbooleanWhether to animate resetting the navigation back to Capacitor Defaults to false
GetResult
PropTypeDescription
componentAnyComponentSpecThe component, if any.
stackStackSpecThe stack containing the component, if any.
tabsTabsSpecThe tabs containing the component, if any.
GetOptions
PropTypeDescription
idComponentIdThe component id to get, or undefined to get the top-most component.
MessageOptions
PropTypeDescription
targetComponentIdThe target component of the message, or undefined to send to the top-most component.
typestringThe message type.
valueDA message value. Must be JSON stringifiable.

Type Aliases

ComponentId

string

AnyComponentSpec

StackSpec | TabsSpec | ViewSpec

ViewState

Record<string, string | number | boolean | null>

Record

Construct a type with a set of properties K of type T

{ [P in K]: T; }

ButtonId

string

ImageSpec

ImageObject | string

PresentationStyle

'fullScreen' | 'pageSheet' | 'formSheet' | 'dialog'

PushMode

push: Push the component onto the stack. replace: Replace the current top-most component in the stack. root: Reset the stack back to just the new component.

'push' | 'replace' | 'root'

Keywords

FAQs

Package last updated on 19 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc