Skip to content
Discussion options

You must be logged in to vote

Hi, you can achieve both: follow the rules of eslint and performance improvements if you move it to a component:

function ItemRenderer({ index, item, scrollY }) {
const inputRange = [index - 2, index - 1, index];
    const itemStyle = useAnimatedStyle(() => ({ // <== can't do this
      transform: [
        {
          scaleY: interpolate(scrollX.value, inputRange, [0.2, 1, 0.2]),
        },
       ],
    }));


    return (
      <View style={{ width: ITEM_SIZE }}>
        <Animated.View
          style={[
            itemStyle,
            styles.itemDefaultStyle,
          ]}
        >
          <Text>{index - 1}</Text>
        </Animated.View>
      </View>
    );
  };
}

But also use …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dantenol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants