wix / react-native-calendars

React Native Calendar Components πŸ—“οΈ πŸ“†
MIT License
9.37k stars 2.91k forks source link

Items not rendering for Agenda #2373

Open ManolisDia opened 7 months ago

ManolisDia commented 7 months ago

Description

I am trying to create a basic Agenda component, I have a basic list of items, a View with an Agenda component in it and in that view I call that list of items

` import React from 'react'; import { View, Text, StyleSheet, } from 'react-native'; import { Agenda } from 'react-native-calendars';

const ShiftView = () => { // Customize the marked dates as needed

const leftArrowIcon = require('../assets/previous.png'); const rightArrowIcon = require('../assets/next.png');

const items = { '2023-06-25': [ { name: 'Meeting with Team', time: '10:00 AM - 11:30 AM', description: 'Discuss project updates' }, ], '2023-12-16': [ { name: 'Lunch with Client', time: '12:30 PM - 1:30 PM', description: 'Discuss upcoming features' }, { name: 'Project Review', time: '3:00 PM - 4:30 PM', description: 'Review project milestones' }, ], '2023-06-27': [ { name: 'Training Session', time: '2:00 PM - 4:00 PM', description: 'New technology introduction' }, ], };

return (

  <View>

    <View style={styles.container}>
      <Agenda
      item={items}

      />
    </View>

    <Text>Shift View</Text>
  </View>

); };

const styles = StyleSheet.create({ container: { flex: 1, }, });

export default ShiftView; `

Expected Behavior

I expect the items I am calling to appear in the agenda

Observed Behavior

A loading wheel that doesn't go away

No error

Environment

VSCode

Please run these commands in the project folder and fill in their results:

  1. Device/emulator/simulator & OS version: Expo Go on Pixel 7

Screenshots

Screenshot_20231216-224056

Screenshots or gifs of the issue and the suggested fix

will help us move faster with the review process.

SKhun commented 7 months ago

you needs to set renderItem props. try this again, for example.

      <Agenda
        style={{ width: "100%" }}
        // loadItemsForMonth={loadItems}
        items={items}
        renderItem={(item, firstItemInDay) => {
          return (
            <View style={{ height: item.height }}>
              <Text>{item.name}</Text>
            </View>
          );
        }}
      />
stale[bot] commented 3 months ago

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.