gluestack-ui
gluestack-ui copied to clipboard
I cannot update Badge action by state
Description
I cannot update Badge action by state
CodeSandbox/Snack link
below
Steps to reproduce
const [isMuted, setIsMuted] = useState(false);
useEffect(() => {
setTimeout(() => setMuted(prev => !prev), 1000);
}, [])
return (
<Badge action={isMuted ? 'muted' : 'info'}>
<BadgeText>test badge</Badge>
</Badge>
)
gluestack-ui Version
1.1.39
Platform
- [ ] Expo
- [ ] React Native CLI
- [ ] Next
- [ ] Web
- [X] Android
- [X] iOS
Other Platform
No response
Additional Information
No response
Had the same issue trying to use state for updates. A workaround is to set a key prop that changes with state - forces a new component render.