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.

Create text variant defaults is not working.

See original GitHub issue

Restyle components do not use the default styles unless you specify itvariant="defaults" in the props.

My component looks like:


import {
  createRestyleComponent,
  createText,
  createVariant,
  color,
  spacing,
  typography,
  layout,
  createBox,
} from '@shopify/restyle';

export const Link = createRestyleComponent(
  [
    color,
    spacing,
    typography,
    layout,
    createVariant({themeKey: 'linkVariants'}),
  ],
  createText(),
);

The theme object variant looks like: Screen Shot 2022-05-05 at 3 39 40 PM

Video showing the variant only working when I set variant="defaults"

https://user-images.githubusercontent.com/18203585/167021839-d6354be8-d115-45bd-97b5-bad0ebebf1a1.mov

Version Screen Shot 2022-05-05 at 3 41 27 PM

More info:

I created a wraper component to inspect the style object passed down by the restyle wraper. As you can see the first two outputs are printed when variant is undefined but the next two outputs shows are printed when variant="defaults"

image

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, May 26, 2022

I’m having the same issue. running restyle 2.1.0. Going to try to downgrade to 2.0.0

0reactions
alexanderblackhcommented, Dec 1, 2022

This is still broken, and in addition, #35 is now appearing in new apps as well, and both are resolved by downgrading to 2.0.0. It’s a 50/50 of which of these issues appear in a new app I’m working on. At this point, I can only assume 2.1.0 is broken and has been for some time. Luckily 2.0.0 is fully stable, as I’m using this in 5 different apps and have been for a few months, so if anyone is using this library, make sure you yarn add @shopify/restyle@2.0.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variants in prototypes not sticking - Figma Community Forum
When I change between the two in editor, the date override sticks. But when I present, the hover variant, resets to the default...
Read more >
Component Activation fails with: variant "default" is BROKEN
Hello All, I am trying to do a simlpe jsp change. After checking out, changing, and checking in the jsp I try to...
Read more >
Configuring Variants - Tailwind CSS
When overriding the default variants, make sure you always specify all the ... at the end of your stylesheet by default to avoid...
Read more >
Why are my interactive components with overrides displaying ...
... will not be displayed, and the default variant will appear instead, ... Our team has been continuously working to make our Figma ......
Read more >
Figma Tutorial: Variants - YouTube
In this video we'll teach you how to create and use variants and component sets. Learn how to use interactive components here: ...
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