react-native-calendar-timetable
react-native-calendar-timetable copied to clipboard
How can we access specific item by clicking on it
I want to show detail of specific item in modal when I click on specific item but onPress event of item is not working
If you want your cards to be pressable, you should create them as such. A modified example component from readme file would look like this:
export default function YourComponent({style, item, dayIndex, daysTotal}) {
const onPress = () => {
// do something with `item` given from props
};
return (
<TouchableOpacity
style={{
...style, // apply calculated styles, be careful not to override these accidentally (unless you know what you are doing)
backgroundColor: 'red',
borderRadius: 10,
elevation: 5,
}}
onPress={onPress}
>
<Text>{item.title}</Text>
<Text>{dayIndex} of {daysTotal}</Text>
</View>
);
}