Shopify / flash-list

A better list for React Native
https://shopify.github.io/flash-list/
MIT License
5.58k stars 284 forks source link

Animation does not work when useNativeDriver: true in FlashList #998

Open bloggerklik opened 10 months ago

bloggerklik commented 10 months ago

Animated.event() does not work when useNativeDriver: true. But when useNativeDriver: false it works fine. What do I need to do to make it work when useNativeDriver: true?

ERROR TypeError: _b.call is not a function (it is undefined), js engine: hermes

const offset = useRef(new Animated.Value(0)).current;

const handleScroll = Animated.event(
    [{ nativeEvent: { contentOffset: { y: offset } } }],
    { useNativeDriver: true }
);

return (
    <>
        <Animated.View style={{
            transform: [{
                translateY: offset.interpolate({
                    inputRange: [0, 400], outputRange: [0, -200],
                    extrapolate: "clamp"
                })
            }]
        }} />

        <FlashList onScroll={handleScroll} />
    </>
)
kopchikovich commented 10 months ago

Having the same issue :/ Any updates?

ovgamesdev commented 9 months ago

Using import { AnimatedFlashList} from '@shopify/flash-list' solves this problem

bloggerklik commented 9 months ago

@ovgamesdev Thanks so much it worked. There is no information about this in FlashList's docs :/

hotaryuzaki commented 1 week ago

Using import { AnimatedFlashList} from '@shopify/flash-list' solves this problem

why?????????? i am working with this issue for days and using chatGPT to help debugging. but the main issue is just import with another AnimatedFlashList. the docs need to be updated, why is there no information about AnimatedFlashList?

thanks by the way bro.