The problem
Following https://medium.com/appandflow/react-native-collapsible-navbar-e51a049b560a , but trying to move the animated value to redux to reuse it for animations of multiple components, as well as in different tabs on my react-navigation tab router.
However, I get a RangeError: Maximum call stack size exceeded
redbox.
Digging deeper
If I remove the style transform and clampedScroll from the state of the Headers, I instead get Invariant Viloation: A state mutation was detected between dispatches
from the lib redux-immutable-state-invariant
, which detects erroneous mutations of the redux state.
This, in turn, can be fixed by removing the onScroll
listener from the FlatList
, in which case the app runs fine again - but no animations are present, obviously.
I can't explain the first error - maybe there's something about Animated.diffClamp
or Animated.interpolate
I don't understand/know yet. Or maybe it's just a symptom of the second error?
The second error seems to lie with the nativeEvent
not being able to be mapped to a redux state prop. I'm under the impression this should be possible, as Redux is just a HOC. Am I wrong?