简体   繁体   中英

dayComponent in react-native-calendars not rendering : JDK issue?

I was working on a react-native project using expo cli, in which i need to display a calendar. I was using the dayComponent property of the calendar to apply stylings to specific days as per the requirement and it was working fine. However I recently moved to react-native cli due to compatibility issues with another library. Since then the dayComponent property is not executing at all. In the below code, even the console.log is not executed.

import React from 'react';
import { Calendar } from 'react-native-calendars';
const App = () =>  {
  return (
    <Calendar 
    dayComponent={(e)=>{
      console.log(e);
      return <View><Text>{e.date.day}</Text></View>;
    }}
    />
  )
};

export default App;

One thing that i can think of, is that I have installed the latest jdk version. Which required me to do the following

  1. add org.gradle.jvmargs=--add-opens java.base/java.io=ALL-UNNAMED to gradle.properties
  2. add jcenter() under allProjects repositories in build.gradle

Could the jdk version be the problem? or anything else?

it's the issue with the latest version of react-native-calendars, they have merged the PR to fix it about 1 hour before my answer. You can wait for new release or edit the version in package.json

from

"react-native-calendars": "^1.1274.0",

to

"react-native-calendars": "1.1274.0",

I assumed that you are using version 1.1274.0 like me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM