How to use Animated refs in transform space-separated string function values react-native

516 views Asked by At

I've encountered a deprecation warning regarding the use of the "transform" style array value in React Native. Instead, I'm advised to use space-separated string functions for transformations, like scaleX(2) rotateX(15deg).

"transform" style array value is deprecated. Use space-separated string functions, e.g., "scaleX(2) rotateX(15deg)"

In my code, I have a ref useRef(new Animated.Value(isActive ? 10 : 0)) that I intend to use within the transform style. Initially, I used it like transform: [{scale: ref}].

However, with the deprecation, I'm unsure how to incorporate the ref within space-separated string functions. Could you guide me on how to rewrite this using the string function approach, like transform: 'scale(ref)'?

0

There are 0 answers