You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: migrateToV3.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@ Once the update has finished, try your app.
22
22
It might seem to be working ok but [some props have changed](#whats-new-in-react-datetime-v3) and, even if they don't break your app, your pickers might be behaving a little bit differently.
23
23
24
24
We should better search for the following props in our code and replace them as recommended in the points below:
25
+
* Search for `defaultValue` prop in your datetime code. Remame it to `initialValue`.
26
+
* Search for `defaultViewDate` props and replace them by `initialViewDate`.
27
+
* Search form `viewMode` props and replace them by `initialViewMode`.
25
28
* Search for `disableCloseOnClickOutside`. If you are using it, replace it for `closeOnClickOutside={false}`.
26
29
* Search for `<Datetime>` components using `onBlur` or `onFocus`. Replace those props by `onClose` or `onOpen`. `onOpen` doesn't receive any paramter anymore, so don't try to access to them.
27
30
* Search for `onViewModeChange`. If you find it, rename it by `onNavigate`.
@@ -33,13 +36,14 @@ Those are the main changes that might break your app, if you weren't able to fin
33
36
Version 3 is a big refactor of react-datetime. We have tried to not to change the API drastically, but some of the props has been renamed or removed, trying to make them clearer for the developer. A complete list of changes is:
34
37
35
38
* The props are read directly when possible, not deriving the state from them anymore.
39
+
* The props that were used to set initial values, like `defaultValue`, `viewDate` or `viewMode` are renamed with the `initial` prefix to express better their intention. `initialValue`, `initialViewDate`, `initialViewMode`.
36
40
*`disableCloseOnClickOutside` prop is now `closeOnClickOutside` (avoid double negations).
37
41
*`onBlur` and `onFocus` props are renamed to `onClose` and `onOpen` since they had nothing to do with the blur event and it was misleading for some users. If we want to listen to the input's `onBlur` and `onFocus` use `inputProps`.
38
42
* Time is not updated anymore on right clicks.
39
43
* The new prop `renderView` can be used to customize the whole calendar markup.
40
44
* The new prop `updateOnView` can be used to decide when to update the date.
41
-
* We can add a listener to new prop `onBeforeNavigate` in order to detect when the current view is going to change. We can use it to block the navigation or create custom navigation flows.
42
45
*`onViewModeChange` prop has been renamed to `onNavigate` when the current view has changed.
46
+
* We can add a listener to new prop `onBeforeNavigate` in order to detect when the current view is going to change. We can use it to block the navigation or create custom navigation flows.
43
47
* Two new imperative methods `setViewDate` and `navigate` methods allows to update the current view shown by the app.
44
48
* Clicking on days from the previous or next month in the days view should work properly now.
45
49
* Month, year and time views for locales that don't use gregorian numbers should work properly now.
0 commit comments