1.0.1 • Published 5 years ago

react-native-animated-absolute-buttons v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

react-native-animated-absolute-buttons

Animated absolute buttons that you can position anywhere on the screen. Feel free to use.

Example OneExample Two
npm.ionpm.io

Installation

npm install react-native-animated-absolute-buttons

Documentation

PropDescriptionTypeDefaultRequired
buttonSizeSize of the main button.number50NO
buttonColorColor of the main button.string'indigo'NO
buttonShapeShape of the main button. ('circular', 'rounded', 'square')string'circular'NO
buttonContentContent of the main button.any (text, icon component etc.)-YES
directionThe direction in which the buttons will open ('top', 'bottom', 'left', 'right')string'top'NO
positionPosition of all buttons ('top-left', 'top-right', 'bottom-left', 'bottom-right')string'bottom-right'NO
positionVerticalMarginVertical distance in the position of the buttonsnumber10NO
positionHorizontalMarginHorizontal distance in the position of the buttonsnumber10NO
timeTime to open buttons (animation time)number500NO
easingAnimation easing Please readstring'Linear'NO
buttonsButtons (Detailed explanations are below)array-YES

Props table for buttons array:

PropDescriptionTypeDefaultRequired
colorColor of the button.string-YES
contentContent of the button.any (text, icon component etc.)-YES
actionFunction of the button.function-YES

Usage

const buttons = [
    {
        color: 'blue',
        content: <Text>👊</Text>,
        action: () => {
            alert("You clicked!");
        }
    },
    {
        color: 'red',
        content: <Text>🤙</Text>,
        action: () => {
            alert("You clicked!");
        }
    },
    {
        color: 'green',
        content: <Text>👋</Text>,
        action: () => {
            alert("You clicked!");
        }
    },
];

<AnimatedAbsoluteButton
    buttonSize={50}
    buttonColor='indigo'
    buttonShape='circular'
    buttonContent={<Text>👍</Text>}
    direction='top'
    position='bottom-right'
    positionVerticalMargin={10}
    positionHorizontalMargin={10}
    time={500}
    easing='bounce'
    buttons={buttons}
/>