text: Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _propTypes=require('prop-types');var _propTypes2=_interopRequireDefault(_propTypes);
  var _react=require('react');var _react2=_interopRequireDefault(_react);
  var _reactNative=require('react-native');
  
  
  
  
  
  
  var _Text=require('../text/Text');var _Text2=_interopRequireDefault(_Text);
  var _fonts=require('../config/fonts');var _fonts2=_interopRequireDefault(_fonts);
  var _colors=require('../config/colors');var _colors2=_interopRequireDefault(_colors);
  var _FontAwesome=require('react-native-vector-icons/FontAwesome');var _FontAwesome2=_interopRequireDefault(_FontAwesome);
  var _getIconType=require('../helpers/getIconType');var _getIconType2=_interopRequireDefault(_getIconType);
  var _ViewPropTypes=require('../config/ViewPropTypes');var _ViewPropTypes2=_interopRequireDefault(_ViewPropTypes);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}
  
  var CheckBox=function CheckBox(props){var
  
  component=
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  props.component,checked=props.checked,iconRight=props.iconRight,title=props.title,center=props.center,right=props.right,containerStyle=props.containerStyle,textStyle=props.textStyle,onPress=props.onPress,onLongPress=props.onLongPress,onIconPress=props.onIconPress,onLongIconPress=props.onLongIconPress,size=props.size,checkedIcon=props.checkedIcon,uncheckedIcon=props.uncheckedIcon,iconType=props.iconType,checkedColor=props.checkedColor,uncheckedColor=props.uncheckedColor,checkedTitle=props.checkedTitle,fontFamily=props.fontFamily,attributes=_objectWithoutProperties(props,['component','checked','iconRight','title','center','right','containerStyle','textStyle','onPress','onLongPress','onIconPress','onLongIconPress','size','checkedIcon','uncheckedIcon','iconType','checkedColor','uncheckedColor','checkedTitle','fontFamily']);
  
  var Icon=_FontAwesome2.default;
  if(iconType){
  Icon=(0,_getIconType2.default)(iconType);
  }
  var Component=component||_reactNative.TouchableOpacity;
  var iconName=uncheckedIcon;
  if(checked){
  iconName=checkedIcon;
  }
  return(
  _react2.default.createElement(Component,_extends({},
  attributes,{
  onLongPress:onLongPress,
  onPress:onPress,
  style:[
  styles.container,
  title&&styles.containerHasTitle,
  containerStyle&&containerStyle]}),
  
  
  _react2.default.createElement(_reactNative.View,{
  style:[
  styles.wrapper,
  right&&{justifyContent:'flex-end'},
  center&&{justifyContent:'center'}]},
  
  
  !iconRight&&
  _react2.default.createElement(Icon,{
  color:checked?checkedColor:uncheckedColor,
  name:iconName,
  size:size||24,
  style:{minWidth:size||24},
  onLongPress:onLongIconPress,
  onPress:onIconPress}),
  
  
  
  _react2.default.isValidElement(title)?
  title:
  title&&
  _react2.default.createElement(_Text2.default,{
  style:[
  styles.text,
  textStyle&&textStyle,
  fontFamily&&{fontFamily:fontFamily}]},
  
  
  checked?checkedTitle||title:title),
  
  
  
  iconRight&&
  _react2.default.createElement(Icon,{
  color:checked?checkedColor:uncheckedColor,
  name:iconName,
  size:size||24,
  style:{minWidth:size||24},
  onLongPress:onLongIconPress,
  onPress:onIconPress}))));
  
  
  
  
  
  };
  
  CheckBox.defaultProps={
  checked:false,
  iconRight:false,
  right:false,
  center:false,
  checkedColor:_colors2.default.primary,
  uncheckedColor:'#bfbfbf',
  checkedIcon:'check-square-o',
  uncheckedIcon:'square-o',
  size:24};
  
  
  CheckBox.propTypes={
  component:_propTypes2.default.any,
  checked:_propTypes2.default.bool,
  iconRight:_propTypes2.default.bool,
  title:_propTypes2.default.oneOfType([_propTypes2.default.string,_propTypes2.default.element]),
  center:_propTypes2.default.bool,
  right:_propTypes2.default.bool,
  containerStyle:_ViewPropTypes2.default.style,
  textStyle:_reactNative.Text.propTypes.style,
  onPress:_propTypes2.default.func,
  onLongPress:_propTypes2.default.func,
  checkedIcon:_propTypes2.default.string,
  uncheckedIcon:_propTypes2.default.string,
  iconType:_propTypes2.default.string,
  size:_propTypes2.default.number,
  checkedColor:_propTypes2.default.string,
  uncheckedColor:_propTypes2.default.string,
  checkedTitle:_propTypes2.default.string,
  onIconPress:_propTypes2.default.func,
  onLongIconPress:_propTypes2.default.func,
  fontFamily:_propTypes2.default.string};
  
  
  var styles=_reactNative.StyleSheet.create({
  wrapper:{
  flexDirection:'row',
  alignItems:'center'},
  
  container:{
  margin:5,
  marginLeft:10,
  marginRight:10,
  padding:10},
  
  containerHasTitle:{
  borderWidth:1,
  borderRadius:3,
  backgroundColor:'#fafafa',
  borderColor:'#ededed'},
  
  text:_extends({
  marginLeft:10,
  marginRight:10,
  color:_colors2.default.grey1},
  _reactNative.Platform.select({
  ios:{
  fontWeight:'bold'},
  
  android:_extends({},
  _fonts2.default.android.bold),
  
  web:{
  fontWeight:'bold'}}))});exports.default=
  
  
  
  
  
  CheckBox;
  //# sourceMappingURL=CheckBox.js.map