1 | import * as React from 'react';
|
2 | import { Animated } from 'react-native';
|
3 |
|
4 | export default function useAnimatedValueArray(initialValues: number[]) {
|
5 | const refs = React.useRef<Animated.Value[]>([]);
|
6 |
|
7 | refs.current.length = initialValues.length;
|
8 | initialValues.forEach((initialValue, i) => {
|
9 | refs.current[i] = refs.current[i] ?? new Animated.Value(initialValue);
|
10 | });
|
11 |
|
12 | return refs.current;
|
13 | }
|