diff --git a/components/modescreen/GameModeCarousel.jsx b/components/modescreen/GameModeCarousel.jsx
index 495a382..2109f1d 100644
--- a/components/modescreen/GameModeCarousel.jsx
+++ b/components/modescreen/GameModeCarousel.jsx
@@ -3,6 +3,33 @@ import { View, Text, TouchableOpacity, Image } from "react-native";
import Carousel from "react-native-snap-carousel";
import { useNavigation } from "@react-navigation/native";
+// Memoized functional component for each item
+const CarouselItem = React.memo(({ item, navigation }) => (
+
+
+
+
+ {item.title}
+
+ item.available && navigation.navigate("Lobby")}
+ className={`py-2 px-4 rounded-full ${
+ item.available ? 'bg-cyan-700' : 'bg-gray-400'
+ }`}
+ disabled={!item.available}
+ >
+
+ {item.available ? 'Choisir' : 'Indisponible'}
+
+
+
+
+));
+
const GameModeCarousel = () => {
const navigation = useNavigation();
@@ -28,29 +55,7 @@ const GameModeCarousel = () => {
];
const renderItem = ({ item }) => (
-
-
-
-
- {item.title}
-
- item.available && navigation.navigate("Lobby")}
- className={`py-2 px-4 rounded-full ${
- item.available ? 'bg-cyan-700' : 'bg-gray-400'
- }`}
- disabled={!item.available}
- >
-
- {item.available ? 'Choisir' : 'Indisponible'}
-
-
-
-
+
);
return (
@@ -63,6 +68,7 @@ const GameModeCarousel = () => {
loop
autoplay
autoplayInterval={5000}
+ initialNumToRender={3} // Adjust for better performance
/>
);