State Updates Not Reflected in PIP Mode with New Architecture enabled
Nessuno ha ancora preso questa issue.
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Merge medio
- 1g 23h
- PR unite (30g)
- 4
Descrizione
Description
I’ve encountered an issue with state updates not reflecting in Picture-in-Picture (PIP) mode starting from React Native 0.76, which I believe is related to the new architecture (Fabric) being enabled by default.
To demonstrate the issue, I created a simple counter using the react-native-background-timer library.
The code is a simplified example created solely to replicate the issue. In my actual use case, I am not using react-native-background-timer. Instead, I perform state updates, such as resizing the video player when switching to Picture-in-Picture (PIP) mode. However, these state updates stop working once the app enters PIP mode, and this behavior only occurs in React Native 0.76 and above.
Steps to reproduce
import BackgroundTimer from 'react-native-background-timer';
import React, { useState, useEffect } from 'react';
import { View, Text, StyleSheet } from 'react-native';
const App = () => {
const [count, setCount] = useState(0);
useEffect(() => {
const intervalId = BackgroundTimer.setInterval(() => {
setCount(prevCount => prevCount + 1);
}, 1000);
return () => BackgroundTimer.clearInterval(intervalId);
}, []);
return (
<View style={styles.container}>
<Text style={styles.counter}>{count}</Text>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
counter: {
fontSize: 48,
fontWeight: 'bold',
},
});
export default App;
This example works perfectly fine in React Native 0.75 and below. However, in version 0.76 and above (with the new architecture enabled), the state does not update once the app goes into PIP mode.
React Native Version
0.76.0 onwards or when newArch in enabled
Affected Platforms
Runtime - Android
Areas
Fabric - The New Renderer
Output of npx @react-native-community/cli info
-
Stacktrace or Logs
-
Reproducer
Screenshots and Videos
Video Links
You can access the following videos:
Guida per i contributori
Apri 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.
Direzione di ricerca
Inizia con l’esempio di contatore Android fornito e confronta il suo comportamento su React Native 0.75 rispetto a 0.76+ con la New Architecture abilitata. Esamina il percorso Fabric/PIP indicato dal report e usa come riferimento i video di test collegati. Il lavoro è completato quando gli aggiornamenti dello stato continuano a essere visualizzati mentre l’app è in modalità PIP, senza dipendere da react-native-background-timer.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react-native
- Ambito
- mobile
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100