react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

AgendaItems are not displayed

Open LordSuperKing opened this issue 2 years ago • 1 comments

Hello everyone, unfortunately I am very inexperienced and don't know what I am doing wrong. I wanted to try the ExpandableCalendarScreen example. The Calendar is displayed but not the AgendaItems.

import React, {useRef, useCallback} from 'react'; import {StyleSheet} from 'react-native'; import {ExpandableCalendar, AgendaList, CalendarProvider, WeekCalendar} from 'react-native-calendars'; import testIDs from '../mocks/testIDs'; import {agendaItems, getMarkedDates} from '../mocks/agendaItems'; import AgendaItem from '../mocks/AgendaItem'; import {getTheme, themeColor, lightThemeColor} from '../mocks/theme';

const leftArrowIcon = require('../img/previous.png'); const rightArrowIcon = require('../img/next.png'); const ITEMS: any[] = agendaItems;

interface Props { weekView?: boolean; }

const ExpandableCalendarScreen = (props: Props) => { const {weekView} = props; const marked = useRef(getMarkedDates()); const theme = useRef(getTheme()); const todayBtnTheme = useRef({ todayButtonTextColor: themeColor });

// const onDateChanged = useCallback((date, updateSource) => { // console.log('ExpandableCalendarScreen onDateChanged: ', date, updateSource); // }, []);

// const onMonthChange = useCallback(({dateString}) => { // console.log('ExpandableCalendarScreen onMonthChange: ', dateString); // }, []);

const renderItem = useCallback(({item}: any) => { return <AgendaItem item={item}/>; }, []);

return ( <CalendarProvider date={ITEMS[1]?.title} // onDateChanged={onDateChanged} // onMonthChange={onMonthChange} showTodayButton // disabledOpacity={0.6} theme={todayBtnTheme.current} // todayBottomMargin={16} > {weekView ? ( <WeekCalendar testID={testIDs.weekCalendar.CONTAINER} firstDay={1} markedDates={marked.current}/> ) : ( <ExpandableCalendar testID={testIDs.expandableCalendar.CONTAINER} // horizontal={false} // hideArrows // disablePan // hideKnob // initialPosition={ExpandableCalendar.positions.OPEN} // calendarStyle={styles.calendar} // headerStyle={styles.header} // for horizontal only // disableWeekScroll theme={theme.current} // disableAllTouchEventsForDisabledDays firstDay={1} markedDates={marked.current} leftArrowImageSource={leftArrowIcon} rightArrowImageSource={rightArrowIcon} // animateScroll // closeOnDayPress={false} /> )} <AgendaList sections={ITEMS} renderItem={renderItem} // scrollToNextEvent sectionStyle={styles.section} // dayFormat={'yyyy-MM-d'} /> </CalendarProvider> ); };

export default ExpandableCalendarScreen;

const styles = StyleSheet.create({ calendar: { paddingLeft: 20, paddingRight: 20 }, header: { backgroundColor: 'lightgrey' }, section: { backgroundColor: lightThemeColor, color: 'grey', textTransform: 'capitalize' } });

LordSuperKing avatar Feb 06 '24 13:02 LordSuperKing

same problem here

Zlvsky avatar Jul 23 '24 14:07 Zlvsky

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 31 '25 23:01 stale[bot]