NativeBase
NativeBase copied to clipboard
useColorMode doesn't update after ColorMode change
Description
useColorMode doesn't update after ColorMode change
Steps to reproduce
Since this commit, useColorMode stopped worked as intended: https://github.com/GeekyAnts/NativeBase/pull/5246/commits/940e19ec7fe4377ebf4c554db79847085185a9d8
This is because useColorScheme hook got replaced by a getter function, which doesn't rerender after a change.
NativeBase Version
3.4.11
Platform
- [ ] Android
- [ ] CRA
- [ ] Expo
- [X] iOS
- [ ] Next
Other Platform
No response
Additional Information
No response
Hi @Rutger, Can you please share a snack link?
Hi @Rutger, Can you please share a snack link?
Yes, sure! Here you go: https://snack.expo.dev/@rutgerschimmel/nativebase-template
Try switching darkmode / lightmode from the iOS control panel. The app will not update anymore, even though useSystemColorMode is set to true.
As described earlier, this is because useColorScheme hook got replaced in https://github.com/GeekyAnts/NativeBase/commit/940e19ec7fe4377ebf4c554db79847085185a9d8 by a getter function, which doesn't rerender after a change.
Not that I've set the NB version to 3.4.11. After changing this to 3.4.9, everything works as intended.
Hey @Rutger, Thanks for reporting the issue. This issue is fixed in 3.4.14.