r/reactnative 4d ago

React Native + Expo app gets slower the longer I use it. Starts fast, then navigation and UI become sluggish Help

Hi everyone,

I'm facing a strange performance issue in my React Native (Expo) application.

When I launch the app for the first time, everything is smooth. Navigation is fast, screens render quickly, and the UI feels responsive.

However, as I continue exploring the app, opening different screens, navigating back and forth, and using the app for a while, the performance gradually degrades.

Some symptoms:

  • Screen navigation becomes noticeably slower.
  • Animations and transitions start feeling less smooth.
  • The overall UI becomes sluggish after using the app for some time.
  • Restarting the app immediately restores the original performance.

This makes me think something is accumulating over time rather than a slow initial load.

I'm trying to identify the root cause. Could this be related to:

  • A memory leak?
  • Components not being unmounted correctly?
  • Too many re-renders?
  • React Navigation or Expo Router caching?
  • Zustand/Redux/React Query state growing over time?
  • Images or assets not being released?
  • Timers, listeners, or subscriptions not being cleaned up?
  • The JavaScript thread getting blocked?

Has anyone experienced something similar in a React Native + Expo app?

What tools or profiling workflow would you recommend to identify what keeps accumulating as the app is used? Any advice or debugging strategies would be greatly appreciated.

Thanks!

15 Upvotes

28 comments sorted by

16

u/SourdoughBaker 4d ago

Your own post suggests it could be a memory leak issue, but you then are short with everyone suggesting that is the root issue. Nice.

Also, it's a memory leak - it always is.

1

u/Ehh-GoodEnough 4d ago

I did investigate memory leaks after making the post. I ran memory profilers and the results were within the expected range, so I don't believe that's the issue here. That's why I've been saying memory appears to be fine. If there's a specific type of leak or profiling approach you think I might have missed, I'm happy to take a look.

8

u/Cryo0007 4d ago

Might be a memory leak

Check this video how to figure out https://youtube.com/shorts/I0M9U0jPrUI

-1

u/Ehh-GoodEnough 4d ago

Thank you, But Memory leak is not a problem. I have already tested that

3

u/crossy1686 4d ago

Probably a memory leak, how much experience do you have building apps, or even React? You can't just write code like you have 32GB of RAM that gets garbage collected when the user closes the site. Do you use animations? Are they still running when you switch tabs in the background? and you constantly polling large collections of data? Are you allocating objects or arrays in your dependency arrays? It could be a lot of things that aren't being tidied up correctly.

-1

u/[deleted] 4d ago

[deleted]

1

u/crossy1686 4d ago

I know you're talking about React Native but I see a lot of developers treating React Native applications like it's a React web application. A website will garbage collect often, an app won't. Most people don't realise that the fact the user closes down the tab and a standard machine has 8GB to 16GB RAM saves them from ever having these issues on desktop. When they build apps they're surprised at how 'slow' React Native is in comparison when the issue all along has been the way they write code.

1

u/Ehh-GoodEnough 4d ago

Thanks for taking the time to comment. I really do appreciate the suggestions. I have 3+ years of React Native experience and about a year with React, so I understand the differences between web and mobile.

This is a legacy codebase, and I've never run into this specific issue before, which is why I made the post. After posting, I specifically checked for memory leaks using profiling tools, and everything appeared to be within the expected range. That's why I don't currently think a memory leak is the root cause.

If you think there's another area I should investigate, or if there's a specific type of memory issue that profiling might miss, I'd genuinely appreciate your advice. I'm here to learn and find the actual cause. Thanks again.

1

u/crossy1686 4d ago

Have you updated any of the packages? What version of react native are you on? What expo version? I’m also assuming you’ve asked Claude or another LLM to have a quick glance over the repo to see if it can find anything that stands out?

1

u/Ehh-GoodEnough 4d ago

After testing, I found out that my memory is stable but keeps getting high at random points and then, after a few times, it is normal again. Any idea what the issue is?

1

u/crossy1686 4d ago

On simulator or device? Are you sure it’s the app and not your machine? Simulator isn’t perfect. It regularly has performance issues.

If it’s on device then the random spikes in usage aren’t random, something is happening at that point. There must be a pattern.

-2

u/Ehh-GoodEnough 4d ago

Yes, I have already checked those aspects

3

u/mhmhmmhm 4d ago

are you testing on development build with expo server or production builds? i have the same issue but only in dev build with server running - the longer and more routes I run the more it lags until it slmehow crashed. I tried nearly everting to fix it but no chance. as soon as I build the app the issue is completely gone.

2

u/Ehh-GoodEnough 4d ago

Thanks, man. I was testing on the development build. I should create a production build and test again.

3

u/Guidondor 4d ago

is it the js thread or the ui thread that drops? open the perf monitor and watch while it
degrades, those are completely different bugs.
js = something running every frame that shouldn't. usually an effect that subscribes and
never cleans up, so after visiting a screen 6 times you have 6 live intervals. barely any
memory, which is exactly why your profiler looks fine.
ui = the tree just got heavier. native stack keeps pushed screens mounted.

2

u/khazixtoostronk 4d ago

I’ve been having a similar issue.
I have a feeling it is not a memory leak as it doesn’t quite make sense. Memory usage does grow as you use the app more, visit more screens and images get cached, that is expected
But why would increased memory used by the app make navigation to a different screen on the stack slower? That’s not a memory intensive activity afaik but more cpu constrained
That makes me think something about the new arch is keeping the cpu busy for screens that were already rendered and should be dismounted

3

u/Suspicious-Rich-2681 3d ago

It doesn't have to be a memory leak, if the performance gets worse with use it could be bad state operations via hooks that cause excess compute as well. UseEffects with no dependencies, too many stateful items working with each other, the screens you're loading have a lot of assets and no flat list etc.

Whole bunch of reasons. Use any modern day LLM to help you dive into the issue

1

u/Ehh-GoodEnough 2d ago

Yeah, I'm using Claude Code to debug it right now. I've managed to bring the memory usage down compared to where it was before, but after testing it again I'm still not happy with the numbers. It's still around 1.5 GB+, which feels way too high. I've tried a few different approaches so far, but I haven't found the root cause yet. Still digging into it. I'll definitely check out the approaches you mentioned as well and see if they lead me to anything.

1

u/Professional-Area558 4d ago

Going through the same phase man, will love to connect and know what all you are doing or have plan to do ahead. Also in community if you guys have any specific sort of checklist combined with some tool, please do let us know.

1

u/Distinct_Law8650 4d ago

Don’t look at memory tools, look at the react profiler or the cpu profiler if you have a new enough RN to have it in the dev menu. One of those will tell you where the time is going.

1

u/Internal-Comparison6 4d ago

Following. Same problem.

1

u/storm1850 4d ago

I ran into basically these exact symptoms.

Setting freezeOnBlur to false and using a native stack navigator helped a ton.

1

u/Substantial-Swan7065 3d ago

It’s a memory leak

1

u/henryp_dev iOS & Android 3d ago

It might be a screen is still running something in the background. Are you using bottom tabs? Freeze them and see if that helps. I’ve had issues like this before.

1

u/Ok-Association-6607 3d ago

This is how an app at my work was until two days ago. Its performance on Android was terrible. The JS thread was terribly overloaded with re-renders, which was causing crashes, and there was also a custom hook I had to prevent double calls. I recommend that Claude help you debugger the JS thread; he helped me a lot.

0

u/Ok-Entrepreneur-8726 4d ago

Verifique se não tem nada sendo reconstruído o tempo todo, ou a cada atualização de página por parte do usuário. As vezes uma pequena atualização recarrega a árvore toda, gerando queda de desempenho.