react-native-calendars: Warning: Failed prop type: Invalid prop `current` of type `object` supplied to `CalendarListItem`, expected `string`

Agenda warning! I am getting two kinds of errors. one is related to ‘CanlendarList’ and the other is related to ‘CalendarListItem’ but I couldn’t figure out where the problem is. I would be glad if you help.

1. Warning:
Warning: Failed prop type: Invalid prop `current` of type `object` supplied to `CalendarListItem`, expected `string`
2. Warning:
Failed prop type: Invalid prop `current` of type `object` supplied to `CalendarList`, expected `string`.

import React, { useEffect, useState } from 'react' import { View, Text, TouchableOpacity } from 'react-native' import {Calendar, Agenda, LocaleConfig} from 'react-native-calendars'; import {Card} from "react-native-paper";

const Agenta = () => {

const [items, setItems] = useState({});
const loadItems = (day) => {
    setTimeout(() => {
      for (let i = -15; i < 85; i++) {
        const time = day.timestamp + i * 24 * 60 * 60 * 1000;
        const strTime = timeToString(time);
        if (!items[strTime]) {
          items[strTime] = [];
          const numItems = Math.floor(Math.random() * 3 + 1);
          for (let j = 0; j < numItems; j++) {
            items[strTime].push({
              name: 'Item for ' + strTime + ' #' + j,
              height: Math.max(50, Math.floor(Math.random() * 150)),
            });
          }
        }
      }
      const newItems = {};
      Object.keys(items).forEach((key) => {
        newItems[key] = items[key];
      });
      setItems(newItems);
    }, 1000);
  };

ss0

ss1

Environment

  • npm ls react-native-calendars: react-native-calendars@1.1274.0
  • npm ls react-native: react-native@0.63.2

I’m using EXPO

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16

Most upvoted comments

Updating the package to latest version solve the problem for me.