react-native-date-picker
Advanced tools
Comparing version 4.2.3 to 4.2.4
{ | ||
"name": "react-native-date-picker", | ||
"version": "4.2.3", | ||
"version": "4.2.4", | ||
"description": "A datetime picker for React Native. In-modal or inlined. Supports Android and iOS.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
import React from 'react' | ||
import { Platform } from 'react-native' | ||
import { Platform, Appearance } from 'react-native' | ||
import DatePickerIOS from './DatePickerIOS' | ||
@@ -22,3 +22,4 @@ import DatePickerAndroid from './DatePickerAndroid' | ||
{...props} | ||
textColor={colorToHex(props.textColor)} | ||
textColor={colorToHex(getTextColor(props))} | ||
theme={getTheme(props)} | ||
fadeToColor={colorToHex(props.fadeToColor)} | ||
@@ -35,2 +36,15 @@ title={getTitle(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) => { | ||
@@ -37,0 +51,0 @@ const { modal, androidVariant } = props |
182396
605