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
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Migrate react-datetime to v3
2
2
3
-
A new decade has begun and a new mayor version of react-datetime is released. It's been some years since the first release of v2 and a lot has changed in the react ecosystem.
3
+
A new decade has begun and a new major version of react-datetime is released. It's been some years since the first release of v2 and a lot has changed in the react ecosystem.
4
4
5
5
In v3 we have updated the whole base code of react-datetime, catching up with the latest tools and practices. We can proudly say that this is the best performant, most customizable and easiest to understand version of the library so far. This version also makes the mantainance of react-datetime much simpler, this way we are ready to keep shipping new features and improvements.
6
6
@@ -23,20 +23,20 @@ It might seem to be working ok but [some props have changed](#whats-new-in-react
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
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`.
28
-
* Search for `disableCloseOnClickOutside`. If you are using it, replace it for`closeOnClickOutside={false}`.
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.
30
-
* Search for `onViewModeChange`. If you find it, rename it by`onNavigate`.
31
-
* Search for `Datetime.setView`. If you were using this imperative method, replace it by`Datetime.navigate`.
26
+
* Search for `defaultViewDate` props and replace them with`initialViewDate`.
27
+
* Search for`viewMode` props and replace them with`initialViewMode`.
28
+
* Search for `disableCloseOnClickOutside`. If you are using it, replace it with`closeOnClickOutside={false}`.
29
+
* Search for `<Datetime>` components using `onBlur` or `onFocus`. Replace those props with`onClose` or `onOpen`. `onOpen` doesn't receive any parameters anymore, so don't try to access to them.
30
+
* Search for `onViewModeChange`. If you find it, rename it to`onNavigate`.
31
+
* Search for `Datetime.setView`. If you were using this imperative method, replace it with`Datetime.navigate`.
32
32
33
33
Those are the main changes that might break your app, if you weren't able to find any of those, react-datetime v3 should keep working as usual in your project.
34
34
35
35
## What's new in react-datetime v3
36
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:
37
37
38
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`.
39
+
* The props that were used to set initial values, like `defaultValue`, `viewDate` or `viewMode` are renamed with the `initial` prefix to better express their intention. `initialValue`, `initialViewDate`, `initialViewMode`.
40
40
*`disableCloseOnClickOutside` prop is now `closeOnClickOutside` (avoid double negations).
41
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`.
0 commit comments