Socket
Book a DemoInstallSign in
Socket

github.com/bradmartin/nativescript-floatingactionbutton

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/bradmartin/nativescript-floatingactionbutton

v2.2.3+incompatible
Source
Go
Version published
Created
Source

npm npm

NativeScript-FloatingActionButton

XML widget to create the Material Design Floating Action Button for NativeScript apps.

Material Design Floating Action Button Spec

Installation

npm install nativescript-floatingactionbutton

Screenshot

FAB Android Screenshot FAB iOS Screenshot

Multiple FAB/Swipe Animation Support

FAB Animations

Usage

XML

NOTE The sample XML here will position the FAB on top of the ListView. There is no need for absolute positioning.
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded"
      xmlns:FAB="nativescript-floatingactionbutton">
    <Page.actionBar>
        <ActionBar title="Native FAB" backgroundColor="#3F51B5" color="#fff" />
    </Page.actionBar>
    <grid-layout rows="auto, *">
        <list-view row="1" items="{{ users }}">
            <list-view.itemTemplate>
                <label text="{{ name }}" textWrap="true" fontSize="18" margin="20" />
            </list-view.itemTemplate>
        </list-view>
            <FAB:fab tap="fabTap"
                     row="1"
                     icon="res://ic_add_white"
                     rippleColor="#f1f1f1"
                     class="fab-button" />
    </grid-layout>
</Page>

PLEASE NOTE: The fab is on the same row number as the listview

CSS

Recommended CSS styles.

.fab-button {
    height: 70;
    margin: 15;
    background-color: #ff4081; 
    horizontal-align: right; 
    vertical-align: bottom; 
}

JS

exports.fabTap = function(args) {
    console.log('tapped');
}

Attributes

PropertyAndroidiOSDescriptionNote
backColorXXSets the background color of the buttonBetter set in CSS
iconXXSupports the same image source options that NativeScript images supportRequired on android
rippleColorXRipple color on lollipop devices, it will fill the FAB on pre-lollipop devicesNone
hideOnSwipeOfViewXXDirects the fab to animate itself in and out on scrollPass it the name of the view to monitor for a scroll event example: hideOnSwipeOfView="userListView"
hideAnimationDurationXXHow many milliseconds it takes for the button to hide.Default if not set: 300ms
swipeAnimationXXslideDown, slideUp, slideLeft, slideRight, scaleDefault is slideDown

NativeScript Compatibility

NativeScript VersionFloatingActionButton Plugin Version
1.6+2.+
1.51.91

iOS Notes

  • We're using MNFloatingActionButton by Matt Nydam
  • Width\Height are requried properties
  • icon is a required property, if left as empty string default will be shown

Release Notes

2.2.0

  • Scale iOS images to 1/2 height
  • swipeAnimation property added to define animations for the FAB

Contributors

FAQs

Package last updated on 01 Jun 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.