Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/APSL/react-native-button

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/APSL/react-native-button

  • v3.1.1+incompatible
  • Source
  • Go
  • Socket score

Version published
Created
Source

apsl-react-native-button

A React Native button component customizable via style props.

Button component screenshot Android Button component screenshot

Renders a TouchableOpacity under iOS and a TouchableNativeFeedback under Android.

Install

apsl-react-native-button>=2.6.0 needs React Native 0.28 or higher. apsl-react-native-button>=2.5.0 needs React Native 0.25 or higher. apsl-react-native-button<=2.4.2 needs React Native 0.16 or higher.

Install the package:

$ npm i apsl-react-native-button --save

Import the Button component:

import Button from 'apsl-react-native-button'

Usage

Provide TouchableWithoutFeedback' props to the component (including style), textStyle's StyleSheet to customize the inner text and a children node to render. You can also provide the isLoading prop that will dim the button and disable it to prevent accidental taps.

<Button style={{backgroundColor: 'red'}} textStyle={{fontSize: 18}}>
  Hello!
</Button>

You can also provide a <Button> element with nested children that are not strings or <Text> elements as long as they are valid React elements or numbers. This helps if your project is using another library that provides easy icon integration utilizing the <i> tag, for instance, as well as various other cases where you are creating visually complex buttons. You may omit the textStyle property and apply your own styles to your child elements as you see fit. Multiple children are allowed.

<Button style={{backgroundColor: 'blue'}}>
  <View style={styles.nestedViewStyle}>
    <Text style={styles.nestedTextStyle}>Nested views!</Text>
  </View>
</Button>

API

PropTypeDescription
onPressfuncFunction to execute when the onPress event is triggered.
onPressInfuncFunction to execute when the onPressIn event is triggered.
onPressOutfuncFunction to execute when the onPressOut event is triggered.
onLongPressfuncFunction to execute when the onLongPress event is triggered.
textStyleTextStylePropTypesThe StyleSheet to apply to the inner button text.
disabledStyleTextStylePropTypesThe StyleSheet to apply when disabled.
childrenstring, number, React.Element,or arrayThe child nodes to render inside the button. If child is string or number, it will be rendered inside of a <Text> element with textStyle applied if present. Multiple children are allowed (array).
isLoadingboolRenders an inactive state dimmed button with a spinner if true.
isDisabledboolRenders an inactive state dimmed button if true.
activeOpacityNumberThe button onpressing transparency (Usually with a point value between 0 and 1).
activityIndicatorColorstringSets the button of the ActivityIndicatorIOS or ProgressBarAndroid in the loading state.
backgroundTouchableNativeFeedback.propTypes.backgroundAndroid only. The background prop of TouchableNativeFeedback.
Check the included example for more options.

Similar projects

James Ide's react-native-button https://github.com/ide/react-native-button/

License

MIT.

FAQs

Package last updated on 24 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc