Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The FlashList items jerk when scrolling through them. #989

Open
Bhavin-hyperspace opened this issue Dec 5, 2023 · 1 comment
Open

The FlashList items jerk when scrolling through them. #989

Bhavin-hyperspace opened this issue Dec 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Bhavin-hyperspace
Copy link

Bhavin-hyperspace commented Dec 5, 2023

My FlashList:

<FlashList
          data={myFeed}
          ref={flatListRef}
          extraData={isRefresh}
          renderItem={renderMethod}
          snapToInterval={ITEM_LENGTH}
          scrollEnabled={scrollEnabled}
          estimatedItemSize={myFeed.length * 100}
          renderToHardwareTextureAndroid
          onEndReached={onEndReachedFeedList}
          onEndReachedThreshold={0.0000000001}
          showsVerticalScrollIndicator={false}
          contentContainerStyle={styles.flatListStyle}
          keyExtractor={(item, index) => index.toString()}
          disableIntervalMomentum={true}
          decelerationRate={'fast'}
          numColumns={1}
          disableAutoLayout
          ListFooterComponent={renderFooter}
          enableEmptySections={true}
          renderAheadOffset={myFeed.length * 10000000}
          onScroll={Animated.event(
            [
              {
                nativeEvent: {
                  contentOffset: {
                    y: scrollX,
                  },
                },
              },
            ],
            {
              useNativeDriver: false,
            },
          )}
        />
    My RenderMethod:
    
    const inputRange = [
  (index - 1.0) * ITEM_LENGTH,
  index * ITEM_LENGTH,
  (index + 1.0) * ITEM_LENGTH,
];

const translateOutX = scrollX.interpolate({
  inputRange,
  outputRange: [160, -40, -800],
  easing: Easing.quad,
});

const translateY = scrollX.interpolate({
  inputRange,
  outputRange: [
    CURRENT_ITEM_TRANSLATE_Y * 3.0,
    CURRENT_ITEM_TRANSLATE_Y * 7.5,
    CURRENT_ITEM_TRANSLATE_Y * 6.8,
  ],
});

const scale = scrollX.interpolate({
  inputRange,
  outputRange: [0.8, 0.8, 0.8],
});

return (
  <Animated.View
    style={[
      {
        transform: [{translateX: translateOutX}, {scale}, {translateY}],
        paddingTop:
          index === 1
            ? isNotch
              ? Responsive.heightPercentageToDP(14.8)
              : Responsive.heightPercentageToDP(7.5)
            : 0,
        width: '100%',
      },
    ]}>
Jerking_1.mp4
@Bhavin-hyperspace Bhavin-hyperspace added the bug Something isn't working label Dec 5, 2023
@Jin-seop
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants