Create text variant defaults is not working.

Abierto
#157 12 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
react-native, typescript
Área
mobile

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
3.4k
Forks
154
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Shopify/restyle

Todos los issues de Shopify/restyle

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.