iOS: first foreground after launch remounts the whole app (isHeadless written into root appProperties)
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
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
- Launch an app that uses
@use-voltra/ios-clientnormally (foreground). Its root view'sappPropertieshas noisHeadlesskey. - Send the app to the background, then bring it back.
- 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
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di callstackincubator/voltra
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
callstackincubator/voltra#360 ·
I maintainer di solito rispondono entro 1 giorno
-
refactor-scout
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
callstackincubator/voltra#308 ·
I maintainer di solito rispondono entro 1 giorno
-
refactor-scout
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
callstackincubator/voltra#307 ·
I maintainer di solito rispondono entro 1 giorno
-
bug platform:Android Widget
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
callstackincubator/voltra#345 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement platform:Android platform:iOS
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
callstackincubator/voltra#343 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di callstackincubator/voltra
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
awslabs/visual-asset-management-system#804 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
restatedev/sdk-typescript#813 ·
-
bug desktop P1 session XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Merit-Systems/x402scan#1312 ·
-
type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Azure/apiops-cli#331 ·
I maintainer di solito rispondono entro 3 giorni