import React, { Component } from 'react'; import { View, TouchableOpacity } from 'react-native'; import Text from '../../components/Text'; import DateTimePicker from "react-native-modal-datetime-picker"; import Icon from 'src/components/Icon' import { Appearance } from 'react-native-appearance'; import { t } from '../../utils/i18n' const colorScheme = Appearance.getColorScheme(); export default class CustomDatePicker extends Component { constructor(props) { super(props); this.state = { isDateTimePickerVisible: false, select_date: new Date(), maxDate: this.props.maxDate == null && undefined, minDate: this.props.minDate == null && undefined, isDarkModeEnabled: colorScheme === 'dark' }; } showDateTimePicker = () => { this.setState({ isDateTimePickerVisible: true }); }; hideDateTimePicker = () => { this.setState({ isDateTimePickerVisible: false }); }; handleDatePicked = date => { // console.log("A date has been picked: ", date); this.hideDateTimePicker(); this.setState({select_date:date}) return this.props.handleDate(date) }; render() { return ( {this.props.titleText} {this.props.dateText == null || this.props.dateText == undefined ? t('select_date') : this.props.dateText} ); } }