New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bottom-tabs] Navigation delay with useFocusEffect, especially on low-end devices #11613
Comments
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
The behavior persists even after upgrading to the latest versions |
For what it's worth - I am experiencing similar navigation event lag w/ bottom tabs. App is built with Expo, on SDK 49. I just tested switching from hermes back to jsc -- and my navigation speed issues improved considerably. |
@trattles thanks for sharing! However, I tried the same thing in my app, and actually, it became slower.
Same here. |
I've started to believe it might be related to React 18 Automatic Batching feature, but i'm not sure how this relates with React Navigation. I couldn't find anything on the docs. However, it noticeably affects navigation performance. I'm still looking into it and would appreciate if anyone has any inputs to share on this. |
@rnqs i'm in the same boat. |
@rnqs How can I confirm if the issue is caused by the React 18 Automatic Batching feature? Is there a way to adjust this issue with React Navigation? I've also encountered a similar performance problem. |
Same problem for me, do you find any solution or temp fix ? |
I just suspect the issue might be related to React 18 Automatic Batching.
Unfortunately, I haven't found any solution or temp fix for this problem thus far. I'd really appreciate it if someone with a more in-depth knowledge of this library could take a look at this. |
Is there any update on this issue, I've been noticing very similar behaviour due to the fact the default implementation awaits everything to render within the screen before transitioning. Haven't found a viable solution as of yet. |
I've posted a proposed fix, please verify that it solves your problems as well 👍 |
I was changing a state in a custom hook, however I had that deley when changing the state, I solved it by adding a setTimeout to change the state, Example:
|
this is still happening. removing useIsFocused() solved the issue |
Not works for me facing same issue |
Current behavior
I have an app in production that has a bottom tab navigation and screens with
useFocusEffect
that refresh the data in a list. Recently some users, particularly with low-end devices, reported attempt to navigate between bottom tabs, upon selecting a screen, they expect to transition smoothly to the new tab. However, the current behavior is:useFocusEffect
on Screen 2 completes.Example of the problem:
Screen.Recording.2023-09-22.at.16.11.01.mov
I have already tried some approaches to mitigate this issue, including:
lazy
,unmountOnBlur
, andfreezeOnBlur
properties of the navigation components.useEffect
hook with different configurations.InteractionManager.runAfterInteractions
to try not to interfere with the transition between screens.Please let me know if you need any further information or if there are specific actions or configurations I should try.
Expected behavior
I think the expected behavior in this scenario would be to respond immediately to the user's interaction, taking them to the target tab and then triggering
useFocusEffect
to update the data.I assumed that the problem is in React Navigation because it happens during tab navigation and with the use of
useFocusEffect
, but I could be wrong.Reproduction
https://snack.expo.dev/@rnqs/bottom-tabs-navigator-%7C-react-navigation
Platform
Packages
Environment
The text was updated successfully, but these errors were encountered: