Skip to content

Marquee list is getting slows down in android and face crashes in production #16

@AkilUnik

Description

@AkilUnik

`import React, { memo } from "react";
import { Marquee } from "@animatereactnative/marquee";
import { Image, View } from "react-native";
import { hp } from "../../../utils/dimensions";
import { COLORS } from "../../../theme/color";
import Animated, { FadeInLeft, FadeInRight } from "react-native-reanimated";
import { ANIMIE_IMAGES } from "../../../assets/anime";

const MarqueeList = () => {
const numRows = 4;
const imagesPerRow = Math.ceil(ANIMIE_IMAGES.length / numRows);

const imageGroups = Array.from({ length: numRows }, (_, i) =>
ANIMIE_IMAGES.slice(i * imagesPerRow, (i + 1) * imagesPerRow - 1)
);

return (
<View
style={{
flex: 1,
transform: [{ rotate: "170deg" }, { scale: -1 }],
top: -hp(60),
borderWidth: 0,
borderColor: COLORS.purple,
}}
>
{imageGroups.map((images, rowIndex) => (
<Marquee
key={marquee-${rowIndex}}
spacing={8}
speed={0.4}
style={{ marginTop: 12 }}
reverse={rowIndex % 2 !== 0}
>
<View style={{ flexDirection: "row" }}>
{images.map((image, index) => (
<Box key={box-${rowIndex}-${index}} size={170} spacing={10}>
<Image
entering={(rowIndex % 2 === 0 ? FadeInRight : FadeInLeft)
.duration(500)
.delay(300 * (rowIndex + 1) + Math.random() * 100)}
source={image}
style={{
width: "100%",
height: "100%",
borderRadius: hp(10),
}}
/>

))}


))}

);
};

const Box = ({ children, size = 200, spacing = 0 }) => {
return (
<View
style={{
width: hp(size),
height: hp(size),
marginRight: spacing,
marginBottom: spacing,
borderRadius: hp(10),
justifyContent: "center",
alignItems: "center",
backgroundColor: COLORS.gray_800,
}}
>
{children}

);
};

export default memo(MarqueeList);
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions