I have a list of value in a sharedValue
, each value represent the opacity of a children component. list
indexes are similar to the children indexes
const list = useSharedValue(new Array(BlockNumber).fill(1));
i want to be able to change the child opacity based on it index when setting a new value to list
for example
list.value[index] = 0.5
the useAnimatedStyle
hook does not change the style if i put it inside the function ChildsStyle
using the argument index
like below
const ChildsStyle = (index) => useAnimatedStyle(() => {
return {
opacity : list.value[index]
};
})
how can I change the child's style based on its index
how to correct the function ChildsStyle