[Bug?] ModalBottomSheet loses contexts

Aperta
#61 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start by tracing the ModalBottomSheet path used when nativeOverlay is false, focusing on the custom in-library Portal implementation that reparents the sheet. Reproduce the context-loss example, then determine whether context preservation or documenting the limitation is the intended outcome; compare the behavior with react-native-teleport if that alternative is evaluated.

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

Descrizione

enhancement

ModalBottomSheet (when not nativeOverlay) seems to use a custom in-library Portal implementation that reparents the sheet into a different tree, this makes child components/tree unable to use existing context from the tree.

// psuedocode
const Cx = createContext();

const SheetUser = () => {
  return (
    <Cx value={1}>
      <ModalBottomSheet ...>
         <Inner />
      </ModalBottomSheet>
    </Cx>
  )
}

const Inner = () => {
  const value = useContext(Cx)
  // value is always undefined
  return ...
}

This should either be documented on the documentation or it could be solved by using a library such as react-native-teleport

PS. I came across this issue while trying to add keyboard avoidance to a nativeOverlay modal sheet, and it does not seem to be really possible - keyboard state is undetectable inside the sheet. Should I make another issue for that?

Lingua principale
Kotlin
Stelle
536
Fork
24
Merge medio
12h 10m
PR unite (30g)
22

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 software-mansion/react-native-bottom-sheet

Tutte le issue di software-mansion/react-native-bottom-sheet

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.