-
-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
Using the minimally reproduced example, the log for "date" runs on onChange
(when clicking on a date), however, the "month" log doesnt run on onMonthChange
(when clicking on the month previous/next buttons)
import { View } from "react-native";
import { useState } from "react";
import DateTimePicker, {
DateType,
useDefaultStyles,
} from "react-native-ui-datepicker";
export default function HomeScreen() {
const defaultStyles = useDefaultStyles();
const [selected, setSelected] = useState<DateType>();
const [month, setMonth] = useState<number>(new Date().getMonth());
const onChange = ({ date }: { date: DateType }) => {
setSelected(date);
console.log("date", date);
};
const onMonthChange = (month: number) => {
setMonth(month);
console.log("month", month);
};
return (
<View style={{ flex: 1 }}>
<DateTimePicker
mode="single"
date={selected}
onChange={onChange}
styles={defaultStyles}
month={month}
onMonthChange={onMonthChange}
/>
</View>
);
}
florismettey, RajaaW, kevintersigni and Maxime-BARRY-SQLI
Metadata
Metadata
Assignees
Labels
No labels