question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] More extensive theming

See original GitHub issue

Is your feature request related to a problem? Please Describe. The current theming method only seems to support some of the component’s theming, and it only seems to support one variant (Please correct me if I’m wrong).

Describe the solution you’d like All the style props should be customizable, with multiple variants:

import { ThemeProvider } from 'react-native-elements';

const base = {
  Button: {
    containerStyle: {
    },
    buttonStyle: {
    },
    etc.
  }
};

const primary = {
  Button: {
    containerStyle: {
    },
    buttonStyle: {
    },
    etc.
  }
};

<ThemeProvider theme={{base, primary}}>

------------
import { Button } from 'react-native-elements';

<Button variant="primary" containerStyle={{ any }} />
Which should produce the concatenated style of Internal > Base > Primary > External, for each customizable styles on the Button component

Describe alternatives you’ve considered Currently I’m using composition to achieve a similar behaviour

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
EricVanDerDijscommented, Dec 8, 2020

@flyingcircle Yes, but it does not take into account that one could use ‘clear’ and ‘solid’ buttons and extend their styles separately, since this logic is coded into the RNE component itself without taking into account that there could be overrides specific for every button type, that is what I’m trying to point out.

2reactions
EricVanDerDijscommented, Dec 8, 2020

Hi! I have been using this library for a couple of weeks and I was surprised that even when the lib offers me 3 different types of buttons, all of them with their own set of styles, I cannot extend the styles globally for the button types that are offered, since when I try to define a theme the styling for the normal buttons I use in the whole app, I end up breaking the styling of the buttons with type ‘clear’ that I use in several other places.

I was looking at the code and this could be fixed by moving the conditional styling (styles.title(type, theme)) used here:

  const titleStyle = StyleSheet.flatten([
      styles.title(type, theme), // --> this would become buttonClearTitleStyle
      passedTitleStyle,
      disabled && styles.disabledTitle(theme),
      disabled && disabledTitleStyle,
    ]);

To a property in the theme object, therefore becoming a default buttonClearTitleStyle, that way we can extend that style and define a custom app styling leveraging the default theme provided by you

By now I have not found a way to do that type of customization other than copying and pasting the styles where I need them

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a Theme-Based Roadmap and Why is it Important?
A theme-based roadmap is organized around the product's most strategic objective—the theme. How do they work? Learn how to get started.
Read more >
46+ exciting features: A Turbo Shopify theme feature overview
Quite simply, Turbo is the fastest and most extensive theme we've ever created. Engineered for speed: Select “Ludicrous” or “Sport” — both are...
Read more >
20+ Best Shopify Themes in 2022: Conversion-Friendly and ...
Check out the 20+ best Shopify themes in 2022. They're conversion-friendly and ready for dropshipping, or anything else you throw at them.
Read more >
Theme support - Shopify Help Center
Shopify Experts are experienced industry professionals who have extensive knowledge about creating, updating, and perfecting Shopify themes. Learn more about ...
Read more >
Creatus WordPress Theme Features - Themezly™
Browse the extensive documentation to find out more about our themes and plugins.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found