GeekyAnts / GeekyAnts/NativeBase

Why does toast.isActive() only take effect when placement is set to bottom

Open
#5,790 0 comments 0 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

set placement to top is not usefull

### CodeSandbox/Snack link

no link

### Steps to reproduce

![image](https://github.com/GeekyAnts/NativeBase/assets/51481364/082ecb99-5578-4702-94af-34b993803920)
{"bottom": [], "top": [{"component": , "config": [Object], "id": "498416516"}, {"component": , "config": [Object], "id": "498416516"}]}
const isActive = React.useCallback(
(id: any) => {
console.log(toastInfo);
for (const toastPosition of Object.keys(toastInfo)) {
const positionArray: Array = toastInfo[toastPosition];
console.log("positionArray",positionArray) // [],because "bottom": [], so toast.isActive()==>false
return positionArray.findIndex((toastData) => toastData.id === id) > -1;
}
return false;
},
[toastInfo]
);

### NativeBase Version

3.4.25

### Platform

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

### Other Platform

_No response_

### Additional Information

_No response_

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.