Coder Social home page Coder Social logo

amclap / nativescript-floatingactionbutton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nstudio/nativescript-floatingactionbutton

0.0 2.0 0.0 6.44 MB

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

CSS 4.48% JavaScript 95.52%

nativescript-floatingactionbutton's Introduction

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

Property Android iOS Description Note
backColor X X Sets the background color of the button Better set in CSS
icon X X Supports the same image source options that NativeScript images support Required on android
rippleColor X Ripple color on lollipop devices, it will fill the FAB on pre-lollipop devices None
hideOnSwipeOfView X X Directs the fab to animate itself in and out on scroll Pass it the name of the view to monitor for a scroll event example: hideOnSwipeOfView="userListView"
hideAnimationDuration X X How many milliseconds it takes for the button to hide. Default if not set: 300ms
swipeAnimation X X slideDown, slideUp, slideLeft, slideRight, scale Default is slideDown

NativeScript Compatibility

NativeScript Version FloatingActionButton Plugin Version
1.6+ 2.+
1.5 1.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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.