Snackbar stays mounted after `visible=false` under new architecture (iOS + Android)
Los mantenedores suelen responder en 7 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react-native, typescript
- Área
- mobile
Línea de trabajo
Lee src/components/Snackbar.tsx, centrándote en handleOnHidden y en el callback de la animación de ocultación; compara su comportamiento con la solución alternativa de la ruta de muestra en #4447. Reproduce el problema con Fabric habilitado alternando visible de true a false en iOS o Android. Se considera terminado cuando la animación de ocultación deja la Snackbar desmontada y oculta incluso cuando el callback indica finished: false.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Under React Native's new architecture (Fabric), paper's <Snackbar> can get stuck mounted at non-zero opacity after visible is set to false. The hide animation runs visually, but the component never unmounts and stays visible on screen until something else forces a remount.
Sister bug to #3775 / #4445 (which were Android-only show path, fixed by #4447). This is the hide path, and reproduces on both iOS and Android with the new arch enabled.
Root cause
src/components/Snackbar.tsx, handleOnHidden:
Animated.timing(opacity, {
toValue: 0,
duration: 100 * scale,
useNativeDriver: true,
}).start(({ finished }) => {
if (finished) { // ← this guard is the problem under Fabric
setHidden(true);
}
});
Under Fabric, this start({finished}) callback fires with finished: false even when nothing has interrupted the animation. setHidden(true) is the only thing that makes the component return null and actually unmount, so the snackbar stays rendered at whatever opacity the (visually-running) animation reached.
The parallel show-path fix #4447 split handleOnVisible from animateShow to work around the same Fabric noise. The hide path was not touched and still carries the guard.
Expected behaviour
After visible={false}, the Snackbar component unmounts cleanly (hidden flips to true) once the hide animation completes, regardless of the finished flag.
Current behaviour
After visible={false}:
- The hide animation fires (opacity 1 → 0).
- The
startcallback fires withfinished: false. setHidden(true)is skipped.- The component stays mounted; nothing in the React state can clear it.
- Subsequent
setVisible(false)taps re-trigger the same broken animation; the snackbar never goes away.
Repro
- New arch enabled.
- Mount a global
<Snackbar visible={visible} onDismiss={() => setVisible(false)} action={{ label: 'Action', onPress: () => {} }}>Message</Snackbar>. setVisible(true), thensetVisible(false).- Snackbar stays on screen.
Reproduced on:
- iOS 18 simulator (iPhone 15)
- iOS 26 simulator (iPhone 17 Pro Max)
- Android Pixel 8 emulator (API 35)
All with newArchEnabled: true.
Environment
react-native-paper: 5.15.2react-native: 0.83.6- Expo SDK 55
- Fabric / new arch: enabled
Proposed fix
Drop the if (finished) guard, mirroring how #4447 worked around the same class of Fabric noise on the show path:
Animated.timing(opacity, {
toValue: 0,
duration: 100 * scale,
useNativeDriver: true,
- }).start(({ finished }) => {
- if (finished) {
- setHidden(true);
- }
+ }).start(() => {
+ setHidden(true);
});
Trade-off
Under a genuine interrupt (a new show kicked off mid-hide), setHidden(true) would now also fire. The next render uses the new visible=true path → setHidden(false) → re-animates show. The visible artefact is at worst a one-frame snap. A stuck Snackbar that no state change can clear is strictly worse.
Happy to open a PR if useful. Tested locally via patch-package; resolves the issue on both platforms.
- Lenguaje dominante
- TypeScript
- Estrellas
- 14.5k
- Forks
- 2.2k
- Merge medio
- 6 d 12 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de callstack/react-native-paper
-
Menu ignores the keyboard when it mounts while the keyboard is already openPosiblemente ocupada @manchoudhary la tomó hace 20 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
callstack/react-native-paper#5096 ·
Los mantenedores suelen responder en 7 días
-
Color Picker Popup Is Obscured On "Guides -> Theming -> Creating Dynamic Theme Colors" Documentation On Both v5 and v6Posiblemente ocupada @fatihcvs la tomó hace 15 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
callstack/react-native-paper#5093 ·
Los mantenedores suelen responder en 7 días
-
Tooltip: onPress event object is not propagated to parent component on nativePosiblemente ocupada @Shevilll la tomó hace 107 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
callstack/react-native-paper#5003 ·
Los mantenedores suelen responder en 7 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
callstack/react-native-paper#4881 ·
Los mantenedores suelen responder en 7 días
-
feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
callstack/react-native-paper#4863 · 1 comentario ·
Los mantenedores suelen responder en 7 días
Todos los issues de callstack/react-native-paper
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AOSSIE-Org/DebateAI#611 ·
Los mantenedores suelen responder en 3 días
-
Upgrade node-libzim to 4.7.0Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
openzim/mwoffliner#2933 ·
Los mantenedores suelen responder en 1 día
-
Use the README category name for website links and submissionsPosiblemente ocupada @dajiaohuang la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
birobirobiro/awesome-shadcn-ui#647 ·
Los mantenedores suelen responder en 2 días
-
Twake Drive picker: closePicker() never destroys the intent (stop() is on the promise returned by start(), not by create())Posiblemente ocupada @chibenwa la tomó hoy. Abiertoclaude
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
linagora/twake-calendar-frontend#1498 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add: Valea Prahovei TV RO SDAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día