From 1b4fbd2d8eb031f31604046627e880077f52ae98 Mon Sep 17 00:00:00 2001 From: Nikhil Srivastava Date: Thu, 18 Apr 2019 13:25:53 +0530 Subject: [PATCH] Add: Button component :heavy_plus_sign: --- src/Button/index.android.js | 32 ++++++++++++++++++++++++++++++++ src/Button/index.ios.js | 32 ++++++++++++++++++++++++++++++++ src/Button/index.js | 28 ++++++++++++++++++---------- 3 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 src/Button/index.android.js create mode 100644 src/Button/index.ios.js diff --git a/src/Button/index.android.js b/src/Button/index.android.js new file mode 100644 index 0000000..359e0be --- /dev/null +++ b/src/Button/index.android.js @@ -0,0 +1,32 @@ +import React from 'react'; +import {TouchableOpacity, View } from 'react-native'; +import PropTypes from 'prop-types'; + +export default class CButton extends React.Component { + render() { + const {style,activeOpacity, ...passThroughProps} = this.props; + return ( + + + {this.props.children} + + + ) + } +} + +CButton.propTypes = { + /** + * Callback to be invoked when the button is pressed + */ + onPress: PropTypes.func.isRequired, + /** + * Boolean value to disable or enable button + */ + disabled: PropTypes.bool, + /** + * Style of the Button + */ + style:PropTypes.object +}; diff --git a/src/Button/index.ios.js b/src/Button/index.ios.js new file mode 100644 index 0000000..359e0be --- /dev/null +++ b/src/Button/index.ios.js @@ -0,0 +1,32 @@ +import React from 'react'; +import {TouchableOpacity, View } from 'react-native'; +import PropTypes from 'prop-types'; + +export default class CButton extends React.Component { + render() { + const {style,activeOpacity, ...passThroughProps} = this.props; + return ( + + + {this.props.children} + + + ) + } +} + +CButton.propTypes = { + /** + * Callback to be invoked when the button is pressed + */ + onPress: PropTypes.func.isRequired, + /** + * Boolean value to disable or enable button + */ + disabled: PropTypes.bool, + /** + * Style of the Button + */ + style:PropTypes.object +}; diff --git a/src/Button/index.js b/src/Button/index.js index 2f07385..6e87fcf 100644 --- a/src/Button/index.js +++ b/src/Button/index.js @@ -1,24 +1,32 @@ import React from 'react'; -import { Button, View } from 'react-native'; +import {TouchableOpacity, View } from 'react-native'; import PropTypes from 'prop-types'; export default class CButton extends React.Component { render() { - const {style, ...passThroughProps} = this.props; - const {color, ...passThroughStyles} = style || {}; + const {style,activeOpacity, ...passThroughProps} = this.props; return ( - -