facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
117.72k stars 24.16k forks source link

FlatList: Pull to Refresh refresh controls are "freezed" after navigation.goBack() #41515

Open ivanignatiev opened 9 months ago

ivanignatiev commented 9 months ago

Description

I cannot find any open issue for this topic.

I have 2 screens inside same context, useEffect depend on both screens depend on the same state from common context.

When I update context state data on Screen 2, and goBack()to Screen 1, refresh controls for flatlist are just freezed and I need to pull it to make it disappear:

State with refreshingvalue if changing to false correctly.

React Native Version

0.73.0-rc.4

Output of npx react-native info

System: OS: macOS 14.1.1 CPU: (12) arm64 Apple M3 Pro Memory: 68.31 MB / 18.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 21.1.0 path: /opt/homebrew/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 10.2.0 path: /opt/homebrew/bin/npm Watchman: version: 2023.11.06.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.2 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms:

Steps to reproduce

  1. Make 2 screens inside same context
  2. Use FlatList on screen 1 and screen 2
  3. Use useEffect dependent on the same state in the common context
  4. go to Screen 2 , modify state in the common context
  5. use navigation.goBack()
  6. See that refresh controls are still there even if refreshingis false

Snack, screenshot, or link to a repository

Screenshot by Dropbox Capture
github-actions[bot] commented 9 months ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
huiqun922 commented 9 months ago

+1 same isuues. when switch tab or back to desktop and return app. screen loss of focus happens。 only iOS

cortinico commented 9 months ago

0.73.0-rc.4

Is this a regression from 0.72?

huiqun922 commented 9 months ago

0.73.0-rc.4

Is this a regression from 0.72?

0.72.4

ivanignatiev commented 9 months ago

My observations, it is happening only when I write logs, so they are showing in metro. In release build with logs turned off everything is working as expected.

Maybe communication with metro in async operation is breaking something.

cortinico commented 9 months ago

@ivanignatiev can you try on 0.72 and confirm if the issue persists there or not?

huiqun922 commented 8 months ago

@cortinico i have same issue on 0.72.1

Demo Repository: https://github.com/huiqun922/rn_nav.git

https://github.com/facebook/react-native/assets/4495165/4c59555f-9480-4058-aade-48262ce1aae2

huanguolin commented 2 months ago

same issue with 0.72.12