Using Theme | 3.0.x | NativeBase | Universal Components for React and React Native

Search
K
Hire us
If you are starting a new project, please try gluestack-ui for better performance and new design.
version: 3.0.x
Using Theme
NativeBase provides multiple tools to use the central theme defined in the app. The first tool is , which you can use to access the values from the current theme.
useTheme
Playground
useToken
You can also get specific values from the theme with hook.
Contrast threshold is:
7
Playground
useContrastText
If you are defining the background yourself and pass a contrasting color to the text, then you can use .
NativeBase
NativeBase
Playground
useColorMode
If you want to define some conditionals based on current color mode or change the color mode, then you can try .
The active color mode is light
Toggle
Playground
useColorModeValue
If you do not want to add conditionals for color mode everywhere and keep the code clean, then you can use hook. It takes two parameters, light mode value as the first and dark mode value as second.
The active color mode is Light
Toggle
Playground
Nativebase logo
MadeWithNativeBase
Gluestack logo
gluestack-ui