import React, { useState } from 'react';
import {View , Text, StyleSheet} from 'react-native';
import { CheckBox } from 'native-base'

export default function BoolEditor(props) {
	let [checked, setChecked] = useState(props.value || false);
	let title = props.title || "Input";
	return (
			<View style={styles.container}>
				<Text style={[styles.title, styles.capFirst]}>{title}</Text>
				<CheckBox checked={checked}
					style={{borderColor: "#36bbad", backgroundColor: checked && "#36bbad"}}
					onPress={() => {
						props.onChange && props.onChange(!checked);
						setChecked(!checked);
					}}/>
			</View>
		);
}

const styles = StyleSheet.create({
	container:{
		flexDirection: 'row',
		justifyContent: 'space-between',
		alignItems: 'baseline'
	},
	capFirst: {
		fontSize: 14, 
		fontFamily: 'roboto-light',
		textTransform: 'capitalize'
	},
	defaultInput: {
		marginTop:6,
		borderWidth:1,
		backgroundColor: 'white',
		boxShadow: '0px 3px 6px #00000029',
		borderColor: '#FFFFFF66',
		borderRadius: 14
	},
	title: {

	}
})
