[英]How to fix error when working with Calendar Component of react-date-range
I am working with Calendar component of react-date-range but I have seen following error. 我正在使用react-date-range的 Calendar组件,但是看到以下错误。
This is simple code I using. 这是我使用的简单代码。
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { Calendar } from 'react-date-range';
export default class App extends Component {
handeeSelect(date) {
console.log(date);
}
render() {
return (
<View>
<Calendar
onInit={this.handeeSelect}
onChange={this.handeeSelect}
/>
</View>
);
}
}
How to fix it? 如何解决?
Edit: As mentioned in the comments, the issue revolved around the library in use. 编辑:如评论中所述,问题围绕使用中的库。 Either the linking to the Native code or the library was causing compatibility issues.
链接到本机代码或库导致兼容性问题。 Be sure to link libraries you add to native code when adding new ones.
添加新库时,请确保链接添加到本机代码的库。
I think you need to wrap the calendar component in a div
because React-Native View is weird and needs a child element. 我认为您需要将日历组件包装在
div
因为React-Native View很奇怪,并且需要一个子元素。
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { Calendar } from 'react-date-range';
export default class App extends Component {
handeeSelect(date) {
console.log(date);
}
render() {
return (
<View>
<div>
<Calendar onInit={this.handeeSelect} onChange={this.handeeSelect} />
</div>
</View>
);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.