At Chime®, we're committed to delivering top-notch experiences for our members. In our most recent update of the Pay Anyone feature, we've integrated an animated progress bar button to indicate the transaction is in progress and discourage repeated taps of the button.


As illustrated in the image above, the text smoothly transitions from dark to light as the progress bar advances, seamlessly blending with the background. This technique, known as masking, allows us to highlight specific areas of objects while keeping the rest hidden. But achieving this effect programmatically wasn't so simple. It would have been easy to say this small detail wasn't possible or worth the effort, but our team persisted and by using the popular react-native-reanimated library in concert with react-native-masked-view, we were able to achieve an effect that we hope will surprise and delight our members.
At Chime, we use React Native as the framework for our mobile application development. When it comes to implementing animated progress bars, one approach is leveraging the React Native Animated library. However, lately, we've started to prefer a different library, the React Native Reanimated library, due to its array of advantages — notably its performance enhancements.
With Reanimated, we can easily interpolate the width of the progress bar based on the percentage completed. Here's a sample method demonstrating how to achieve this:
animationStyle = useAnimatedStyle(() => {
const value = interpolate(
timer.value,
[0, 1],
[0, 100],
);
return {
width: `${value}%`,
};
});







