Skip to content

How to use variables for a dynamic theme? #7

@Talor-A

Description

@Talor-A

hi, using this example in the readme,

import theme from 'react-native-theme';

theme.add({ // Add default theme
  container: {
    flex: 1,
    flexDirection: 'row'
  },
  title: {
    fontSize: 20,
  },
  ...
});

theme.add({ // Add red theme
  title: {
    fontSize: 20,
    color: 'red',
  },
  ...
}, 'red');

is there a way to make the theme more configurable by doing something like this:

theme.add({ // Add multicolor theme
  title: {
    fontSize: 20,
    color: variables.primaryColor,
  },
  ...
}, 'color');

this, for example would let me use one theme but switch i.e. primaryColor to be white or black to have light/dark themes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions