Create text variant defaults is not working.

Aperta
#157 12 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react-native, typescript
Ambito
mobile

Direzione di ricerca

Start by reproducing the Link component shown in the issue, using createRestyleComponent, createText, and createVariant with linkVariants. Inspect the variant resolution path to determine why the defaults entry is ignored when variant is undefined. Done means the default styles apply without explicitly passing variant="defaults", with the behavior verified against the reported example.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
3.4k
Fork
154
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Shopify/restyle

Tutte le issue di Shopify/restyle

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.