You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exportfunctionuseAnimatedColor(color: Reanimated.SharedValue<string>,): Readonly<Reanimated.SharedValue<string|number>>{constanimation=useSharedValue(0);constcolorFrom=useSharedValue(DEFAULT_COLOR);constcolorTo=useSharedValue(color.value);useAnimatedReaction(()=>color.value,(newColor,prevColor)=>{animation.value=0;colorFrom.value=prevColor??DEFAULT_COLOR;colorTo.value=newColor;animation.value=withTiming(1,{duration: 150,easing: Easing.linear,});console.log(`Animating from ${prevColor} -> ${newColor}`);},);// TODO: Using colorFrom and colorTo in here raises "Attempting to assign to readonly property" error...returnuseDerivedValue(()=>interpolateColor(animation.value,[0,1],[colorFrom.value,colorTo.value]),);}
Right now, I've hotfixed this by using a custom patch for react-native-reanimated that completely removes the RGB cache. This now runs correctly, but ideally I want to fix this and make use of the cache for performance reasons.
The text was updated successfully, but these errors were encountered:
My animated color hook:
is causing this error:
See software-mansion/react-native-reanimated#2329 for more details.
Right now, I've hotfixed this by using a custom patch for react-native-reanimated that completely removes the RGB cache. This now runs correctly, but ideally I want to fix this and make use of the cache for performance reasons.
The text was updated successfully, but these errors were encountered: