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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Because of the theming capability of `react-native-styled-toast`, it has out of
| **`maxToasts`** | number | no | Sets max number of toasts to show | Constants.statusBarHeight |
| **`offset`** | number | no | Increases default offset from the top / bottom | Constants.statusBarHeight |
| **`position`** | enum | no | Sets the position of the toasts | TOP |
| **`zIndex`** | number | no | Sets the zIndex of the toasts | 1 |

### `ToastConfig`

Expand Down
5 changes: 4 additions & 1 deletion src/Context/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type ToastContextType = {
position?: 'TOP' | 'BOTTOM'
offset?: number
maxToasts?: number
zIndex?: number
}

export const ToastContext = React.createContext<ToastContextType>({
Expand Down Expand Up @@ -44,7 +45,8 @@ const ToastProvider: React.FC<Omit<ToastContextType, 'toast'>> = ({
children,
position,
offset: offsetProp,
maxToasts
maxToasts,
zIndex = 1
}) => {
const [toasts, setToasts] = React.useState<FullToastConfig[]>([])

Expand Down Expand Up @@ -78,6 +80,7 @@ const ToastProvider: React.FC<Omit<ToastContextType, 'toast'>> = ({
<ToastContext.Provider value={{ toast }}>
{children}
<Box
zIndex={zIndex}
px={4}
left={0}
right={0}
Expand Down