NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

useColorMode doesn't update after ColorMode change

Open Rutger opened this issue 3 years ago • 1 comments

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

Rutger avatar Aug 09 '22 13:08 Rutger

Hi @Rutger, Can you please share a snack link?

Viraj-10 avatar Aug 09 '22 13:08 Viraj-10

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.

Rutger avatar Aug 22 '22 14:08 Rutger

Hey @Rutger, Thanks for reporting the issue. This issue is fixed in 3.4.14.

ankit-tailor avatar Sep 09 '22 08:09 ankit-tailor