0.1.0 • Published 9 years ago

react-native-touchable-icons v0.1.0

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

React Native TouchableIcon Component

Simple touchable icons acting as buttons.

Installation

npm install react-native-touchable-icons

Install and setup react-native-icons package

Properties

name={'ion|ios-chatbubble'} // Set the icon (name from react-native-icons package)
color={'#000'} // Set the icon color
size={30} // Set the icon dimensions (width == height)
style={{ flex: 1 }} // Set custom style to the component
onPress={function} // Set a custom function to be triggered on button press

Usage Example

'use strict';

var TouchableIcon = require('react-native-touchable-icon');

//...

_onPress: function() {
  alert('pressed');
},

render: function() {
  return (
    <View>
      <TouchableIcon
        name={'ion|ios-chatbubble'}
        size={30}
        color={'#fff'}
        style={{position: 'absolute', left: 10, top: 30}}
        onPress={()=>{this._onPress()}}
      />
      <TouchableIcon
        name={'ion|ios-gear'}
        size={30}
        color={'#fff'}
        style={{position: 'absolute', right: 10, top: 30}}
        onPress={()=>{this._onPress()}}
      />
    </View>
  );
};