Replace React.PropTypes with usage of the prop-types package

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-07-31 12:19:29 +01:00
parent 06bb18bda5
commit 1087e04bb5
16 changed files with 64 additions and 46 deletions

View file

@ -1,5 +1,6 @@
/*
Copyright 2017 Vector Creations Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -58,7 +59,7 @@ class MenuOption extends React.Component {
MenuOption.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(React.PropTypes.node),
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]),
highlighted: PropTypes.bool,

View file

@ -17,7 +17,8 @@ limitations under the License.
'use strict';
const React = require('react');
import React from 'react';
import PropTypes from 'prop-types';
const MatrixClientPeg = require('../../../MatrixClientPeg');
@ -30,19 +31,19 @@ import { _t } from '../../../languageHandler';
export default class ImageView extends React.Component {
static propTypes = {
src: React.PropTypes.string.isRequired, // the source of the image being displayed
name: React.PropTypes.string, // the main title ('name') for the image
link: React.PropTypes.string, // the link (if any) applied to the name of the image
width: React.PropTypes.number, // width of the image src in pixels
height: React.PropTypes.number, // height of the image src in pixels
fileSize: React.PropTypes.number, // size of the image src in bytes
onFinished: React.PropTypes.func.isRequired, // callback when the lightbox is dismissed
src: PropTypes.string.isRequired, // the source of the image being displayed
name: PropTypes.string, // the main title ('name') for the image
link: PropTypes.string, // the link (if any) applied to the name of the image
width: PropTypes.number, // width of the image src in pixels
height: PropTypes.number, // height of the image src in pixels
fileSize: PropTypes.number, // size of the image src in bytes
onFinished: PropTypes.func.isRequired, // callback when the lightbox is dismissed
// the event (if any) that the Image is displaying. Used for event-specific stuff like
// redactions, senders, timestamps etc. Other descriptors are taken from the explicit
// properties above, which let us use lightboxes to display images which aren't associated
// with events.
mxEvent: React.PropTypes.object,
mxEvent: PropTypes.object,
};
constructor(props) {

View file

@ -1,6 +1,7 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 New Vector Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -18,6 +19,7 @@ limitations under the License.
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import dis from '../../../dispatcher';
import classNames from 'classnames';
@ -28,15 +30,15 @@ module.exports = React.createClass({
propTypes: {
// Class applied to the element used to position the tooltip
className: React.PropTypes.string,
className: PropTypes.string,
// Class applied to the tooltip itself
tooltipClassName: React.PropTypes.string,
tooltipClassName: PropTypes.string,
// Whether the tooltip is visible or hidden.
// The hidden state allows animating the tooltip away via CSS.
// Defaults to visible if unset.
visible: React.PropTypes.bool,
visible: PropTypes.bool,
// the react element to put into the tooltip
label: React.PropTypes.node,
label: PropTypes.node,
},
getDefaultProps() {

View file

@ -25,7 +25,7 @@ module.exports = React.createClass({
propTypes: {
onChange: PropTypes.func,
selected_users: PropTypes.arrayOf(React.PropTypes.string),
selected_users: PropTypes.arrayOf(PropTypes.string),
},
getDefaultProps: function() {