Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 6 additions & 3 deletions src/Toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type ToastConfig = {
shouldVibrate?: boolean
subMessage?: string
toastStyles?: StyledToastProps
opacity?: number
}

const statusBarHeight = getStatusBarHeight()
Expand Down Expand Up @@ -82,7 +83,8 @@ const DEFAULT_PROPS: ToastConfig = {
bg: 'muted',
borderRadius: 4,
alignItems: 'center'
}
},
opacity: 1
}

export const Toast: React.FC<ToastConfig & ToastInternalConfig> = ({
Expand All @@ -108,7 +110,8 @@ export const Toast: React.FC<ToastConfig & ToastInternalConfig> = ({
subMessage,
toastStyles,
hideAccent,
closeButtonStyles
closeButtonStyles,
opacity
}) => {
const isSuccess = intent === 'SUCCESS'
const isInfo = intent === 'INFO'
Expand Down Expand Up @@ -153,7 +156,7 @@ export const Toast: React.FC<ToastConfig & ToastInternalConfig> = ({
onPress && onPress()
onClose && id && onClose(id)
}}
style={{ transform: [{ translateY }, { scale }], ...shadow }}
style={{ transform: [{ translateY }, { scale }], opacity, ...shadow }}
{...toastStyles}
pr={!!subMessage ? 2 : 0}
>
Expand Down
12 changes: 8 additions & 4 deletions src/Toast/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import {
space,
SpaceProps,
textAlign,
TextAlignProps
TextAlignProps,
opacity,
OpacityProps
} from 'styled-system'

export const systemProps = compose(
Expand All @@ -32,7 +34,8 @@ export const systemProps = compose(
background,
border,
position,
shadow
shadow,
opacity
)

export type StyledToastProps = SpaceProps &
Expand All @@ -45,7 +48,7 @@ export type StyledToastProps = SpaceProps &
ShadowProps & {
elevation?: number
accentColor?: string
}
} & OpacityProps

const AnimatedTouchable = Animated.createAnimatedComponent(TouchableOpacity)

Expand All @@ -64,7 +67,8 @@ StyledToast.defaultProps = {
flexDirection: 'row',
accentColor: 'success',
justifyContent: 'center',
borderColor: 'border'
borderColor: 'border',
opacity: 1
}

export const Accent = styled.View<ColorProps>`
Expand Down