var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireWildcard(require("react"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _withTheme=_interopRequireDefault(require("../../Theme/withTheme"));var _Ripple=_interopRequireDefault(require("../Ripple/Ripple"));var _RadioButton=_interopRequireDefault(require("./RadioButton.styles"));var _jsxFileName="/Users/gerard/dev/reciclos/repos/material-bread/src/Components/RadioButton/RadioButton.js";var RadioButton=function(_Component){(0,_inherits2.default)(RadioButton,_Component);function RadioButton(){(0,_classCallCheck2.default)(this,RadioButton);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(RadioButton).apply(this,arguments));}(0,_createClass2.default)(RadioButton,[{key:"_renderLabel",value:function _renderLabel(){var _this$props=this.props,label=_this$props.label,labelStyle=_this$props.labelStyle,onPress=_this$props.onPress;if(!label)return null;return _react.default.createElement(_reactNative.TouchableWithoutFeedback,{onPress:onPress,__source:{fileName:_jsxFileName,lineNumber:35}},_react.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:36}},_react.default.createElement(_reactNative.Text,{style:[_RadioButton.default.label,labelStyle],__source:{fileName:_jsxFileName,lineNumber:37}},label)));}},{key:"render",value:function render(){var _this$props2=this.props,checked=_this$props2.checked,disabled=_this$props2.disabled,onPress=_this$props2.onPress,rippleColor=_this$props2.rippleColor,radioButtonColor=_this$props2.radioButtonColor,uncheckedBorderColor=_this$props2.uncheckedBorderColor,style=_this$props2.style,labelPos=_this$props2.labelPos,error=_this$props2.error,theme=_this$props2.theme,testID=_this$props2.testID;var rippleColorApplied=rippleColor?rippleColor:'rgba(0,0,0,.8)';var radioButtonColorApplied=radioButtonColor?radioButtonColor:'rgba(33, 150, 243, 1)';var uncheckedBorderColorApplied=uncheckedBorderColor?uncheckedBorderColor:'rgba(0,0,0,.5)';if(error){radioButtonColorApplied=theme.error.main;uncheckedBorderColorApplied=theme.error.main;}if(disabled){radioButtonColorApplied='rgba(0,0,0,.5)';}return _react.default.createElement(_reactNative.View,{style:[_RadioButton.default.container,style],testID:testID,__source:{fileName:_jsxFileName,lineNumber:75}},labelPos==='left'?this._renderLabel():null,_react.default.createElement(_Ripple.default,{rippleColor:rippleColorApplied,rippleContainerBorderRadius:18,onPress:onPress,style:[_RadioButton.default.ripple],rippleCentered:true,disabled:disabled,__source:{fileName:_jsxFileName,lineNumber:77}},_react.default.createElement(_reactNative.Animated.View,{useNativeDriver:true,style:[_RadioButton.default.radio,{borderColor:checked?radioButtonColorApplied:uncheckedBorderColorApplied}],__source:{fileName:_jsxFileName,lineNumber:84}},checked?_react.default.createElement(_reactNative.Animated.View,{useNativeDriver:true,style:[_RadioButton.default.radioDot,{backgroundColor:radioButtonColorApplied}],__source:{fileName:_jsxFileName,lineNumber:95}}):null)),labelPos==='right'?this._renderLabel():null);}}]);return RadioButton;}(_react.Component);(0,_defineProperty2.default)(RadioButton,"propTypes",{checked:_propTypes.default.bool,disabled:_propTypes.default.bool,onPress:_propTypes.default.func,rippleColor:_propTypes.default.string,radioButtonColor:_propTypes.default.string,uncheckedBorderColor:_propTypes.default.string,style:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.array]),label:_propTypes.default.string,labelStyle:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.array]),labelPos:_propTypes.default.string,error:_propTypes.default.bool,theme:_propTypes.default.object,testID:_propTypes.default.string});(0,_defineProperty2.default)(RadioButton,"defaultProps",{labelPos:'right'});var _default=(0,_withTheme.default)(RadioButton);exports.default=_default;