leoasis / redux-immutable-state-invariant

Redux middleware that detects mutations between and outside redux dispatches. For development use only.
MIT License
937 stars 37 forks source link

Is it really an invariant to use Animated.event on redux state? #34

Open jhalborg opened 6 years ago

jhalborg commented 6 years ago

Hey :)

Working with the Animated lib on React Native, and I'm getting warnings from this (excellent) module that I'm being naughty.

Essentially, I have a list that updates an Animated.Value onScroll as pr the docs:

<AnimatedFlatlist
    scrollEventThrottle={16}
    onScroll={Animated.event(
            [
              {
                nativeEvent: {
                  contentOffset: { y: this.props.commonState.feedScrollAnim },
                },
              },
            ],
            { useNativeDriver: true }
      )}     
      ...

According to the docs this will map the output of the event to the given value in native land, and not in the JS VM, as far as I understand. As such, I'm not sure it should be regarded as an invariant violation, but I'm not sure?

Disabling this module, everything works just fine. But I'd prefer to have it on, or to have some way of suppressing the redbox for this use case in particular - any way to do that?

Thanks 👍