This commit is contained in:
Philip Cesar Garay
2025-07-31 21:25:33 +08:00
parent 5cfbc81e3a
commit 84fc719a10
307 changed files with 46470 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import { View } from "react-native";
import { Motion } from "@legendapp/motion";
import { Palette } from "../styles";
export default ({
carouselRef = null,
selectedIndex,
length,
containerStyle = {},
}) => {
return (
<View style={{ flexDirection: "row", ...containerStyle }}>
{Array.from({ length }).map((_, index) => (
<Motion.Pressable
key={index}
onPress={() => {
if (carouselRef?.current && index !== selectedIndex) {
console.log("scroll to", index);
carouselRef.current.scrollTo({ index });
}
}}
style={{
width: 10,
height: 10,
borderRadius: 5,
backgroundColor:
index === selectedIndex
? Palette.primary
: Palette.ultraLightWhite,
marginHorizontal: 5,
}}
animate={{
width: index === selectedIndex ? 20 : 10,
}}
/>
))}
</View>
);
};