Skip to content

Commit dffff46

Browse files
DateTimePicker - Implement theme variant prop (#1357)
1 parent b7735b0 commit dffff46

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/components/dateTimePicker/index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ const MODES = {
1919
TIME: 'time'
2020
};
2121

22+
23+
const THEME_VARIANTS = {
24+
LIGHT: 'light',
25+
DARK: 'dark'
26+
};
27+
28+
2229
/*eslint-disable*/
2330
/**
2431
* @description: Date and Time Picker Component that wraps RNDateTimePicker for date and time modes.
@@ -98,7 +105,11 @@ class DateTimePicker extends Component {
98105
/**
99106
* Render custom input
100107
*/
101-
renderInput: PropTypes.elementType
108+
renderInput: PropTypes.elementType,
109+
/**
110+
* Override system theme variant (dark or light mode) used by the date picker.
111+
*/
112+
themeVariant: PropTypes.oneOf(Object.values(THEME_VARIANTS))
102113
};
103114

104115
static defaultProps = {
@@ -236,7 +247,7 @@ class DateTimePicker extends Component {
236247
}
237248

238249
const {value, showExpandableOverlay} = this.state;
239-
const {mode, minimumDate, maximumDate, locale, is24Hour, minuteInterval, timeZoneOffsetInMinutes} = this.props;
250+
const {mode, minimumDate, maximumDate, locale, is24Hour, minuteInterval, timeZoneOffsetInMinutes, themeVariant} = this.props;
240251

241252
if (showExpandableOverlay) {
242253
return (
@@ -251,6 +262,7 @@ class DateTimePicker extends Component {
251262
minuteInterval={minuteInterval}
252263
timeZoneOffsetInMinutes={timeZoneOffsetInMinutes}
253264
display={Constants.isIOS ? 'spinner' : undefined}
265+
themeVariant={themeVariant}
254266
/>
255267
);
256268
}

0 commit comments

Comments
 (0)