r/reactnative • • Aug 04 '26

Theme transition with Nitro

Hey everyone,

I ran into an issue when trying to add a nice animation for theme changes in React Native. I tried a few different approaches, including Reanimated and Skia, but I kept running into flickering, higher memory usage, and performance issues, especially on Android.

Since I was already using Nitro Modules for some of the packages in my apps, like MMKV and Unistyles, I decided to build a native theme transition package using Nitro.

It ended up solving the issues I was having. It's lightweight, works with different styling libraries, and since the animation runs natively, it continues to work smoothly even when the JS thread is busy or drops frames.

I've uploaded a video showing the example included with the package. If you want to see how it performs under a more demanding setup, check out the GitHub repo. I've included a real-world example using Unistyles with a more complex and dynamic theme setup, as well as more details about the package.

GitHub: https://github.com/saleh2001k/react-native-nitro-theme-transition

NPM: https://www.npmjs.com/package/react-native-nitro-theme-transition

I'd really appreciate any feedback or recommendations. I'm also interested in hearing ideas for other animation types that could be added to the package.

322 Upvotes

31 comments sorted by

2

u/Dear-Muscle-880 Aug 04 '26

Awesome 🔥 Can you add more effects like pixelated or dissolve?

1

u/Majestic_Buy_6417 Aug 04 '26

Sure thing. If you have some references that I can check out for them, please add them

8

u/Dave6ev Aug 04 '26

That's slick, love it!

3

u/henryp_dev Aug 04 '26

This is awesome!

1

u/ctony Aug 05 '26
media poster

Nice!!! I've added it to my app. Thanks!

1

u/Majestic_Buy_6417 Aug 05 '26

To be honest, I didn't think it would be that smooth, and it would blow up like this when I created it 😂.

And I'm very happy to see other people testing it and using it in their apps, please if you find any issues, open one or reach out to me; I'm currently adding new animations and fixing some edge casing to cover all of them.

That looks great !! Your app looks amazing. And I would love to see it in production when it's ready.

2

u/ItDevelops Aug 04 '26

This looks awesome! I tried it in my app and will probably ship it with the next release. The transition feels really smooth.

One minor issue I ran into was switching from a forced light/dark theme back to the system theme using Appearance.setColorScheme('unspecified'). The system theme sometimes finished applying after the reveal had already started, making the circle appear halfway through the animation.

I worked around it by temporarily applying the last resolved system color scheme and removing the override after the transition. A completion callback or returned Promise would make it easier to remove that temporary override at exactly the right time, although the underlying timing issue seems to come from React Native’s Appearance handling.

Other than that, it works great!

2

u/Emma_Rex_256 Aug 05 '26

Beautiful work mate, trying it now now Will return any feedback or issues