GeekyAnts / GeekyAnts/NativeBase

Toast is placed out of position every time I call this.

Open
#5,107 22 comments 10 reactions 0 assignees View on GitHub
bug triage v3
Dominant language
TypeScript
Stars
20.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

### Description

Toast is placed out of position every time I call this.

### CodeSandbox/Snack link

I am sorry. I don't have it.

### Steps to reproduce

1. Create custom `Toast` like below.
```
export const useCustomToastHook = () => {
const toast = useToast()
const id = 'result'

const showToast = ({ variant, message }: ShowToastProps) => {
const styleMap: StyleMapObj = {
fontColor: '',
backgroundColor: '',
}

if (variant === 'error') {
styleMap.fontColor = 'Accent.Normal'
styleMap.backgroundColor = 'Accent.Light'
} else if (variant === 'success') {
styleMap.fontColor = 'Main.Normal'
styleMap.backgroundColor = 'Main.Light'
}

if (!toast.isActive(id)) {
toast.show({
placement: 'top',
render: () => (

{message}

),
})
}
}

```
2. Use `toast.show`, in my case, `showToast()` method.
3. After checking `Toast` disappears, use `toast.show` again.
4. You can see `Toast` is placed under the position where the `Toast` which was called in Step2, is set

### NativeBase Version

3.3.11

### Platform

- [ ] Android
- [ ] CRA
- [X] Expo
- [X] iOS
- [ ] Next

### Other Platform

_No response_

### Additional Information

Hello.
I am facing an error which is Toast is placed out of position.
Let's say I use Toast multiple times while I use an app.
A toast is placed on the right position at the first time. However, if I call that again, this is placed under the position where the previous Toast is set and this behavior is repeated every time I call Toast.

- 1st time
![IMG_4576 Medium](https://user-images.githubusercontent.com/65416932/175811545-a521df84-3b95-491a-ab4c-3ff403e14c9f.png)

- 2nd times
![IMG_4577 Medium](https://user-images.githubusercontent.com/65416932/175811592-944b9aa0-ca6b-4c1f-9ab0-c810d7bd8f45.png)

- 3rd times
![IMG_4578 Medium](https://user-images.githubusercontent.com/65416932/175811603-a3eb953b-8fa7-426a-b423-ca0403d331fb.png)

After a toast disappears, it still leaves on the screen according to React Native Debugger like that image.
components_debugger

I couldn't find solutions in issues and Discord. If it is not a bug, I would like you to tell me some solution.
Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.