import * as React from "react"; import {Text, View, ViewStyle} from "react-native"; import Ripple from 'react-native-material-ripple'; import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons' import {MaterialProgress, MaterialHorizontalLinear} from "../.."; import {PureComponent} from "react"; export interface MaterialCheckboxProps { text?: string, isChecked?: boolean, textFont?: string, onCheckedChange?(isChecked: boolean): void, checkBoxColor?: string, textColor?: string, rtl?: boolean, progress?: boolean, style?: ViewStyle } export interface MaterialCheckboxState { isChecked?: boolean, } export default class MaterialCheckbox extends PureComponent { static defaultProps={ onCheckedChange:()=>{}, checkBoxColor:'purple' }; constructor(props) { super(props); this.state = { isChecked: props.isChecked } } render() { return ( !this.props.rtl ? {!this.props.progress ? { this.setState({isChecked: !this.state.isChecked}, () => { this.props.onCheckedChange(this.state.isChecked); }) }} style={{ borderRadius: 4, height: 36, overflow: 'hidden', alignItems: 'center', justifyContent: 'center' }}> : } {this.props.text} : {this.props.text} {!this.props.progress ? { this.setState({isChecked: !this.state.isChecked}, () => { this.props.onCheckedChange(this.state.isChecked); }) }} style={{ borderRadius: 4, height: 36, overflow: 'hidden', alignItems: 'center', justifyContent: 'center' }}> : } ) } }