diff --git a/README.md b/README.md index 14a51f2..a612914 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/src/Context/index.tsx b/src/Context/index.tsx index d79021a..bec6455 100644 --- a/src/Context/index.tsx +++ b/src/Context/index.tsx @@ -11,6 +11,7 @@ type ToastContextType = { position?: 'TOP' | 'BOTTOM' offset?: number maxToasts?: number + zIndex?: number } export const ToastContext = React.createContext({ @@ -44,7 +45,8 @@ const ToastProvider: React.FC> = ({ children, position, offset: offsetProp, - maxToasts + maxToasts, + zIndex = 1 }) => { const [toasts, setToasts] = React.useState([]) @@ -78,6 +80,7 @@ const ToastProvider: React.FC> = ({ {children}