I have been experimenting with implementing react-native-calendar into my project. Here is the code snippet I am working on:
import React from 'react';
import {Calendar} from 'react-native-day-picker';
const MyCalendar = () => {
var from = new Date();
from.setDate(from.getDate() - 16);
var to = new Date();
var startDate = new Date();
startDate.setMonth(startDate.getMonth() + 1);
return (
<View style={styles.container}>
<Calendar
monthsCount={24}
startFromMonday={true}
startDate={startDate}
selectFrom={from}
selectTo={to}
width={350}
onSelectionChange={(current, previous) => {
console.log(current, previous);
}}
/>
</View>
);
};
export default MyCalendar;
However, I encountered a Syntax Error and my Project manager has specific requirements that do not align with the current styling approach as shown below:
class XXX extends XXXX {
constructor(...) {
}
render() { ... }
}
The challenge I am facing is initializing values like from, to, and startDate. How should I address this issue?