canvas-rce: replace React.PropTypes with ‘prop-types’

Test plan:
* run `yarn dev`
* in the demo, open the browser console
* there should not be warnings about:
“Warning: Accessing PropTypes via the main React package is deprecated”

Change-Id: I8db12b82d6121a27cdae57d6a5f2bbd880468109
Reviewed-on: https://gerrit.instructure.com/149942
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
Ryan Shaw 2018-05-10 12:19:36 -06:00
parent 4482b444d7
commit d8659ee5c3
21 changed files with 78 additions and 40 deletions

View File

@ -123,6 +123,7 @@
"format-message-generate-id": "^5.1.0",
"instructure-icons": "3 || 4",
"isomorphic-fetch": "2.2.1",
"prop-types": "^15",
"react": "^0.14.8 || ^15.0.0",
"react-dom": "^0.14.8 || ^15.0.0",
"react-redux": "~4.4.5",

View File

@ -17,6 +17,7 @@
*/
import React, { Component } from "react";
import { number, string, shape, func } from "prop-types";
import { css } from "aphrodite";
import styles from "./styles";
import IconDocumentLine from "instructure-icons/lib/Line/IconDocumentLine";
@ -55,10 +56,10 @@ export default class File extends Component {
}
File.propTypes = {
file: React.PropTypes.shape({
id: React.PropTypes.number,
name: React.PropTypes.string,
type: React.PropTypes.string
file: shape({
id: number,
name: string,
type: string
}).isRequired,
onSelect: React.PropTypes.func
onSelect: func
};

View File

@ -16,6 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import PropTypes from "prop-types";
import React, { Component } from "react";
import File from "./File";
import Loading from "../Loading";
@ -95,19 +97,19 @@ export default class Folder extends Component {
}
}
const folderPropType = React.PropTypes.shape({
id: React.PropTypes.number,
name: React.PropTypes.string,
loading: React.PropTypes.bool,
fileIds: React.PropTypes.arrayOf(React.PropTypes.number),
folderIds: React.PropTypes.arrayOf(React.PropTypes.number)
const folderPropType = PropTypes.shape({
id: PropTypes.number,
name: PropTypes.string,
loading: PropTypes.bool,
fileIds: PropTypes.arrayOf(PropTypes.number),
folderIds: PropTypes.arrayOf(PropTypes.number)
});
Folder.propTypes = {
folders: React.PropTypes.objectOf(folderPropType),
files: React.PropTypes.objectOf(File.propTypes.file),
folders: PropTypes.objectOf(folderPropType),
files: PropTypes.objectOf(File.propTypes.file),
folder: folderPropType.isRequired,
onToggle: React.PropTypes.func,
onToggle: PropTypes.func,
onSelect: File.propTypes.onSelect
};

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import Folder from "./Folder";
import { css } from "aphrodite";
import styles from "./styles";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import Loading from "./Loading";
import formatMessage from "../../format-message";
import Button from "@instructure/ui-core/lib/components/Button";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import formatMessage from "../../format-message";
import ScreenReaderContent from "@instructure/ui-core/lib/components/ScreenReaderContent";
import { StyleSheet, css } from "aphrodite";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import RCEWrapper from "./RCEWrapper";
import tinyRCE from "./tinyRCE";
import normalizeProps from "./normalizeProps";

View File

@ -16,6 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import PropTypes from "prop-types";
import React from "react";
import ReactDOM from "react-dom";
import TinyMCE from "react-tinymce";
@ -282,13 +284,13 @@ export default class RCEWrapper extends React.Component {
}
RCEWrapper.propTypes = {
defaultContent: React.PropTypes.string,
language: React.PropTypes.string,
tinymce: React.PropTypes.object,
textareaId: React.PropTypes.string,
textareaClassName: React.PropTypes.string,
editorOptions: React.PropTypes.object,
onFocus: React.PropTypes.func,
onRemove: React.PropTypes.func,
handleUnmount: React.PropTypes.func
defaultContent: PropTypes.string,
language: PropTypes.string,
tinymce: PropTypes.object,
textareaId: PropTypes.string,
textareaClassName: PropTypes.string,
editorOptions: PropTypes.object,
onFocus: PropTypes.func,
onRemove: PropTypes.func,
handleUnmount: PropTypes.func
};

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import Checkbox from "@instructure/ui-core/lib/components/Checkbox";
import Container from "@instructure/ui-core/lib/components/Container";
import TextInput from "@instructure/ui-core/lib/components/TextInput";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import FileTree from "../../common/components/FileTree";
import formatMessage from "../../format-message";
import UploadForm from "./UploadForm";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import { renderImage as renderImageHtml } from "../../rce/contentRendering";
import dragHtml from "../dragHtml";
import ReactCSSTransitionGroup from "react-transition-group/CSSTransitionGroup";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import LoadMore from "../../common/components/LoadMore";
import UploadedImage from "./UploadedImage";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import formatMessage from "../../format-message";
import UploadForm from "./UploadForm";
import ImageUploadsList from "./ImageUploadsList";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import { renderLink as renderLinkHtml } from "../../rce/contentRendering";
import dragHtml from "../dragHtml";
import formatMessage from "../../format-message";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import ReactCSSTransitionGroup from "react-transition-group/CSSTransitionGroup";
import formatMessage from "../../format-message";
import Button from "@instructure/ui-core/lib/components/Button";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import TabList from "@instructure/ui-core/lib/components/TabList";
import TabPanel from "@instructure/ui-core/lib/components/TabList/TabPanel";
import LinkSet from "./LinkSet";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import LinkSet from "./LinkSet";
import formatMessage from "../../format-message";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import TabList from "@instructure/ui-core/lib/components/TabList";
import TabPanel from "@instructure/ui-core/lib/components/TabList/TabPanel";
import Tab from "@instructure/ui-core/lib/components/TabList/Tab";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import ReactCSSTransitionGroup from "react-transition-group/CSSTransitionGroup";
import formatMessage from "../../format-message";
import ScreenReaderContent from "@instructure/ui-core/lib/components/ScreenReaderContent";

View File

@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { Component, PropTypes } from "react";
import PropTypes from "prop-types";
import React, { Component } from "react";
import { renderImage as renderImageHtml } from "../../rce/contentRendering";
import dragHtml from "../dragHtml";
import formatMessage from "../../format-message";

View File

@ -5952,7 +5952,7 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"
prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.0:
prop-types@^15, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.0:
version "15.6.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca"
dependencies: