HomeOur TeamContact

Custom Button 3

By Utkarsh Lubal
Published in UI
May 06, 2023
1 min read
Custom Button 3

Table Of Contents

01
Introduction
02
Installations
03
Example
04
Tutorial

Introduction

React native really awesome-button is a performant, extendable, production ready React Native component that renders an animated set of 3D UI buttons.

Props

AttributesTypeDefaultDescription
activityColorString#FFFFFFButton activity indicator color
activeOpacityNumber1Button active state opacity
animatedPlaceholderBooleantrueWhen set to false removes the placeholder animation loop
backgroundActiveString#C0C0C0Button active state background-color
backgroundColorString#C0C0C0Button content background-color
backgroundDarkerString#9F9F9FButton bottom-front-face background-color
backgroundShadowString#C0C0C0Button bottom shadow background-color
backgroundPlaceholderString#C0C0C0Button placeholder background-color
backgroundProgressString#C0C0C0Button progress bar background-color
borderColorStringnullButton border-color
borderRadiusNumber4Button border-radius
borderWidthNumber0Button border-width
dangerouslySetPressablePropsPressablePropsnullExposes the PressableProps of the Pressable wrapper; it can overwrite all props except onPressIn and onPressOut
debouncedPressTimeNumber0Configure onPress function debounce time
disabledBooleantrueButton disabled state: cancels animation and onPress func
heightNumber50Button height
widthNumbernullSetting width to null mirrors an auto behaviour
paddingHorizontalNumber12Sets the button horizontal padding
paddingTopNumber0Sets the button padding top
paddingBottomNumber0Sets the button padding bottom
stretchBooleanfalseWhen set to true together with width set to null the button fills it’s parent component width
raiseLevelNumber4Button 3D raise level
beforeReactNodenullRenders a custom component before the button content Text
afterReactNodenullRenders a custom component after the button content Text
extraReactNodenullRenders a custom component inside the button content body
springReleaseBooleantrueButton uses elastic spring on the release animation
progressBooleanfalseWhen set to true enables progress animation
progressLoadingTimeNumber3000Number in ms for the maximum progress bar animation time
textColorString#FFFFFFButton default label text color
textLineHeightNumber20Button default label text line height
textSizeNumber16Button default label text font size
textFontFamilyStringnullButton default label text font family
styleStylenullButton container custom styles
onPressFunctionnullButton onPress function. It receives a next argument when the progress prop is set to true
onPressInFunctionnullTriggered with the onPressIn native event
onPressedInFunctionnullTriggered once the press animation has finished
onPressOutFunctionnullTriggered with the onPressOut native event
onPressedOutFunctionnullTriggered once the release animation has finished
onProgressStartFunctionnullTriggered before the progress animation has started
onProgressEndFunctionnullTriggered after the progress animation has finished

Installations

npm install --save react-native-really-awesome-button

Example

import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import Constants from 'expo-constants';
import { ThemedButton } from "react-native-really-awesome-button";

export default function App() {
  const handleProgress = (release) => setTimeout(release, 1000);

  return (
    <View style={styles.container}>
      <View style={styles.section}>
        <>
        <ThemedButton name="rick" type="primary">Rick's Primary Button </ThemedButton>

        <ThemedButton name="rick" type="secondary">Rick's Secondary Button </ThemedButton>
        </>
        </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
  section: {
  },
});

Tutorial

Coming Soon…


Previous Article
Custom Simple Dialog
Next Article
Custom Button 2
Utkarsh Lubal

Utkarsh Lubal

Full Stack Developer

Related Posts

Vertical Step indicator
Vertical Step indicator
May 06, 2023
1 min

Quick Links

Advertise with usAbout UsContact Us

Social Media