GeekyAnts / NativeBase

Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web.
https://nativebase.io/
MIT License
20.21k stars 2.39k forks source link

extendTheme for dark mode Text color not working #4603

Closed Gabsys closed 2 years ago

Gabsys commented 2 years ago

Description

using extendTheme to cater for dark mode Text color doesn't work.

CodeSandbox/Snack link

N/A. Need to use real device / simulator to toogle the dark mode

Steps to reproduce

  1. extendTheme on App.js and include it in <NativeBaseProvider>. Example code as below:
    
    const theme = extendTheme({
    components: {
    Text: {
      baseStyle: props => {
        return {
          color: themeTools.mode('black', 'white')(props),
        }
      },
    },
    },
    })

return (

)


2. Put `Text` component in any screen
3. Try to switch between dark & light mode on your device
4. You will see the Text color always remain at themeTools.mode's first argument's color (In this example, it is black)

### NativeBase Version

3.2.1

### Platform

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

### Other Platform

_No response_

### Additional Information

_No response_
mayank-96 commented 2 years ago

Hello @Gabsys, I tried reproducing your issue but it is working fine in my case. You can check the snack link.

Gabsys commented 2 years ago

Hello @Gabsys, I tried reproducing your issue but it is working fine in my case. You can check the snack link.

Hi, I tried using toggleColorMode, it does work fine. But using Dark Mode from phone settings itself doesn't have the same effect

Gabsys commented 2 years ago

My bad, it worked after I added:

config: {
    useSystemColorMode: true
}

to extendTheme. I thought it was by default true