Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow custom shadow in ToastConfig #85

Merged
merged 2 commits into from
Feb 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/Toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ export type ToastConfig = {
hideCloseIcon?: boolean
iconSize?: number
allowFontScaling?: boolean
shadow?: {
shadowColor?: string
shadowOffset?: {
width: number
height: number
}
shadowOpacity?: number
shadowRadius?: number
elevation?: number
}
}

const statusBarHeight = getStatusBarHeight()
Expand All @@ -59,7 +69,7 @@ export type ToastInternalConfig = {

const offset = statusBarHeight + 16

const shadow = {
const shadowDefault = {
shadowColor: '#000',
shadowOffset: {
width: 0,
Expand Down Expand Up @@ -125,7 +135,8 @@ export const Toast: React.FC<ToastConfig & ToastInternalConfig> = ({
closeButtonStyles,
hideCloseIcon,
iconSize,
allowFontScaling
allowFontScaling,
shadow = shadowDefault
}) => {
const isSuccess = intent === 'SUCCESS'
const isInfo = intent === 'INFO'
Expand Down