From 0db33bb45cae87734aa36891bff9e7716db8f8b6 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Wed, 30 Nov 2016 19:52:39 -0600 Subject: [PATCH] React propTypes as static class properties --- package.json | 1 + react/.eslintrc.js | 1 + react/features/app/components/AbstractApp.js | 30 ++--- react/features/app/components/App.native.js | 14 +-- react/features/app/components/App.web.js | 14 +-- .../media/components/AbstractVideoTrack.js | 36 +++--- .../base/media/components/native/Audio.js | 20 +-- .../base/media/components/native/Video.js | 74 +++++------ .../media/components/native/VideoTrack.js | 14 +-- .../react/components/AbstractContainer.js | 68 +++++----- .../base/react/components/Container.native.js | 13 +- .../base/react/components/Link.native.js | 52 ++++---- .../conference/components/Avatar.native.js | 29 +++-- .../components/Conference.native.js | 17 ++- .../components/ParticipantView.native.js | 116 +++++++++--------- .../filmStrip/components/FilmStrip.js | 20 +-- .../filmStrip/components/Thumbnail.js | 26 ++-- .../largeVideo/components/LargeVideo.js | 29 +++-- .../toolbar/components/AbstractToolbar.js | 24 ++-- .../components/AbstractToolbarButton.js | 48 ++++---- .../toolbar/components/Toolbar.native.js | 14 +-- .../components/ToolbarButton.native.js | 13 +- .../welcome/components/AbstractWelcomePage.js | 22 ++-- .../welcome/components/WelcomePage.native.js | 14 +-- 24 files changed, 352 insertions(+), 357 deletions(-) diff --git a/package.json b/package.json index 5a3087eb4..650860820 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ }, "devDependencies": { "babel-core": "*", + "babel-eslint": "^7.1.1", "babel-loader": "^6.2.8", "babel-polyfill": "*", "babel-preset-es2015": "^6.18.0", diff --git a/react/.eslintrc.js b/react/.eslintrc.js index c91e66d6c..55eaea6fd 100644 --- a/react/.eslintrc.js +++ b/react/.eslintrc.js @@ -4,6 +4,7 @@ module.exports = { 'commonjs': true, 'es6': true }, + 'parser': 'babel-eslint', 'parserOptions': { 'ecmaFeatures': { 'experimentalObjectRestSpread': true, diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js index e9b75f1a1..4d766a2a2 100644 --- a/react/features/app/components/AbstractApp.js +++ b/react/features/app/components/AbstractApp.js @@ -29,6 +29,21 @@ const DEFAULT_CONFIG = { * @abstract */ export class AbstractApp extends Component { + /** + * AbstractApp component's property types. + * + * @static + */ + static propTypes = { + config: React.PropTypes.object, + store: React.PropTypes.object, + + /** + * The URL, if any, with which the app was launched. + */ + url: React.PropTypes.string + } + /** * Init lib-jitsi-meet and create local participant when component is going * to be mounted. @@ -113,18 +128,3 @@ export class AbstractApp extends Component { this.props.store.dispatch(appNavigate(url)); } } - -/** - * AbstractApp component's property types. - * - * @static - */ -AbstractApp.propTypes = { - config: React.PropTypes.object, - store: React.PropTypes.object, - - /** - * The URL, if any, with which the app was launched. - */ - url: React.PropTypes.string -}; diff --git a/react/features/app/components/App.native.js b/react/features/app/components/App.native.js index d9b68b542..acc22895d 100644 --- a/react/features/app/components/App.native.js +++ b/react/features/app/components/App.native.js @@ -11,6 +11,13 @@ import { AbstractApp } from './AbstractApp'; * @extends AbstractApp */ export class App extends AbstractApp { + /** + * App component's property types. + * + * @static + */ + static propTypes = AbstractApp.propTypes + /** * Initializes a new App instance. * @@ -126,10 +133,3 @@ export class App extends AbstractApp { this._openURL(event.url); } } - -/** - * App component's property types. - * - * @static - */ -App.propTypes = AbstractApp.propTypes; diff --git a/react/features/app/components/App.web.js b/react/features/app/components/App.web.js index 63c0cd1f0..7afd2e46a 100644 --- a/react/features/app/components/App.web.js +++ b/react/features/app/components/App.web.js @@ -18,6 +18,13 @@ import { AbstractApp } from './AbstractApp'; * @extends AbstractApp */ export class App extends AbstractApp { + /** + * App component's property types. + * + * @static + */ + static propTypes = AbstractApp.propTypes + /** * Initializes a new App instance. * @@ -148,10 +155,3 @@ export class App extends AbstractApp { return this._createElement(component, props); } } - -/** - * App component's property types. - * - * @static - */ -App.propTypes = AbstractApp.propTypes; diff --git a/react/features/base/media/components/AbstractVideoTrack.js b/react/features/base/media/components/AbstractVideoTrack.js index adeac2698..bd640912d 100644 --- a/react/features/base/media/components/AbstractVideoTrack.js +++ b/react/features/base/media/components/AbstractVideoTrack.js @@ -11,6 +11,24 @@ import { Video } from './_'; * @abstract */ export class AbstractVideoTrack extends Component { + /** + * AbstractVideoTrack component's property types. + * + * @static + */ + static propTypes = { + dispatch: React.PropTypes.func, + videoTrack: React.PropTypes.object, + waitForVideoStarted: React.PropTypes.bool, + + /** + * The z-order of the Video of AbstractVideoTrack in the stacking space + * of all Videos. For more details, refer to the zOrder property of the + * Video class for React Native. + */ + zOrder: React.PropTypes.number + } + /** * Initializes a new AbstractVideoTrack instance. * @@ -116,24 +134,6 @@ export class AbstractVideoTrack extends Component { } } -/** - * AbstractVideoTrack component's property types. - * - * @static - */ -AbstractVideoTrack.propTypes = { - dispatch: React.PropTypes.func, - videoTrack: React.PropTypes.object, - waitForVideoStarted: React.PropTypes.bool, - - /** - * The z-order of the Video of AbstractVideoTrack in the stacking space of - * all Videos. For more details, refer to the zOrder property of the Video - * class for React Native. - */ - zOrder: React.PropTypes.number -}; - /** * Returns null if a specific value is falsy; otherwise, returns the specified * value. diff --git a/react/features/base/media/components/native/Audio.js b/react/features/base/media/components/native/Audio.js index 216b98151..6e99c15d7 100644 --- a/react/features/base/media/components/native/Audio.js +++ b/react/features/base/media/components/native/Audio.js @@ -5,6 +5,16 @@ import React, { Component } from 'react'; * around react-native-webrtc's RTCView. */ export class Audio extends Component { + /** + * Audio component's property types. + * + * @static + */ + static propTypes = { + muted: React.PropTypes.bool, + stream: React.PropTypes.object + } + /** * Implements React's {@link Component#render()}. * @@ -18,13 +28,3 @@ export class Audio extends Component { return null; } } - -/** - * Audio component's property types. - * - * @static - */ -Audio.propTypes = { - muted: React.PropTypes.bool, - stream: React.PropTypes.object -}; diff --git a/react/features/base/media/components/native/Video.js b/react/features/base/media/components/native/Video.js index d7ab3a124..290bd99c0 100644 --- a/react/features/base/media/components/native/Video.js +++ b/react/features/base/media/components/native/Video.js @@ -18,6 +18,43 @@ const RTCVIEW_SUPPORTS_MIRROR = Platform.OS === 'android'; * around react-native-webrtc's RTCView. */ export class Video extends Component { + /** + * Video component's property types. + * + * @static + */ + static propTypes = { + mirror: React.PropTypes.bool, + muted: React.PropTypes.bool, + onPlaying: React.PropTypes.func, + stream: React.PropTypes.object, + + /** + * Similarly to the CSS property z-index, specifies the z-order of this + * Video in the stacking space of all Videos. When Videos overlap, + * zOrder determines which one covers the other. A Video with a larger + * zOrder generally covers a Video with a lower one. + * + * Non-overlapping Videos may safely share a z-order (because one does + * not have to cover the other). + * + * The support for zOrder is platform-dependent and/or + * implementation-specific. Thus, specifying a value for zOrder is to be + * thought of as giving a hint rather than as imposing a requirement. + * For example, video renderers such as Video are commonly implemented + * using OpenGL and OpenGL views may have different numbers of layers in + * their stacking space. Android has three: a layer bellow the window + * (aka default), a layer bellow the window again but above the previous + * layer (aka media overlay), and above the window. Consequently, it is + * advisable to limit the number of utilized layers in the stacking + * space to the minimum sufficient for the desired display. For example, + * a video call application usually needs a maximum of two zOrder + * values: 0 for the remote video(s) which appear in the background, and + * 1 for the local video(s) which appear above the remote video(s). + */ + zOrder: React.PropTypes.number + } + /** * React Component method that executes once component is mounted. * @@ -86,40 +123,3 @@ export class Video extends Component { return null; } } - -/** - * Video component's property types. - * - * @static - */ -Video.propTypes = { - mirror: React.PropTypes.bool, - muted: React.PropTypes.bool, - onPlaying: React.PropTypes.func, - stream: React.PropTypes.object, - - /** - * Similarly to the CSS property z-index, specifies the z-order of this - * Video in the stacking space of all Videos. When Videos overlap, zOrder - * determines which one covers the other. A Video with a larger zOrder - * generally covers a Video with a lower one. - * - * Non-overlapping Videos may safely share a z-order (because one does not - * have to cover the other). - * - * The support for zOrder is platform-dependent and/or - * implementation-specific. Thus, specifying a value for zOrder is to be - * thought of as giving a hint rather than as imposing a requirement. For - * example, video renderers such as Video are commonly implemented using - * OpenGL and OpenGL views may have different numbers of layers in their - * stacking space. Android has three: a layer bellow the window (aka - * default), a layer bellow the window again but above the previous layer - * (aka media overlay), and above the window. Consequently, it is advisable - * to limit the number of utilized layers in the stacking space to the - * minimum sufficient for the desired display. For example, a video call - * application usually needs a maximum of two zOrder values: 0 for the - * remote video(s) which appear in the background, and 1 for the local - * video(s) which appear above the remote video(s). - */ - zOrder: React.PropTypes.number -}; diff --git a/react/features/base/media/components/native/VideoTrack.js b/react/features/base/media/components/native/VideoTrack.js index 30b580e55..bdad9f1e4 100644 --- a/react/features/base/media/components/native/VideoTrack.js +++ b/react/features/base/media/components/native/VideoTrack.js @@ -11,6 +11,13 @@ import { styles } from './styles'; * @extends AbstractVideoTrack */ class VideoTrack extends AbstractVideoTrack { + /** + * VideoTrack component's property types. + * + * @static + */ + static propTypes = AbstractVideoTrack.propTypes + /** * Initializes a new VideoTrack instance. * @@ -153,11 +160,4 @@ class VideoTrack extends AbstractVideoTrack { } } -/** - * VideoTrack component's property types. - * - * @static - */ -VideoTrack.propTypes = AbstractVideoTrack.propTypes; - export default connect()(VideoTrack); diff --git a/react/features/base/react/components/AbstractContainer.js b/react/features/base/react/components/AbstractContainer.js index d248104b4..f718fc3a8 100644 --- a/react/features/base/react/components/AbstractContainer.js +++ b/react/features/base/react/components/AbstractContainer.js @@ -6,6 +6,40 @@ import React, { Component } from 'react'; * @extends Component */ export default class AbstractContainer extends Component { + /** + * AbstractContainer component's property types. + * + * @static + */ + static propTypes = { + children: React.PropTypes.node, + + /** + * The event handler/listener to be invoked when this AbstractContainer + * is clicked on Web or pressed on React Native. If onClick is defined + * and touchFeedback is undefined, touchFeedback is considered defined + * as true. + */ + onClick: React.PropTypes.func, + + /** + * The style (as in stylesheet) to be applied to this AbstractContainer. + */ + style: React.PropTypes.object, + + /** + * True if this instance is to provide visual feedback when touched; + * otherwise, false. If touchFeedback is undefined and onClick is + * defined, touchFeedback is considered defined as true. + */ + touchFeedback: React.PropTypes.bool, + + /** + * True if this AbstractContainer is to be visible or false if this + * instance is to be hidden or not rendered at all. + */ + visible: React.PropTypes.bool + } /** * Renders this AbstractContainer as a React Component of a specific type. @@ -38,37 +72,3 @@ export default class AbstractContainer extends Component { return React.createElement(type, filteredProps, children); } } - -/** - * AbstractContainer component's property types. - * - * @static - */ -AbstractContainer.propTypes = { - children: React.PropTypes.node, - - /** - * The event handler/listener to be invoked when this AbstractContainer is - * clicked on Web or pressed on React Native. If onClick is defined and - * touchFeedback is undefined, touchFeedback is considered defined as true. - */ - onClick: React.PropTypes.func, - - /** - * The style (as in stylesheet) to be applied to this AbstractContainer. - */ - style: React.PropTypes.object, - - /** - * True if this instance is to provide visual feedback when touched; - * otherwise, false. If touchFeedback is undefined and onClick is defined, - * touchFeedback is considered defined as true. - */ - touchFeedback: React.PropTypes.bool, - - /** - * True if this AbstractContainer is to be visible or false if this instance - * is to be hidden or not rendered at all. - */ - visible: React.PropTypes.bool -}; diff --git a/react/features/base/react/components/Container.native.js b/react/features/base/react/components/Container.native.js index b99e81150..10f49e1f6 100644 --- a/react/features/base/react/components/Container.native.js +++ b/react/features/base/react/components/Container.native.js @@ -14,6 +14,12 @@ import AbstractContainer from './AbstractContainer'; * @extends AbstractContainer */ export class Container extends AbstractContainer { + /** + * Container component's property types. + * + * @static + */ + static propTypes = AbstractContainer.propTypes /** * Implements React's {@link Component#render()}. @@ -74,10 +80,3 @@ export class Container extends AbstractContainer { return component; } } - -/** - * Container component's property types. - * - * @static - */ -Container.propTypes = AbstractContainer.propTypes; diff --git a/react/features/base/react/components/Link.native.js b/react/features/base/react/components/Link.native.js index b6f636eea..18c1e73a0 100644 --- a/react/features/base/react/components/Link.native.js +++ b/react/features/base/react/components/Link.native.js @@ -6,6 +6,33 @@ import { Linking, Text } from 'react-native'; * and its href attribute. */ export class Link extends Component { + /** + * Link component's property types. + * + * @static + */ + static propTypes = { + /** + * The children to be displayed within this Link. + */ + children: React.PropTypes.node, + + /** + * Notifies that this Link failed to open the URL associated with it. + */ + onLinkingOpenURLRejected: React.PropTypes.func, + + /** + * The CSS style to be applied to this Link for the purposes of display. + */ + style: React.PropTypes.object, + + /** + * The URL to be opened when this Link is clicked/pressed. + */ + url: React.PropTypes.string + } + /** * Initializes a new Link instance. * @@ -60,28 +87,3 @@ export class Link extends Component { .catch(reason => this._onLinkingOpenURLRejected(reason)); } } - -/** - * Link component's property types. - */ -Link.propTypes = { - /** - * The children to be displayed within this Link. - */ - children: React.PropTypes.node, - - /** - * Notifies that this Link failed to open the URL associated with it. - */ - onLinkingOpenURLRejected: React.PropTypes.func, - - /** - * The CSS style to be applied to this Link for the purposes of display. - */ - style: React.PropTypes.object, - - /** - * The URL to be opened when this Link is clicked/pressed. - */ - url: React.PropTypes.string -}; diff --git a/react/features/conference/components/Avatar.native.js b/react/features/conference/components/Avatar.native.js index 2bec1495f..9daa4f136 100644 --- a/react/features/conference/components/Avatar.native.js +++ b/react/features/conference/components/Avatar.native.js @@ -7,6 +7,20 @@ import { styles } from './styles'; * Display a participant avatar. */ export default class Avatar extends Component { + /** + * Avatar component's property types. + * + * @static + */ + static propTypes = { + /** + * The optional style to add to an Avatar in order to customize its base + * look (and feel). + */ + style: React.PropTypes.object, + uri: React.PropTypes.string + } + /** * Implements React's {@link Component#render()}. * @@ -23,18 +37,3 @@ export default class Avatar extends Component { ); } } - -/** - * Avatar component's property types. - * - * @static - */ -Avatar.propTypes = { - - /** - * The optional style to add to an Avatar in order to customize its base - * look (and feel). - */ - style: React.PropTypes.object, - uri: React.PropTypes.string -}; diff --git a/react/features/conference/components/Conference.native.js b/react/features/conference/components/Conference.native.js index 31ef1b2be..2353788b2 100644 --- a/react/features/conference/components/Conference.native.js +++ b/react/features/conference/components/Conference.native.js @@ -21,6 +21,14 @@ const TOOLBAR_TIMEOUT_MS = 5000; * The conference page of the application. */ class Conference extends Component { + /** + * Conference component's property types. + * + * @static + */ + static propTypes = { + dispatch: React.PropTypes.func + } /** * Initializes a new Conference instance. @@ -125,13 +133,4 @@ class Conference extends Component { } } -/** - * Conference component's property types. - * - * @static - */ -Conference.propTypes = { - dispatch: React.PropTypes.func -}; - export default reactReduxConnect()(Conference); diff --git a/react/features/conference/components/ParticipantView.native.js b/react/features/conference/components/ParticipantView.native.js index bd94d253c..84551b008 100644 --- a/react/features/conference/components/ParticipantView.native.js +++ b/react/features/conference/components/ParticipantView.native.js @@ -20,6 +20,63 @@ import { styles } from './styles'; * @extends Component */ class ParticipantView extends Component { + /** + * ParticipantView component's property types. + * + * @static + */ + static propTypes = { + /** + * The source (e.g. URI, URL) of the avatar image of the participant + * with {@link #participantId}. + * + * @private + */ + _avatar: React.PropTypes.string, + + /** + * The video Track of the participant with {@link #participantId}. + */ + _videoTrack: React.PropTypes.object, + + /** + * The style, if any, of the avatar in addition to the default style. + */ + avatarStyle: React.PropTypes.object, + + /** + * The ID of the participant (to be) depicted by ParticipantView. + * + * @public + */ + participantId: React.PropTypes.string, + + /** + * True if the avatar of the depicted participant is to be shown should + * the avatar be available and the video of the participant is not to be + * shown; otherwise, false. If undefined, defaults to true. + */ + showAvatar: React.PropTypes.bool, + + /** + * True if the video of the depicted participant is to be shown should + * the video be available. If undefined, defaults to true. + */ + showVideo: React.PropTypes.bool, + + /** + * The style, if any, to apply to ParticipantView in addition to its + * default style. + */ + style: React.PropTypes.object, + + /** + * The z-order of the Video of ParticipantView in the stacking space of + * all Videos. For more details, refer to the zOrder property of the + * Video class for React Native. + */ + zOrder: React.PropTypes.number + } /** * Implements React's {@link Component#render()}. @@ -77,65 +134,6 @@ class ParticipantView extends Component { } } -/** - * ParticipantView component's property types. - * - * @static - */ -ParticipantView.propTypes = { - - /** - * The source (e.g. URI, URL) of the avatar image of the participant with - * {@link #participantId}. - * - * @private - */ - _avatar: React.PropTypes.string, - - /** - * The video Track of the participant with {@link #participantId}. - */ - _videoTrack: React.PropTypes.object, - - /** - * The style, if any, of the avatar in addition to the default style. - */ - avatarStyle: React.PropTypes.object, - - /** - * The ID of the participant (to be) depicted by ParticipantView. - * - * @public - */ - participantId: React.PropTypes.string, - - /** - * True if the avatar of the depicted participant is to be shown should the - * avatar be available and the video of the participant is not to be shown; - * otherwise, false. If undefined, defaults to true. - */ - showAvatar: React.PropTypes.bool, - - /** - * True if the video of the depicted participant is to be shown should the - * video be available. If undefined, defaults to true. - */ - showVideo: React.PropTypes.bool, - - /** - * The style, if any, to apply to ParticipantView in addition to its default - * style. - */ - style: React.PropTypes.object, - - /** - * The z-order of the Video of ParticipantView in the stacking space of all - * Videos. For more details, refer to the zOrder property of the Video class - * for React Native. - */ - zOrder: React.PropTypes.number -}; - /** * Converts the specified value to a boolean value. If the specified value is * undefined, returns the boolean value of undefinedValue. diff --git a/react/features/filmStrip/components/FilmStrip.js b/react/features/filmStrip/components/FilmStrip.js index 204708ee9..df94a0035 100644 --- a/react/features/filmStrip/components/FilmStrip.js +++ b/react/features/filmStrip/components/FilmStrip.js @@ -13,6 +13,16 @@ import { styles } from './_'; * @extends Component */ class FilmStrip extends Component { + /** + * FilmStrip component's property types. + * + * @static + */ + static propTypes = { + participants: React.PropTypes.array, + visible: React.PropTypes.bool.isRequired + } + /** * Implements React's {@link Component#render()}. * @@ -79,16 +89,6 @@ class FilmStrip extends Component { } } -/** - * FilmStrip component's property types. - * - * @static - */ -FilmStrip.propTypes = { - participants: React.PropTypes.array, - visible: React.PropTypes.bool.isRequired -}; - /** * Function that maps parts of Redux state tree into component props. * diff --git a/react/features/filmStrip/components/Thumbnail.js b/react/features/filmStrip/components/Thumbnail.js index b3ff1a8c1..fb39eb521 100644 --- a/react/features/filmStrip/components/Thumbnail.js +++ b/react/features/filmStrip/components/Thumbnail.js @@ -26,6 +26,19 @@ import { * @extends Component */ class Thumbnail extends Component { + /** + * Thumbnail component's property types. + * + * @static + */ + static propTypes = { + audioTrack: React.PropTypes.object, + dispatch: React.PropTypes.func, + largeVideo: React.PropTypes.object, + participant: React.PropTypes.object, + videoTrack: React.PropTypes.object + } + /** * Initializes new Video Thumbnail component. * @@ -119,19 +132,6 @@ class Thumbnail extends Component { } } -/** - * Thumbnail component's property types. - * - * @static - */ -Thumbnail.propTypes = { - audioTrack: React.PropTypes.object, - dispatch: React.PropTypes.func, - largeVideo: React.PropTypes.object, - participant: React.PropTypes.object, - videoTrack: React.PropTypes.object -}; - /** * Function that maps parts of Redux state tree into component props. * diff --git a/react/features/largeVideo/components/LargeVideo.js b/react/features/largeVideo/components/LargeVideo.js index f966980db..2a3e57c1c 100644 --- a/react/features/largeVideo/components/LargeVideo.js +++ b/react/features/largeVideo/components/LargeVideo.js @@ -11,6 +11,20 @@ import { styles } from './styles'; * @extends Component */ class LargeVideo extends Component { + /** + * LargeVideo component's property types. + * + * @static + */ + static propTypes = { + /** + * The ID of the participant (to be) depicted by LargeVideo. + * + * @private + */ + _participantId: React.PropTypes.string + } + /** * Implements React's {@link Component#render()}. * @@ -28,21 +42,6 @@ class LargeVideo extends Component { } } -/** - * LargeVideo component's property types. - * - * @static - */ -LargeVideo.propTypes = { - - /** - * The ID of the participant (to be) depicted by LargeVideo. - * - * @private - */ - _participantId: React.PropTypes.string -}; - /** * Maps (parts of) the Redux state to the associated LargeVideo's props. * diff --git a/react/features/toolbar/components/AbstractToolbar.js b/react/features/toolbar/components/AbstractToolbar.js index 74635affa..7ced24a57 100644 --- a/react/features/toolbar/components/AbstractToolbar.js +++ b/react/features/toolbar/components/AbstractToolbar.js @@ -15,6 +15,18 @@ import { styles } from './styles'; * @abstract */ export class AbstractToolbar extends Component { + /** + * AbstractToolbar component's property types. + * + * @static + */ + static propTypes = { + audioMuted: React.PropTypes.bool, + dispatch: React.PropTypes.func, + videoMuted: React.PropTypes.bool, + visible: React.PropTypes.bool.isRequired + } + /** * Initializes a new AbstractToolbar instance. * @@ -104,18 +116,6 @@ export class AbstractToolbar extends Component { } } -/** - * AbstractToolbar component's property types. - * - * @static - */ -AbstractToolbar.propTypes = { - audioMuted: React.PropTypes.bool, - dispatch: React.PropTypes.func, - videoMuted: React.PropTypes.bool, - visible: React.PropTypes.bool.isRequired -}; - /** * Maps parts of media state to component props. * diff --git a/react/features/toolbar/components/AbstractToolbarButton.js b/react/features/toolbar/components/AbstractToolbarButton.js index 1ca4433ab..f6d17f5d7 100644 --- a/react/features/toolbar/components/AbstractToolbarButton.js +++ b/react/features/toolbar/components/AbstractToolbarButton.js @@ -6,6 +6,29 @@ import React, { Component } from 'react'; * @abstract */ export default class AbstractToolbarButton extends Component { + /** + * AbstractToolbarButton component's property types. + * + * @static + */ + static propTypes = { + /** + * The name of the Icon of this AbstractToolbarButton. + */ + iconName: React.PropTypes.string, + + /** + * The style of the Icon of this AbstractToolbarButton. + */ + iconStyle: React.PropTypes.object, + onClick: React.PropTypes.func, + style: + React.PropTypes.oneOfType([ + React.PropTypes.array, + React.PropTypes.object + ]), + underlayColor: React.PropTypes.any + } /** * Implements React's {@link Component#render()}. @@ -34,28 +57,3 @@ export default class AbstractToolbarButton extends Component { return React.createElement(type, props); } } - -/** - * AbstractToolbarButton component's property types. - * - * @static - */ -AbstractToolbarButton.propTypes = { - - /** - * The name of the Icon of this AbstractToolbarButton. - */ - iconName: React.PropTypes.string, - - /** - * The style of the Icon of this AbstractToolbarButton. - */ - iconStyle: React.PropTypes.object, - onClick: React.PropTypes.func, - style: - React.PropTypes.oneOfType([ - React.PropTypes.array, - React.PropTypes.object - ]), - underlayColor: React.PropTypes.any -}; diff --git a/react/features/toolbar/components/Toolbar.native.js b/react/features/toolbar/components/Toolbar.native.js index 04021fd9b..a2ac08875 100644 --- a/react/features/toolbar/components/Toolbar.native.js +++ b/react/features/toolbar/components/Toolbar.native.js @@ -22,6 +22,13 @@ import ToolbarButton from './ToolbarButton'; * @extends AbstractToolbar */ class Toolbar extends AbstractToolbar { + /** + * Toolbar component's property types. + * + * @static + */ + static propTypes = AbstractToolbar.propTypes + /** * Initializes a new Toolbar instance. * @@ -116,11 +123,4 @@ Object.assign(Toolbar.prototype, { videoMutedIcon: 'camera-disabled' }); -/** - * Toolbar component's property types. - * - * @static - */ -Toolbar.propTypes = AbstractToolbar.propTypes; - export default connect(mapStateToProps)(Toolbar); diff --git a/react/features/toolbar/components/ToolbarButton.native.js b/react/features/toolbar/components/ToolbarButton.native.js index 41aa66e7e..370e32b54 100644 --- a/react/features/toolbar/components/ToolbarButton.native.js +++ b/react/features/toolbar/components/ToolbarButton.native.js @@ -11,6 +11,12 @@ import AbstractToolbarButton from './AbstractToolbarButton'; * @extends AbstractToolbarButton */ export default class ToolbarButton extends AbstractToolbarButton { + /** + * ToolbarButton component's property types. + * + * @static + */ + static propTypes = AbstractToolbarButton.propTypes /** * Renders the button of this Toolbar button. @@ -39,10 +45,3 @@ export default class ToolbarButton extends AbstractToolbarButton { return super._renderIcon(Icon); } } - -/** - * ToolbarButton component's property types. - * - * @static - */ -ToolbarButton.propTypes = AbstractToolbarButton.propTypes; diff --git a/react/features/welcome/components/AbstractWelcomePage.js b/react/features/welcome/components/AbstractWelcomePage.js index c77da3ba6..02ace1ba0 100644 --- a/react/features/welcome/components/AbstractWelcomePage.js +++ b/react/features/welcome/components/AbstractWelcomePage.js @@ -11,6 +11,17 @@ import { getLocalVideoTrack } from '../../base/tracks'; * @abstract */ export class AbstractWelcomePage extends Component { + /** + * AbstractWelcomePage component's property types. + * + * @static + */ + static propTypes = { + dispatch: React.PropTypes.func, + localVideoTrack: React.PropTypes.object, + room: React.PropTypes.string + } + /** * Initializes a new AbstractWelcomePage instance, including the initial * state of the room name input. @@ -91,17 +102,6 @@ export class AbstractWelcomePage extends Component { } } -/** - * AbstractWelcomePage component's property types. - * - * @static - */ -AbstractWelcomePage.propTypes = { - dispatch: React.PropTypes.func, - localVideoTrack: React.PropTypes.object, - room: React.PropTypes.string -}; - /** * Selects local video track from tracks in state, local participant and room * and maps them to component props. It seems it's not possible to 'connect' diff --git a/react/features/welcome/components/WelcomePage.native.js b/react/features/welcome/components/WelcomePage.native.js index 07c57a881..a74dbccb9 100644 --- a/react/features/welcome/components/WelcomePage.native.js +++ b/react/features/welcome/components/WelcomePage.native.js @@ -25,6 +25,13 @@ const TERMS_OF_SERVICE_URL * @extends AbstractWelcomePage */ class WelcomePage extends AbstractWelcomePage { + /** + * WelcomePage component's property types. + * + * @static + */ + static propTypes = AbstractWelcomePage.propTypes + /** * Renders a prompt for entering a room name. * @@ -90,11 +97,4 @@ class WelcomePage extends AbstractWelcomePage { } } -/** - * WelcomePage component's property types. - * - * @static - */ -WelcomePage.propTypes = AbstractWelcomePage.propTypes; - export default connect(mapStateToProps)(WelcomePage);