We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On first render Calendar components render twice. This is due to a re-parse of current month made in a useEffect
Only one render when data do not change
The re-render can be fixed by applying this patch-package:
diff --git a/node_modules/react-native-calendars/src/calendar/index.js b/node_modules/react-native-calendars/src/calendar/index.js index 6f46e8a..45f0104 100644 --- a/node_modules/react-native-calendars/src/calendar/index.js +++ b/node_modules/react-native-calendars/src/calendar/index.js @@ -28,7 +28,10 @@ const Calendar = (props) => { const weekNumberMarking = useRef({ disabled: true, disableTouchEvent: true }); useEffect(() => { if (initialDate) { - setCurrentMonth(parseDate(initialDate)); + const parsed = parseDate(initialDate); + if (currentMonth.getTime() !== parsed.getTime()) { + setCurrentMonth(parseDate(initialDate)); + } } }, [initialDate]); useDidUpdate(() => {
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
On first render Calendar components render twice. This is due to a re-parse of current month made in a useEffect
Expected Behavior
Only one render when data do not change
Fix
The re-render can be fixed by applying this patch-package:
The text was updated successfully, but these errors were encountered: