|
@ -18,8 +18,11 @@ const defaultWidth = 310 |
|
|
class DatePickerAndroid extends React.PureComponent { |
|
|
class DatePickerAndroid extends React.PureComponent { |
|
|
render() { |
|
|
render() { |
|
|
const props = this.getProps() |
|
|
const props = this.getProps() |
|
|
|
|
|
const isClosed = this._isCurrentlyClosed(); |
|
|
|
|
|
|
|
|
|
|
|
this.previousProps = props; |
|
|
if (props.modal) { |
|
|
if (props.modal) { |
|
|
if (props.open) { |
|
|
|
|
|
|
|
|
if (props.open && isClosed) { |
|
|
NativeModules.RNDatePicker.openPicker( |
|
|
NativeModules.RNDatePicker.openPicker( |
|
|
props, |
|
|
props, |
|
|
this._onConfirm, |
|
|
this._onConfirm, |
|
@ -32,6 +35,8 @@ class DatePickerAndroid extends React.PureComponent { |
|
|
return <NativeDatePicker {...props} onChange={this._onChange} /> |
|
|
return <NativeDatePicker {...props} onChange={this._onChange} /> |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_isCurrentlyClosed = () => !this.previousProps || !this.previousProps.open |
|
|
|
|
|
|
|
|
getProps = () => ({ |
|
|
getProps = () => ({ |
|
|
...this.props, |
|
|
...this.props, |
|
|
date: this._date(), |
|
|
date: this._date(), |
|
|