diff --git a/src/index.js b/src/index.js index 6bbe0c7..e5a3ed4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ import React from 'react' -import { Platform } from 'react-native' +import { Platform, Appearance } from 'react-native' import DatePickerIOS from './DatePickerIOS' import DatePickerAndroid from './DatePickerAndroid' import propTypes from './propTypes' @@ -19,7 +19,8 @@ const DatePickerWrapper = (props) => { { ) } +const getTheme = (props) => { + if (props.theme) return props.theme + if (!Appearance) return 'auto' + return Appearance.getColorScheme() +} + +const getTextColor = (props) => { + if (props.textColor) return props.textColor + const darkTheme = getTheme(props) === 'dark' + if (darkTheme) return 'white' + return undefined +} + const getAndroidVariant = (props) => { const { modal, androidVariant } = props if (androidVariant) return androidVariant