Skip to content

Commit

Permalink
Fix default button color on Android when in dark mode, allow buttonCo…
Browse files Browse the repository at this point in the history
…lor to take non-hex values
  • Loading branch information
thunderweasel authored Dec 13, 2024
1 parent 7891b6f commit bf0532f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const DatePickerWrapper = (props) => {
{...props}
textColor={colorToHex(getTextColor(props))}
dividerColor={colorToHex(getDividerColor(props))}
buttonColor={colorToHex(getButtonColor(props))}
theme={getTheme(props)}
title={getTitle(props)}
confirmText={props.confirmText ? props.confirmText : 'Confirm'}
Expand Down Expand Up @@ -60,6 +61,15 @@ const getTextColor = (props) => {
return undefined
}

/** @param {Props} props **/
const getButtonColor = (props) => {
if (props.buttonColor) return props.buttonColor
const theme = getTheme(props)
if (theme === 'dark') return 'white'
if (theme === 'light') return 'black'
return undefined
}

/** @param {Props} props **/
const getTitle = (props) => {
const { title, mode } = props
Expand Down

0 comments on commit bf0532f

Please sign in to comment.