1.0.0 • Published 9 years ago

react-native-icon-button v1.0.0

Weekly downloads
30
License
MIT
Repository
github
Last release
9 years ago

react-native-icon-button

A simple button component allowing you to create customisable and visually appealing buttons, utilising images, text or a combination of both depending on the desired result.

Demo

Installation

To install simply enter the following...

$ npm install react-native-icon-button

Then require it in your project wherever you need it...

var Button = require('react-native-icon-button');

Properties

PropTypeOpt/RequiredDefaultNote
iconImageOptionalN/AThe image resource (must be required directly).
iconSizeNumberOptionalN/AScales the icon / image to the specified size.
textStringOptionalN/AThe text that will be displayed on the button.
onPressFunctionRequiredN/AA function that will be called when the accordion is pressed.
underlayColorStringOptionaltransparentThe underlay color of the TouchableHighlight.
styleObjectOptional(See Example)Custom button styling, colors, border radius etc...

Example

  
var Button = require('react-native-icon-button');

var testing = React.createClass({

  action: function() {
    //Do stuff! :)
  },
  
  render: function() {
    return (
      <View style={styles.container}>
        <Button 
          style={styles.button}
          onPress={this.action}
          icon={require('image!my_icon')}
          iconSize={20}
          color={"white"}
          text={"Press me!"}
        />
      </View>
    );
  }
  
});

var styles = StyleSheet.create({

  button: {
  	padding: 10,
  	borderRadius: 5,
  	backgroundColor: '#272822',
  	color: 'white'
  }
  
});