GeekyAnts / GeekyAnts/NativeBase
Toast is placed out of position every time I call this.
- 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

- 2nd times

- 3rd times

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

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
Assessment
This issue has not been assessed yet.