React NativeScript

React NativeScript

  • Docs

›ELEMENTS: COMPONENTS

INTRODUCTION

  • Introduction

GETTING STARTED

  • Quick Start
  • Environment Setup
  • Using React Devtools

CORE CONCEPTS

  • Native Access
  • Navigation
  • Node Roles
  • Modals
  • Plugins
  • Styling

SAMPLES

  • Apps

ELEMENTS: LAYOUT

  • AbsoluteLayout
  • DockLayout
  • FlexboxLayout
  • GridLayout
  • StackLayout
  • WrapLayout

ELEMENTS: COMPONENTS

  • ActivityIndicator
  • ActionBar
  • ActionItem
  • Button
  • DatePicker
  • Frame
  • HtmlView
  • Image
  • Label
  • ListView
  • ListPicker
  • NavigationButton
  • Page
  • Placeholder
  • Progress
  • ScrollView
  • SearchBar
  • SegmentedBar
  • Slider
  • Switch
  • TabView
  • TabViewItem
  • TextField
  • TextView
  • TimePicker
  • WebView

LICENCES

  • Licences
Edit

NavigationButton

<navigationButton> is a UI component that provides an abstraction for the Android navigation button and the iOS back button.

Extends <actionItem>.

See also:

  • Official top-level documentation
  • Detailed API specification
  • <actionBar>
  • <actionItem>

Introduction to Node Roles

An ActionItem is a child of the ActionBar, which is a complex component that can contain child components serving different roles (e.g. navigation button, title view, or action item). React NativeScript provides a nodeRole property so that you can make it explicit what role each given child serves.

Take care not to miss the nodeRole property that we set in the following examples, to see which children (and grandchildren) require which roles.

See: Node Roles

Basic use

import * as React from "react";

<actionBar title="My App">
  <navigationButton
    nodeRole={"navigationButton"}
    text="Go back"
    android={{
      position: undefined,
      systemIcon: "ic_menu_back"
    }}
    onTap={goBack}
  />
</actionBar>

Props

NameTypeDescription
textstring(iOS-only) Sets the text of the button.
android.systemIconstring(Android-only) The icon to be shown in the button. You can specify any system icon whose name begins with the ic_ prefix. For a complete list of the available icons, see the R.drawable Android class.
onTap(args:EventData) => voidEmitted when the NavigationButton is tapped.

Native component

AndroidiOS
android.widget.ToolbarUINavigationItem
Last updated by Jamie Birch
← ListPickerPage →
  • Props
  • Native component
React NativeScript
Docs
Getting StartedUI Components Reference
Community
Stack OverflowChat on Slack in #reactTwitter
More
GitHub – React NativeScriptGitHub – Docs Site
Copyright © 2021 Jamie Birch