How to compare a SharedValue property inside memo callback?
_.isEqual(prevProps.animatedProgress, nextProps.animatedProgress)
prevProps.animatedProgress === nextProps.animatedProgress
_.isEqual(prevProps.animatedProgress.value, nextProps.animatedProgress.value)
prevProps.animatedProgress.value === nextProps.animatedProgress.value
Is this possible or not possible? Which one is the correct way?
I have been trying using lodash:
function arePropsEqual(prevProps, nextProps) {
return _.isEqual(prevProps.animatedProgress, nextProps.animatedProgress)
}
But, sometimes, I get the error
Error: [Reanimated] Reading from
_value
directly is only possible on the UI runtime.
Also, when trying directly logging .value inside arePropsEqual, the result for the next property is not up to date (it shows the previous values).
function arePropsEqual(prevProps, nextProps) {
console.log(nextProps.animatedProgress); // Logs the value of the previous render, not the new one.
}