Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

iOS: first foreground after launch remounts the whole app (isHeadless written into root appProperties)

Aperta Adatta ai principianti
#340 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
objective-c, react-native
Ambito
mobile

Direzione di ricerca

Inizia dal modulo Objective-C NativeVoltra, dall'observer di UIApplicationWillEnterForegroundNotification e dal metodo updateRootAppPropertiesHeadless: che scrive isHeadless nelle appProperties della root view. Verifica che un avvio normale non abbia la chiave isHeadless e che il return anticipato si attivi solo con valori uguali. Riproduci su un simulatore iOS portando l'app in primo piano una volta dopo un avvio normale e osserva in Metro il log setSurfaceProps. È fatto quando il primo ritorno in primo piano dopo un avvio normale lascia invariate le surface props, e un avvio in background imposta ancora YES e poi lo cancella.

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

Descrizione

platform:iOS
Library Version

2.3.2 (the same code is in 2.4.0)

React Native Version

0.86.3 (New Architecture / Fabric)

React Version

19.2.3

Expo Version

57.0.22

Minimal Reproduction
  1. Launch an app that uses @use-voltra/ios-client normally (foreground). Its root view's appProperties has no isHeadless key.
  2. Send the app to the background, then bring it back.
  3. Watch Metro: on that first foreground React Native logs Updating props for Surface "main" with {"rootTag":…,"initialProps":{"isHeadless":false},"fabric":true}, and the whole React tree unmounts and remounts. Later foregrounds don't do it again, because the key is now present.

Expected: foregrounding an app that was launched normally doesn't change its surface props.

Actual: the first foreground after every launch remounts the app. Anything in flight is torn down. For example, a ScrollView mid pull-to-refresh is unmounted while refreshing, and screen state and effects all reset.

Additional Information (Optional)

NativeVoltra observes UIApplicationWillEnterForegroundNotification and calls updateRootAppPropertiesHeadless:NO. That method only returns early when the existing value equals the new one:

if ([nextProperties[@"isHeadless"] isEqual:nextValue]) {
  return;
}
nextProperties[@"isHeadless"] = nextValue;
[rootView setValue:nextProperties forKey:@"appProperties"];

For a normal launch the key is missing, so nil isn't equal to @NO and Voltra writes it. Setting appProperties makes React Native call AppRegistry.setSurfaceProps, which re-runs the root.

A missing key already reads as "not headless" for anyone reading the prop, so skipping the write in that case fixes it without changing what headless launches see:

if (!isHeadless && nextProperties[@"isHeadless"] == nil) {
  return;
}

With this guard, the first foreground no longer updates the surface props or remounts anything (checked on an iOS 26.5 simulator). A background launch still sets YES and later clears it, since only the missing-key case is skipped. We're carrying it as a local patch for now and are happy to open a PR.

Lingua principale
TypeScript
Stelle
850
Fork
50
Merge medio
15h 13m
PR unite (30g)
13

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 callstackincubator/voltra

Tutte le issue di callstackincubator/voltra

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.