Skip to content

Commit fc867be

Browse files
committed
Updates migration document
1 parent 7b07f56 commit fc867be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

migrateToV3.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Once the update has finished, try your app.
2222
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.
2323

2424
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`.
2528
* Search for `disableCloseOnClickOutside`. If you are using it, replace it for `closeOnClickOutside={false}`.
2629
* 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.
2730
* 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
3336
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:
3437

3538
* 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`.
3640
* `disableCloseOnClickOutside` prop is now `closeOnClickOutside` (avoid double negations).
3741
* `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`.
3842
* Time is not updated anymore on right clicks.
3943
* The new prop `renderView` can be used to customize the whole calendar markup.
4044
* 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.
4245
* `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.
4347
* Two new imperative methods `setViewDate` and `navigate` methods allows to update the current view shown by the app.
4448
* Clicking on days from the previous or next month in the days view should work properly now.
4549
* Month, year and time views for locales that don't use gregorian numbers should work properly now.

0 commit comments

Comments
 (0)