React Native Restyle by shopify

554 Views Asked by At

Is there a way to access colours outside of components? It appears that any access to the styles is through hooks. I am using react-native-snackbar that accepts colours but runs through my middle ware so doesn't have any access to a component.

1

There are 1 best solutions below

2
A G On

You can import theme.

import theme from './theme';
const { colors } = theme;

The theme object is created as -

export const theme = createTheme({ ... })