import React, { Component } from 'react' import { View } from 'react-native' import { DatePicker, List } from '@sishuguojixuefu/antd-mobile-rn' import { SsDateRangeProps } from '../utils/PropTypes' import ErrorTip from './helper/ErrorTip' import getFieldDecorator from '../utils/getFieldDecorator' import Label from './helper/Label' export default class SsDateRange extends Component { private startFieldDecorator: any private endFieldDecorator: any private startDate: Date = new Date() private endDate: Date = new Date() componentWillMount() { const { form, id, initialValue, rules } = this.props this.startFieldDecorator = getFieldDecorator(form, id[0], initialValue![0], rules) this.endFieldDecorator = getFieldDecorator(form, id[1], initialValue![1], rules) } private _onChangeStartDate = (value: Date) => { const { onChange } = this.props this.startDate = value onChange && onChange([value, this.endDate]) } private _onChangeEndDate = (value: Date) => { const { onChange } = this.props this.endDate = value onChange && onChange([this.startDate, value]) } render() { const { id, label, required, form, placeholder, initialValue } = this.props return ( {this.startFieldDecorator( )} {this.endFieldDecorator( )} ) } }