2.1.1 • Published 3 years ago

react-native-ui-buttons v2.1.1

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

React Native UI Button

✨ Installation

If you want to use icons make sure you have react-native-vector-icon installed in your project.

npm install --save react-native-ui-buttons

⚙️ Getting started

🚀 Solid Button

import {ButtonSolid} from 'react-native-ui-buttons';

<ButtonSolid
    title={'Button Solid'}
/>

🚀 Dual Tone Outline Button

import {ButtonOutline} from 'react-native-ui-buttons';

<ButtonOutline
    title={'Button Outline'}
/>

💡 Props

  1. All TouchableOpacityProps are valid.
  2. All props are optional.

🎨 Props to customize container styles

AttributesTypeDescriptionDefault
titlestringName of the button-
useColorstringrgb() format required'rgb(235, 52, 122)'
styleViewStylestyle will be applied to button container-

🎨 Props to customize container styles (utils)

AttributesTypeDescriptionDefault
opacityReducernumberButtonSolid: amount by which opacity of disabled button should be reduced, ButtonOutline: ammount by which background of button should be reducedButtonSolid 5, ButtonOutline 3
paddingnumberpadding of buttonButtonOutline 18, ButtonSolid 19
borderRadiusnumberBorder Radius of button4
noDisabledStylebooleanif true disabled button will be styled same as enabled buttonfalse

🎨 Props to customize text styles

AttributesTypeDescriptionDefault
textStyleTextStylestyle will be applied to text-
textOpacityReducernumber(ButtonOutline only) amount by which opacity of text should be reduced, when button is disabled5
textColorstring(ButtonSolid only) color of textrgb(255,255,255)

🎨 Props to manage state of button

AttributesTypeDescriptionDefault
disabledbooleanset it to true when button is disabledfalse
buttonLoadingbooleanset it to true when button is loadingfalse

🎨 Props for Icon

AttributesTypeDescriptionDefault
materialIconRightstringname field for MaterialIcon component-
materialIconLeftstringname field for MaterialIcon component-
iconColorstringColor of iconButtonOutline useColor, ButtonSolid rgb(255,255,255)
iconSizenumberSize of icon18

📦 react-native-vector-icons Installation

  1. Install package
npm install --save react-native-vector-icons

IOS

  1. In your Info.plist add
<key>UIAppFonts</key>
<array>
    <string>MaterialIcons.ttf</string>
</array>
  1. Install pods and reinstall app
npx pod-install
npx react-native run-ios

Android

  1. In your android/app/build.gradle add
project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf' ]
]

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
  1. Reinstall app
npx react-native run-ios