11import React from 'react'
2- import { Platform } from 'react-native'
2+ import { Platform , Appearance } from 'react-native'
33import DatePickerIOS from './DatePickerIOS'
44import DatePickerAndroid from './DatePickerAndroid'
55import propTypes from './propTypes'
@@ -19,7 +19,8 @@ const DatePickerWrapper = (props) => {
1919 < DatePicker
2020 ref = { props . innerRef }
2121 { ...props }
22- textColor = { colorToHex ( props . textColor ) }
22+ textColor = { colorToHex ( getTextColor ( props ) ) }
23+ theme = { getTheme ( props ) }
2324 fadeToColor = { colorToHex ( props . fadeToColor ) }
2425 title = { getTitle ( props ) }
2526 confirmText = { props . confirmText ? props . confirmText : 'Confirm' }
@@ -31,6 +32,19 @@ const DatePickerWrapper = (props) => {
3132 )
3233}
3334
35+ const getTheme = ( props ) => {
36+ if ( props . theme ) return props . theme
37+ if ( ! Appearance ) return 'auto'
38+ return Appearance . getColorScheme ( )
39+ }
40+
41+ const getTextColor = ( props ) => {
42+ if ( props . textColor ) return props . textColor
43+ const darkTheme = getTheme ( props ) === 'dark'
44+ if ( darkTheme ) return 'white'
45+ return undefined
46+ }
47+
3448const getAndroidVariant = ( props ) => {
3549 const { modal, androidVariant } = props
3650 if ( androidVariant ) return androidVariant
0 commit comments