1.1.2 • Published 3 years ago

react-native-expandable-fab v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-expandable-fab npm version

This is a very small package for React Native containing an expandable and configurable floating action button.

Installation

Using npm: npm i react-native-expandable-fab or with yarn: yarn add react-native-expandable-fab

Usage

This package provides a single component which can be configured to your liking.

Props

Prop nameProp typeDescription
mainColorstringColor of the main FAB button
secondaryColorstringColor of the smaller buttons
closeIconReactNodeComponent to be displayed as an icon on the main FAB button in its closed state
openIconReactNodeComponent to be displayed as an icon on the main FAB button in its opened state
menuIconsMenuIcon[]Array of objects containing descriptions of the secondary FAB buttons

MenuIcon

Prop nameProp typeDescription
namestringName of the button
iconReactNodeComponent to be displayed as an icon on the button
textstring?(Optional) Text to be displayed next to the button
callback() => voidCallback function called upon clicking the button

Example

This example uses UI-Kitten components, but you can pretty much use any other components.

import ExpandableFloatingAction from 'react-native-expandable-fab';

<ExpandableFloatingAction
    mainColor="#F58B33"
    secondaryColor="#F9B065"
    closeIcon={<Icon name='close-outline' fill='#000'/>}
    openIcon={<Icon name='radio-button-on-outline' fill='#000'/>}
    menuIcons={[
        {
            name: 'inviteToGroup',
            icon: <Icon name='person-add-outline' fill='#000'/>,
            text: <Text>Invite to this group</Text>,
            callback: () => {}
        },
        {
            name: 'createNewTask',
            icon: <Icon name='plus-outline' fill='#000'/>,
            text: <Text>Create new task</Text>,
            callback: () => {}
        }
    ]}
/>