react / react/react-native-website

Ambiguity on why the index property in ViewToken is marked optional

Aperta
#3,637 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Never gets stale
Lingua principale
MDX
Stelle
2.2k
Fork
6.3k
Merge medio
11h 37m
PR unite (30g)
19

Descrizione

Description

On the ViewToken page in the docs it shows that the index property is optional. This is not explained in any further detail by the docs.

What is the problem?

It is unclear to me in what situation this property would be null. This object is used as a parameter for the onViewableItemsChanged callback in VirtualizedList so it is in turn also used in both FlatList and SectionList. This makes me think there wouldn't be a situation where index would be null.

How can we address it?

Update the description of the index property on ViewToken to clarify in what situation it could be null.

If anyone knows a resource like an issue in the react-native repo or a from post that discusses this or can explain it to me I can also make a PR to clarify the description on the property.

Why is it important?

It is currently ambiguous why the index property on ViewToken is marked as optional.

Who needs this?

Anyone using the onViewableItemsChanged prop and relies on the indexes of the callback.

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia dalla pagina ViewToken nella documentazione di React Native ed esamina la descrizione della sua proprietà opzionale index. Esamina come ViewToken viene usato dal callback onViewableItemsChanged in VirtualizedList, FlatList e SectionList, quindi conferma la situazione che consente un indice null. Aggiorna la descrizione della proprietà per spiegare tale situazione e verifica la documentazione renderizzata.

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

Valutazione

Stack tecnologico
react-native
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.