File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,11 @@ const defaultWidth = 310
18
18
class DatePickerAndroid extends React . PureComponent {
19
19
render ( ) {
20
20
const props = this . getProps ( )
21
+ const isClosed = this . _isCurrentlyClosed ( ) ;
22
+
23
+ this . previousProps = props ;
21
24
if ( props . modal ) {
22
- if ( props . open ) {
25
+ if ( props . open && isClosed ) {
23
26
NativeModules . RNDatePicker . openPicker (
24
27
props ,
25
28
this . _onConfirm ,
@@ -32,6 +35,8 @@ class DatePickerAndroid extends React.PureComponent {
32
35
return < NativeDatePicker { ...props } onChange = { this . _onChange } />
33
36
}
34
37
38
+ _isCurrentlyClosed = ( ) => ! this . previousProps || ! this . previousProps . open
39
+
35
40
getProps = ( ) => ( {
36
41
...this . props ,
37
42
date : this . _date ( ) ,
Original file line number Diff line number Diff line change @@ -45,9 +45,11 @@ export default class DatePickerIOS extends React.Component {
45
45
46
46
render ( ) {
47
47
const props = this . _toIosProps ( this . props )
48
+ const isClosed = this . _isCurrentlyClosed ( ) ;
48
49
50
+ this . previousProps = props ;
49
51
if ( props . modal ) {
50
- if ( props . open ) {
52
+ if ( props . open && isClosed ) {
51
53
NativeModules . RNDatePickerManager . openPicker (
52
54
props ,
53
55
this . _onConfirm ,
@@ -70,6 +72,8 @@ export default class DatePickerIOS extends React.Component {
70
72
/>
71
73
)
72
74
}
75
+
76
+ _isCurrentlyClosed = ( ) => ! this . previousProps || ! this . previousProps . open
73
77
}
74
78
75
79
const styles = StyleSheet . create ( {
You can’t perform that action at this time.
0 commit comments