1.0.4 • Published 4 years ago

react-native-bm-icon-button v1.0.4

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

React native module to add a button icon (with text or not)

Getting started

$ npm install react-native-bm-icon-button --save

Mostly automatic installation

$ react-native link react-native-bm-icon-button

How to use

Start by adding

import BmIconButton from 'react-native-bm-icon-button';

then use like this :

<BmIconButton
  style={styles.menuButtonStyl}
  iconStyle={styles.menuButtonIconStyle}
  textStyle={styles.menuButtonTextStyle}
  text={this.props.module.title}
  icon={require('../icons/myicon.png')}
  action={this.onClick}/>

Properties

PropDefaultTypeDescriptionOptional
stylewidth: 100%style objectChange the default style of the base buttonyes
iconStyle-style objectChange the default style of the icon in the buttonyes
textStyle-style objectChange the default style of the text in the buttonyes
text-stringAdd a text under the icon button ( can be restyle )yes
icon-icon like require('../myicon.png') or variable contain itAdd the icon to the buttonyes
action-functionadd a callback function to the buttonyes

By default all the properties are optional but if you want to use see it I propose to add at least one of these properties : style, text, icon

Tips

By default the background take the full width of the screen BUT if you want to crop it to the size of the icon add the style propertie with following lines :

left: 0,
right: 0,
alignSelf:'center'

Enjoy :)