{"size": 1008, "ext": "js", "max_stars_repo_path": "src/components/clearall.js", "max_stars_repo_name": "tannercollin/exact-resistor-calculator", "max_stars_repo_stars_event_min_datetime": "2017-02-10T05:56:14.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-24T12:30:02.000Z", "max_issues_repo_path": "src/components/clearall.js", "max_issues_repo_name": "tannercollin/exact-resistor-calculator", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/clearall.js", "max_forks_repo_name": "tannercollin/exact-resistor-calculator", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.3793103448, "max_line_length": 54, "alphanum_fraction": 0.626984127}
import React, {Component} from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {
	Alert,
	StyleSheet,
	View,
	Text,
	TouchableOpacity,
} from 'react-native';

import * as calcActions from '../actions/calcActions';

const styles = {
	clearbutton: {
		height: 30,
		width: 100,
		padding: 10,
		backgroundColor: 'lightgray',
		alignItems: 'center',
		justifyContent: 'center',
		margin: 3,
	},
};

class ClearAll extends Component {
	constructor(props) {
		super(props);
	}

	render() {
		const {actions} = this.props;

		return (
			<TouchableOpacity
				onPress={() => {
					Alert.alert(
						'Clear all resistors?',
						'',
						[
							{text: 'CANCEL'},
							{text: 'OK', onPress: actions.clearall},
						]
					)
				}}
				style={styles.clearbutton} activeOpacity={1}
			>
				<Text>Clear all</Text>
			</TouchableOpacity>
		);
	}
}

export default connect(null, (dispatch) => ({
	actions: bindActionCreators(calcActions, dispatch)
}))(ClearAll);

