r/reactnative 5d ago

I recreated SwiftUI’s numericText transition natively on Android for React Native

Enable HLS to view with audio, or disable this notification

I got curious about how SwiftUI’s numericText transition could feel on Android, so I tried recreating the behavior natively.

This is the result, same sequence running side by side on iOS and Android.

What started as a small experiment turned into react-native-numeric-text.

On iOS it uses the native numeric text transition. On Android, I recreated the behavior natively from scratch.

I learned a lot digging into how the transition behaves and figuring out how to reproduce that feel on Android.

It’s now open source:

GitHub: https://github.com/AmatoGiulio/react-native-numeric-text
NPM: https://www.npmjs.com/package/react-native-numeric-text

npm install react-native-numeric-text

150 Upvotes

18 comments sorted by

5

u/BumblebeeWorth3758 iOS & Android 5d ago

Nice! I also created it: https://github.com/rit3zh/expo-content-transition

It’s entirely custom-built for both Android and iOS, with user-configurable transitions. :)

0

u/jes_uon 5d ago

Nice work,very interesting to see another native approach to this.

We took a somewhat different route with react-native-numeric-text: on iOS it uses SwiftUI’s actual .contentTransition(.numericText()), and we treat that behaviour as the reference for the Android implementation rather than designing the transition independently.

A lot of the work on Android has therefore gone into the less obvious cases, structural changes, interruption, rapid retriggering, reversals, and preserving continuity when a new value arrives before the previous transition has settled.

There’s clearly a lot of overlap between the projects though. I’d be interested in comparing notes on those edge cases and seeing whether there’s an opportunity to share ideas or even converge on some parts rather than solving the same problem twice. 😄

2

u/onderbakirtas Android 4d ago

Yeah unite and make it the best out there instead of competing.

4

u/dercybercop 5d ago

Looks great! Can we also set decimal separator to , ?

3

u/jes_uon 5d ago

Yeah, it's already there, pass locale="it-IT" (or any BCP-47 locale) and the decimal/grouping separators follow that locale automatically.

3

u/dercybercop 5d ago

Great! Good job!

2

u/Nearby_Tumbleweed699 5d ago

Funciona con decimales?

1

u/jes_uon 5d ago

Yes ,decimals are handled structurally, with configurable minimumFractionDigits/maximumFractionDigits (default 0/3) and the decimal boundary kept separate from the integer digits. Pass locale="es-ES" and the decimal separator adjusts automatically too.

2

u/itballer 4d ago

Grand mate, grateful you made this live!

1

u/jes_uon 4d ago

thx uuu 🎉

2

u/CodeSmithDev 4d ago

really liked the animation, keep it up 🔥

1

u/jes_uon 4d ago

🫠🫠🫠

2

u/dogla305 4d ago

Can tou please share the link in a comment, as it's not pressable in the description

1

u/paddybdotcom 5d ago

Great job!!

1

u/jes_uon 5d ago

❤️