Files
hipmi-mobile/components/Scroll/ScrollCustom.tsx
Bagasbanuna02 f9e96aa077 Deskripsi:
Fix: event beranda dan status > tampilan
Feature: create event dan halaman detail status
Fix: Basebox: Hide safearea kalau ada tabs
Fix: TextCustom: Tambah size xlarge
Fix: ScrollCustom penambhan props value

# No Issue
2025-07-18 16:30:56 +08:00

62 lines
1.4 KiB
TypeScript

import { AccentColor, MainColor } from "@/constants/color-palet";
import React from "react";
import { ScrollView, StyleSheet } from "react-native";
import ButtonCustom from "../Button/ButtonCustom";
interface ButtonData {
id: string | number;
label: string;
value: string;
}
interface ScrollableCustomProps {
data: ButtonData[];
onButtonPress: (item: ButtonData) => void;
activeId?: string | number;
}
const ScrollableCustom = ({
data,
onButtonPress,
activeId,
}: ScrollableCustomProps) => {
return (
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
contentContainerStyle={styles.buttonContainer}
style={styles.scrollView}
>
{data.map((item) => {
const isActive = activeId === item.value;
return (
<ButtonCustom
key={item.id}
backgroundColor={isActive ? MainColor.yellow : AccentColor.blue}
textColor={isActive ? MainColor.black : MainColor.white}
onPress={() => onButtonPress(item)}
>
{item.label}
</ButtonCustom>
);
})}
</ScrollView>
);
};
export default ScrollableCustom;
const styles = StyleSheet.create({
scrollView: {
// maxHeight: 50,
},
buttonContainer: {
flexDirection: "row",
alignItems: "center",
// paddingHorizontal: 16,
// paddingVertical: 10,
gap: 12,
},
});