forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request react-bootstrap#1022 from AlexKVal/factoriesDeprec…
…ation Make deprecation warnings safe
- Loading branch information
Showing
3 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import React from 'react'; | ||
import warning from 'react/lib/warning'; | ||
import <%= name %> from '../<%= name %>'; | ||
|
||
console.warn('Support for factories will be removed in v0.25, for details see https://github.com/react-bootstrap/react-bootstrap/issues/825'); | ||
warning(false, 'Support for factories will be removed in v0.25, for details see https://github.com/react-bootstrap/react-bootstrap/issues/825'); | ||
|
||
export default React.createFactory(<%= name %>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
export default function deprecationWarning(oldname, newname, link) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if ((typeof console === 'undefined') || (typeof console.warn !== 'function')) { | ||
return; | ||
} | ||
import warning from 'react/lib/warning'; | ||
|
||
let message = `${oldname} is deprecated. Use ${newname} instead.`; | ||
console.warn(message); | ||
export default function deprecationWarning(oldname, newname, link) { | ||
let message = `${oldname} is deprecated. Use ${newname} instead.`; | ||
|
||
if (link) { | ||
console.warn(`You can read more about it at ${link}`); | ||
} | ||
if (link) { | ||
message += `\nYou can read more about it at ${link}`; | ||
} | ||
|
||
warning(false, message); | ||
} |