Issues with `createText` typing

Aperta
#153 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start by tracing the createText typing and compare its generic and inferred props behavior with the custom component examples in the issue. Check whether createBox has the same pattern, then verify that custom components require the expected props and style prop while calculated props remain supported.

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

Descrizione

enhancement

What:

  • Not forcing you to pass the custom component props as generic, this leads to add all the RN Text props to the restyled custom component.
const CustomText = ({ title }: { title: string }) => <Text>{title}</Text>;

const RestyledCustomText = createText<Theme>(CustomText);

<RestyledCustomText color="lightpink" accessibilityLabel="I am a label" />;
  • There is no type inference between the generic and the props of the passed component:
const CustomText = ({ title }: { title: string }) => <Text>{title}</Text>;
const RestyledCustomText = createText<Theme, {}>(CustomText);
  • We are not forcing the passed custom text to have a style prop (the style prop will contain all the calculated props as a style object)

I believe the same applied for createBox.

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.