From dc037bc8dd4e651915dc25f4f141aebbe7b32766 Mon Sep 17 00:00:00 2001 From: Robert Pintilii Date: Tue, 9 May 2023 12:10:46 +0300 Subject: [PATCH] ref(TS) Convert some native components to TS (#13307) --- package-lock.json | 19 +++ package.json | 1 + react/features/base/conference/reducer.ts | 1 + react/features/base/config/configType.ts | 2 + ...nnectionInfo.js => TestConnectionInfo.tsx} | 45 +++---- .../base/testing/components/TestHint.web.ts | 3 + .../AbstractInsecureRoomNameLabel.tsx | 8 +- .../{AlwaysOnLabels.js => AlwaysOnLabels.tsx} | 8 +- .../native/{Conference.js => Conference.tsx} | 110 +++++++++--------- ...edLabelPopup.js => ExpandedLabelPopup.tsx} | 15 ++- ...el.js => InsecureRoomNameExpandedLabel.ts} | 8 +- ...NameLabel.js => InsecureRoomNameLabel.tsx} | 5 +- .../native/{Labels.js => Labels.tsx} | 10 +- ...el.js => RaisedHandsCountExpandedLabel.ts} | 8 +- ...ountLabel.js => RaisedHandsCountLabel.tsx} | 9 +- .../native/{TitleBar.js => TitleBar.tsx} | 44 ++++--- .../components/native/carmode/CarMode.tsx | 1 - .../native/carmode/SoundDeviceButton.tsx | 2 - .../components/native/carmode/TitleBar.tsx | 2 - .../native/{constants.js => constants.ts} | 24 +++- .../filmstrip/components/native/Filmstrip.tsx | 2 +- react/features/filmstrip/functions.native.ts | 2 +- ...leButton.js => AudioDeviceToggleButton.ts} | 11 +- ...erDialog.js => AudioRoutePickerDialog.tsx} | 83 ++++++------- .../components/{styles.js => styles.ts} | 2 - .../audio-mode/{logger.js => logger.ts} | 2 - .../{middleware.js => middleware.ts} | 18 +-- react/features/mobile/audio-mode/reducer.ts | 7 +- .../background/{actions.js => actions.ts} | 4 +- ...dleware.native.js => middleware.native.ts} | 9 +- .../mobile/background/middleware.web.js | 0 react/features/mobile/background/reducer.ts | 4 +- .../{CallKit.js => CallKit.ts} | 4 +- ...nectionService.js => ConnectionService.ts} | 2 +- .../{functions.js => functions.ts} | 5 +- .../{middleware.js => middleware.ts} | 39 ++++--- .../external-api/{logger.js => logger.ts} | 2 - .../{middleware.js => middleware.ts} | 55 +++++---- .../full-screen/{actions.js => actions.ts} | 4 +- .../{middleware.js => middleware.ts} | 9 +- ...tainer.js => LobbyNavigationContainer.tsx} | 5 +- .../welcome/{functions.js => functions.tsx} | 6 +- .../{middleware.js => middleware.ts} | 8 +- .../{middleware.js => middleware.ts} | 4 +- .../{actions.js => actions.ts} | 8 +- ...ureButton.js => PictureInPictureButton.ts} | 20 ++-- .../{logger.js => logger.ts} | 2 - .../{middleware.js => middleware.ts} | 2 +- .../{middleware.js => middleware.ts} | 2 +- .../mobile/watchos/{actions.js => actions.ts} | 2 - .../mobile/watchos/{logger.js => logger.ts} | 2 - .../watchos/{middleware.js => middleware.ts} | 16 +-- .../components/AbstractRecentList.tsx | 1 - .../recent-list/components/styles.web.js | 1 - .../recent-list/components/styles.web.ts | 4 + ...utton.js => ScreenSharingAndroidButton.ts} | 20 ++-- .../components/native/ScreenSharingButton.tsx | 7 +- ...osButton.js => ScreenSharingIosButton.tsx} | 29 ++--- .../components/native/VisitorsCountLabel.tsx | 4 +- 59 files changed, 361 insertions(+), 371 deletions(-) rename react/features/base/testing/components/{TestConnectionInfo.js => TestConnectionInfo.tsx} (87%) rename react/features/conference/components/native/{AlwaysOnLabels.js => AlwaysOnLabels.tsx} (95%) rename react/features/conference/components/native/{Conference.js => Conference.tsx} (91%) rename react/features/conference/components/native/{ExpandedLabelPopup.js => ExpandedLabelPopup.tsx} (69%) rename react/features/conference/components/native/{InsecureRoomNameExpandedLabel.js => InsecureRoomNameExpandedLabel.ts} (79%) rename react/features/conference/components/native/{InsecureRoomNameLabel.js => InsecureRoomNameLabel.tsx} (84%) rename react/features/conference/components/native/{Labels.js => Labels.tsx} (89%) rename react/features/conference/components/native/{RaisedHandsCountExpandedLabel.js => RaisedHandsCountExpandedLabel.ts} (72%) rename react/features/conference/components/native/{RaisedHandsCountLabel.js => RaisedHandsCountLabel.tsx} (76%) rename react/features/conference/components/native/{TitleBar.js => TitleBar.tsx} (81%) rename react/features/conference/components/native/{constants.js => constants.ts} (78%) rename react/features/mobile/audio-mode/components/{AudioDeviceToggleButton.js => AudioDeviceToggleButton.ts} (80%) rename react/features/mobile/audio-mode/components/{AudioRoutePickerDialog.js => AudioRoutePickerDialog.tsx} (79%) rename react/features/mobile/audio-mode/components/{styles.js => styles.ts} (99%) rename react/features/mobile/audio-mode/{logger.js => logger.ts} (92%) rename react/features/mobile/audio-mode/{middleware.js => middleware.ts} (89%) rename react/features/mobile/background/{actions.js => actions.ts} (92%) rename react/features/mobile/background/{middleware.native.js => middleware.native.ts} (91%) delete mode 100644 react/features/mobile/background/middleware.web.js rename react/features/mobile/call-integration/{CallKit.js => CallKit.ts} (95%) rename react/features/mobile/call-integration/{ConnectionService.js => ConnectionService.ts} (95%) rename react/features/mobile/call-integration/{functions.js => functions.ts} (84%) rename react/features/mobile/call-integration/{middleware.js => middleware.ts} (92%) rename react/features/mobile/external-api/{logger.js => logger.ts} (92%) rename react/features/mobile/external-api/{middleware.js => middleware.ts} (93%) rename react/features/mobile/full-screen/{actions.js => actions.ts} (86%) rename react/features/mobile/full-screen/{middleware.js => middleware.ts} (95%) rename react/features/mobile/navigation/components/lobby/components/{LobbyNavigationContainer.js => LobbyNavigationContainer.tsx} (91%) rename react/features/mobile/navigation/components/welcome/{functions.js => functions.tsx} (74%) rename react/features/mobile/navigation/{middleware.js => middleware.ts} (82%) rename react/features/mobile/permissions/{middleware.js => middleware.ts} (96%) rename react/features/mobile/picture-in-picture/{actions.js => actions.ts} (87%) rename react/features/mobile/picture-in-picture/components/{PictureInPictureButton.js => PictureInPictureButton.ts} (88%) rename react/features/mobile/picture-in-picture/{logger.js => logger.ts} (91%) rename react/features/mobile/proximity/{middleware.js => middleware.ts} (96%) rename react/features/mobile/wake-lock/{middleware.js => middleware.ts} (95%) rename react/features/mobile/watchos/{actions.js => actions.ts} (99%) rename react/features/mobile/watchos/{logger.js => logger.ts} (91%) rename react/features/mobile/watchos/{middleware.js => middleware.ts} (93%) delete mode 100644 react/features/recent-list/components/styles.web.js create mode 100644 react/features/recent-list/components/styles.web.ts rename react/features/toolbox/components/native/{ScreenSharingAndroidButton.js => ScreenSharingAndroidButton.ts} (88%) rename react/features/toolbox/components/native/{ScreenSharingIosButton.js => ScreenSharingIosButton.tsx} (88%) diff --git a/package-lock.json b/package-lock.json index 8684d81d59..38e9320813 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,6 +135,7 @@ "@types/react-dom": "17.0.14", "@types/react-linkify": "1.0.1", "@types/react-native": "0.68.9", + "@types/react-native-keep-awake": "2.0.3", "@types/react-native-video": "5.0.14", "@types/react-redux": "7.1.24", "@types/react-window": "1.8.5", @@ -5826,6 +5827,15 @@ "@types/react": "^17" } }, + "node_modules/@types/react-native-keep-awake": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/react-native-keep-awake/-/react-native-keep-awake-2.0.3.tgz", + "integrity": "sha512-0C4bUlGPHRpplbn+YnX2UO0/2joa0dhCPumas2fielGNJkS1FTJOrw9jFo4B0+LOtmsepXiy/ANTF/on0b2Ddw==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@types/react-native-video": { "version": "5.0.14", "resolved": "https://registry.npmjs.org/@types/react-native-video/-/react-native-video-5.0.14.tgz", @@ -23883,6 +23893,15 @@ "@types/react": "^17" } }, + "@types/react-native-keep-awake": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/react-native-keep-awake/-/react-native-keep-awake-2.0.3.tgz", + "integrity": "sha512-0C4bUlGPHRpplbn+YnX2UO0/2joa0dhCPumas2fielGNJkS1FTJOrw9jFo4B0+LOtmsepXiy/ANTF/on0b2Ddw==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, "@types/react-native-video": { "version": "5.0.14", "resolved": "https://registry.npmjs.org/@types/react-native-video/-/react-native-video-5.0.14.tgz", diff --git a/package.json b/package.json index 1048462da8..7be1b23540 100644 --- a/package.json +++ b/package.json @@ -140,6 +140,7 @@ "@types/react-dom": "17.0.14", "@types/react-linkify": "1.0.1", "@types/react-native": "0.68.9", + "@types/react-native-keep-awake": "2.0.3", "@types/react-native-video": "5.0.14", "@types/react-redux": "7.1.24", "@types/react-window": "1.8.5", diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts index 6d4b568f80..feb8e21b37 100644 --- a/react/features/base/conference/reducer.ts +++ b/react/features/base/conference/reducer.ts @@ -46,6 +46,7 @@ export interface IJitsiConference { authenticateAndUpgradeRole: Function; avModerationApprove: Function; avModerationReject: Function; + callUUID?: string; createVideoSIPGWSession: Function; dial: Function; disableAVModeration: Function; diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts index d1dc7133a7..096d989ef9 100644 --- a/react/features/base/config/configType.ts +++ b/react/features/base/config/configType.ts @@ -170,6 +170,7 @@ export interface IConfig { }>; callDisplayName?: string; callFlowsEnabled?: boolean; + callHandle?: string; callStatsConfigParams?: { additionalIDs?: { customerID?: string; @@ -191,6 +192,7 @@ export interface IConfig { }; callStatsID?: string; callStatsSecret?: string; + callUUID?: string; channelLastN?: number; chromeExtensionBanner?: { chromeExtensionsInfo?: Array<{ id: string; path: string; }>; diff --git a/react/features/base/testing/components/TestConnectionInfo.js b/react/features/base/testing/components/TestConnectionInfo.tsx similarity index 87% rename from react/features/base/testing/components/TestConnectionInfo.js rename to react/features/base/testing/components/TestConnectionInfo.tsx index c2c5af990b..8d991fb94b 100644 --- a/react/features/base/testing/components/TestConnectionInfo.js +++ b/react/features/base/testing/components/TestConnectionInfo.tsx @@ -1,6 +1,7 @@ import React, { Component, Fragment } from 'react'; import { connect } from 'react-redux'; +import { IReduxState } from '../../../app/types'; import statsEmitter from '../../../connection-indicator/statsEmitter'; import { getLocalParticipant } from '../../participants/functions'; import { isTestModeEnabled } from '../functions'; @@ -10,7 +11,7 @@ import TestHint from './TestHint'; /** * Defines the TestConnectionInfo's properties. */ -type Props = { +interface IProps { /** * The JitsiConference's connection state. It's the lib-jitsi-meet's event @@ -20,30 +21,30 @@ type Props = { * 'conference.connectionInterrupted' * 'conference.connectionRestored'. */ - _conferenceConnectionState: string, + _conferenceConnectionState: string; /** * This will be a boolean converted to a string. The value will be 'true' * once the conference is joined (the XMPP MUC room to be specific). */ - _conferenceJoinedState: string, + _conferenceJoinedState: string; /** * The local participant's ID. Required to be able to observe the local RTP * stats. */ - _localUserId: string, + _localUserId: string; /** * The local participant's role. */ - _localUserRole: string, + _localUserRole: string; /** * Indicates whether or not the test mode is currently on. Otherwise the * TestConnectionInfo component will not render. */ - _testMode: boolean + _testMode: boolean; } /** @@ -64,15 +65,15 @@ type State = { /** * The local download RTP bitrate. */ - download: number, + download: number; /** * The local upload RTP bitrate. */ - upload: number - } - } -} + upload: number; + }; + }; +}; /** * The component will expose some of the app state to the jitsi-meet-torture @@ -81,8 +82,7 @@ type State = { * this information, but there's no such option on React Native(maybe that's * a good thing). */ -class TestConnectionInfo extends Component { - _onStatsUpdated: Object => void; +class TestConnectionInfo extends Component { /** * Initializes new TestConnectionInfo instance. @@ -90,7 +90,7 @@ class TestConnectionInfo extends Component { * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ - constructor(props: Props) { + constructor(props: IProps) { super(props); this._onStatsUpdated = this._onStatsUpdated.bind(this); @@ -114,7 +114,8 @@ class TestConnectionInfo extends Component { * @returns {void} * @private */ - _onStatsUpdated(stats = {}) { + _onStatsUpdated(stats = { bitrate: { download: undefined, + upload: undefined } }) { this.setState({ stats: { bitrate: { @@ -143,7 +144,7 @@ class TestConnectionInfo extends Component { * @inheritdoc * returns {void} */ - componentDidUpdate(prevProps: Props) { + componentDidUpdate(prevProps: IProps) { if (prevProps._localUserId !== this.props._localUserId) { statsEmitter.unsubscribeToClientStats( prevProps._localUserId, this._onStatsUpdated); @@ -175,7 +176,7 @@ class TestConnectionInfo extends Component { } return ( - + @@ -184,7 +185,7 @@ class TestConnectionInfo extends Component { value = { this.props._conferenceJoinedState } /> + value = { 'true' } /> @@ -202,9 +203,9 @@ class TestConnectionInfo extends Component { * * @param {Object} state - The Redux state. * @private - * @returns {Props} + * @returns {IProps} */ -function _mapStateToProps(state) { +function _mapStateToProps(state: IReduxState) { const conferenceJoined = Boolean(state['features/base/conference'].conference); const localParticipant = getLocalParticipant(state); @@ -212,8 +213,8 @@ function _mapStateToProps(state) { return { _conferenceConnectionState: state['features/testing'].connectionState, _conferenceJoinedState: conferenceJoined.toString(), - _localUserId: localParticipant?.id, - _localUserRole: localParticipant?.role, + _localUserId: localParticipant?.id ?? '', + _localUserRole: localParticipant?.role ?? '', _testMode: isTestModeEnabled(state) }; } diff --git a/react/features/base/testing/components/TestHint.web.ts b/react/features/base/testing/components/TestHint.web.ts index e69de29bb2..5dae9e61dc 100644 --- a/react/features/base/testing/components/TestHint.web.ts +++ b/react/features/base/testing/components/TestHint.web.ts @@ -0,0 +1,3 @@ +import { Component } from 'react'; + +export default Component; diff --git a/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx b/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx index 220a64d559..f3538dea0f 100644 --- a/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx +++ b/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx @@ -1,19 +1,15 @@ import React, { PureComponent } from 'react'; +import { WithTranslation } from 'react-i18next'; import { IReduxState } from '../../app/types'; import isInsecureRoomName from '../../base/util/isInsecureRoomName'; -interface IProps { +interface IProps extends WithTranslation { /** * True of the label should be visible. */ _visible: boolean; - - /** - * Function to be used to translate i18n labels. - */ - t: Function; } /** diff --git a/react/features/conference/components/native/AlwaysOnLabels.js b/react/features/conference/components/native/AlwaysOnLabels.tsx similarity index 95% rename from react/features/conference/components/native/AlwaysOnLabels.js rename to react/features/conference/components/native/AlwaysOnLabels.tsx index 3b254ef716..c74da79d75 100644 --- a/react/features/conference/components/native/AlwaysOnLabels.js +++ b/react/features/conference/components/native/AlwaysOnLabels.tsx @@ -1,5 +1,3 @@ -// @flow - import React, { useCallback } from 'react'; import { TouchableOpacity } from 'react-native'; import { useDispatch } from 'react-redux'; @@ -19,16 +17,16 @@ import { LabelHitSlop } from './constants'; -type Props = { +interface IProps { /** * Creates a function to be invoked when the onPress of the touchables are * triggered. */ - createOnPress: Function + createOnPress: Function; } -const AlwaysOnLabels = ({ createOnPress }: Props) => { +const AlwaysOnLabels = ({ createOnPress }: IProps) => { const dispatch = useDispatch(); const openHighlightDialogCallback = useCallback(() => dispatch(openHighlightDialog()), [ dispatch ]); diff --git a/react/features/conference/components/native/Conference.js b/react/features/conference/components/native/Conference.tsx similarity index 91% rename from react/features/conference/components/native/Conference.js rename to react/features/conference/components/native/Conference.tsx index 657db3dae9..7c3faea377 100644 --- a/react/features/conference/components/native/Conference.js +++ b/react/features/conference/components/native/Conference.tsx @@ -1,5 +1,3 @@ -// @flow - import { useIsFocused } from '@react-navigation/native'; import React, { useEffect } from 'react'; import { @@ -8,12 +6,14 @@ import { Platform, SafeAreaView, StatusBar, - View + View, + ViewStyle } from 'react-native'; -import { withSafeAreaInsets } from 'react-native-safe-area-context'; +import { EdgeInsets, withSafeAreaInsets } from 'react-native-safe-area-context'; import { connect } from 'react-redux'; import { appNavigate } from '../../../app/actions'; +import { IReduxState } from '../../../app/types'; import { FULLSCREEN_ENABLED, PIP_ENABLED } from '../../../base/flags/constants'; import { getFeatureFlag } from '../../../base/flags/functions'; import { getParticipantCount } from '../../../base/participants/functions'; @@ -24,6 +24,7 @@ import { ASPECT_RATIO_NARROW, ASPECT_RATIO_WIDE } from '../../../base/responsive-ui/constants'; +import { StyleType } from '../../../base/styles/functions.any'; import TestConnectionInfo from '../../../base/testing/components/TestConnectionInfo'; import { isCalendarEnabled } from '../../../calendar-sync/functions.native'; import DisplayNameLabel from '../../../display-name/components/native/DisplayNameLabel'; @@ -63,27 +64,27 @@ import styles from './styles'; /** * The type of the React {@code Component} props of {@link Conference}. */ -type Props = AbstractProps & { +interface IProps extends AbstractProps { /** * Application's aspect ratio. */ - _aspectRatio: Symbol, + _aspectRatio: Symbol; /** * Whether the audio only is enabled or not. */ - _audioOnlyEnabled: boolean, + _audioOnlyEnabled: boolean; /** * Branding styles for conference. */ - _brandingStyles: Object, + _brandingStyles: StyleType; /** * Whether the calendar feature is enabled or not. */ - _calendarEnabled: boolean, + _calendarEnabled: boolean; /** * The indicator which determines that we are still connecting to the @@ -91,101 +92,101 @@ type Props = AbstractProps & { * joining the room. If truthy, then an activity/loading indicator will be * rendered. */ - _connecting: boolean, + _connecting: boolean; /** * Set to {@code true} when the filmstrip is currently visible. */ - _filmstripVisible: boolean, + _filmstripVisible: boolean; /** * The indicator which determines whether fullscreen (immersive) mode is enabled. */ - _fullscreenEnabled: boolean, + _fullscreenEnabled: boolean; /** * The indicator which determines if the conference type is one to one. */ - _isOneToOneConference: boolean, + _isOneToOneConference: boolean; /** * The indicator which determines if the participants pane is open. */ - _isParticipantsPaneOpen: boolean, + _isParticipantsPaneOpen: boolean; /** * The ID of the participant currently on stage (if any). */ - _largeVideoParticipantId: string, + _largeVideoParticipantId: string; /** * Local participant's display name. */ - _localParticipantDisplayName: string, + _localParticipantDisplayName: string; /** * Whether Picture-in-Picture is enabled. */ - _pictureInPictureEnabled: boolean, + _pictureInPictureEnabled: boolean; /** * The indicator which determines whether the UI is reduced (to accommodate * smaller display areas). */ - _reducedUI: boolean, - - /** - * The indicator which determines whether the Toolbox is visible. - */ - _toolboxVisible: boolean, + _reducedUI: boolean; /** * Indicates if we should auto-knock. */ - _shouldEnableAutoKnock: boolean, + _shouldEnableAutoKnock: boolean; /** * Indicates whether the lobby screen should be visible. */ - _showLobby: boolean, + _showLobby: boolean; /** * Indicates whether the car mode is enabled. */ - _startCarMode: boolean, + _startCarMode: boolean; + + /** + * The indicator which determines whether the Toolbox is visible. + */ + _toolboxVisible: boolean; /** * The redux {@code dispatch} function. */ - dispatch: Function, + dispatch: Function; /** * Object containing the safe area insets. */ - insets: Object, + insets: EdgeInsets; /** * Default prop for navigating between screen components(React Navigation). */ - navigation: Object -}; + navigation: any; +} type State = { /** * The label that is currently expanded. */ - visibleExpandedLabel: ?string -} + visibleExpandedLabel?: string; +}; /** * The conference page of the mobile (i.e. React Native) application. */ -class Conference extends AbstractConference { +class Conference extends AbstractConference { /** * Timeout ref. */ - _expandedLabelTimeout: Object; + _expandedLabelTimeout: any; /** * Initializes a new Conference instance. @@ -193,14 +194,14 @@ class Conference extends AbstractConference { * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ - constructor(props) { + constructor(props: IProps) { super(props); this.state = { visibleExpandedLabel: undefined }; - this._expandedLabelTimeout = React.createRef(); + this._expandedLabelTimeout = React.createRef(); // Bind event handlers so they are only bound once per instance. this._onClick = this._onClick.bind(this); @@ -235,7 +236,7 @@ class Conference extends AbstractConference { * * @inheritdoc */ - componentDidUpdate(prevProps) { + componentDidUpdate(prevProps: IProps) { const { _shouldEnableAutoKnock, _showLobby, @@ -267,7 +268,7 @@ class Conference extends AbstractConference { // Tear handling any hardware button presses for back navigation down. BackHandler.removeEventListener('hardwareBackPress', this._onHardwareBackPress); - clearTimeout(this._expandedLabelTimeout.current); + clearTimeout(this._expandedLabelTimeout.current ?? 0); } /** @@ -301,8 +302,6 @@ class Conference extends AbstractConference { ); } - _onClick: () => void; - /** * Changes the value of the toolboxVisible state, thus allowing us to switch * between Toolbox and Filmstrip and change their visibility. @@ -314,8 +313,6 @@ class Conference extends AbstractConference { this._setToolboxVisible(!this.props._toolboxVisible); } - _onHardwareBackPress: () => boolean; - /** * Handles a hardware button press for back navigation. Enters Picture-in-Picture mode * (if supported) or leaves the associated {@code Conference} otherwise. @@ -340,8 +337,6 @@ class Conference extends AbstractConference { return true; } - _createOnPress: (string) => void; - /** * Creates a function to be invoked when the onPress of the touchables are * triggered. @@ -350,7 +345,7 @@ class Conference extends AbstractConference { * triggered. * @returns {Function} */ - _createOnPress(label) { + _createOnPress(label: string) { return () => { const { visibleExpandedLabel } = this.state; @@ -434,7 +429,7 @@ class Conference extends AbstractConference { + style = { styles.toolboxAndFilmstripContainer as ViewStyle }> @@ -463,17 +458,17 @@ class Conference extends AbstractConference { + : styles.titleBarSafeViewTransparent) as ViewStyle }> { + style = { alwaysOnTitleBarStyles as ViewStyle }> {/* eslint-disable-next-line react/jsx-no-bind */} @@ -532,7 +527,7 @@ class Conference extends AbstractConference { * @returns {React$Element} */ _renderNotificationsContainer() { - const notificationsStyle = {}; + const notificationsStyle: ViewStyle = {}; // In the landscape mode (wide) there's problem with notifications being // shadowed by the filmstrip rendered on the right. This makes the "x" @@ -559,8 +554,6 @@ class Conference extends AbstractConference { ); } - _setToolboxVisible: (boolean) => void; - /** * Dispatches an action changing the visibility of the {@link Toolbox}. * @@ -569,7 +562,7 @@ class Conference extends AbstractConference { * {@code Toolbox} or {@code false} to hide it. * @returns {void} */ - _setToolboxVisible(visible) { + _setToolboxVisible(visible: boolean) { this.props.dispatch(setToolboxVisible(visible)); } } @@ -578,10 +571,11 @@ class Conference extends AbstractConference { * Maps (parts of) the redux state to the associated {@code Conference}'s props. * * @param {Object} state - The redux state. + * @param {any} _ownProps - Component's own props. * @private - * @returns {Props} + * @returns {IProps} */ -function _mapStateToProps(state) { +function _mapStateToProps(state: IReduxState, _ownProps: any) { const { isOpen } = state['features/participants-pane']; const { aspectRatio, reducedUI } = state['features/base/responsive-ui']; const { backgroundColor } = state['features/dynamic-branding']; @@ -627,7 +621,7 @@ export default withSafeAreaInsets(connect(_mapStateToProps)(props => { return () => setPictureInPictureEnabled(false); }, [ isFocused ]); - return ( + return ( // @ts-ignore ); })); diff --git a/react/features/conference/components/native/ExpandedLabelPopup.js b/react/features/conference/components/native/ExpandedLabelPopup.tsx similarity index 69% rename from react/features/conference/components/native/ExpandedLabelPopup.js rename to react/features/conference/components/native/ExpandedLabelPopup.tsx index 3ec26bcf6f..750ada5a67 100644 --- a/react/features/conference/components/native/ExpandedLabelPopup.js +++ b/react/features/conference/components/native/ExpandedLabelPopup.tsx @@ -1,26 +1,25 @@ -// @flow - import React from 'react'; import BaseTheme from '../../../base/ui/components/BaseTheme'; import { EXPANDED_LABELS } from './constants'; -type Props = { +interface IProps { /** * The selected label to show details. */ - visibleExpandedLabel: ?string + visibleExpandedLabel?: string; } -const ExpandedLabelPopup = ({ visibleExpandedLabel }: Props) => { +const ExpandedLabelPopup = ({ visibleExpandedLabel }: IProps) => { if (visibleExpandedLabel) { - const expandedLabel = EXPANDED_LABELS[visibleExpandedLabel]; + const expandedLabel = EXPANDED_LABELS[visibleExpandedLabel as keyof typeof EXPANDED_LABELS]; if (expandedLabel) { - const LabelComponent = expandedLabel.component || expandedLabel; - const { props, alwaysOn } = expandedLabel || {}; + const LabelComponent = expandedLabel.component; + + const { props, alwaysOn } = expandedLabel; const style = { top: alwaysOn ? BaseTheme.spacing[6] : BaseTheme.spacing[1] }; diff --git a/react/features/conference/components/native/InsecureRoomNameExpandedLabel.js b/react/features/conference/components/native/InsecureRoomNameExpandedLabel.ts similarity index 79% rename from react/features/conference/components/native/InsecureRoomNameExpandedLabel.js rename to react/features/conference/components/native/InsecureRoomNameExpandedLabel.ts index fd7d6de877..092150c1a1 100644 --- a/react/features/conference/components/native/InsecureRoomNameExpandedLabel.js +++ b/react/features/conference/components/native/InsecureRoomNameExpandedLabel.ts @@ -1,13 +1,11 @@ -// @flow +import { WithTranslation } from 'react-i18next'; import { translate } from '../../../base/i18n/functions'; -import ExpandedLabel, { Props as AbstractProps } from '../../../base/label/components/native/ExpandedLabel'; +import ExpandedLabel, { IProps as AbstractProps } from '../../../base/label/components/native/ExpandedLabel'; import { INSECURE_ROOM_NAME_LABEL_COLOR } from './styles'; -type Props = AbstractProps & { - t: Function -} +type Props = AbstractProps & WithTranslation; /** * A react {@code Component} that implements an expanded label as tooltip-like diff --git a/react/features/conference/components/native/InsecureRoomNameLabel.js b/react/features/conference/components/native/InsecureRoomNameLabel.tsx similarity index 84% rename from react/features/conference/components/native/InsecureRoomNameLabel.js rename to react/features/conference/components/native/InsecureRoomNameLabel.tsx index 34412ec79b..771d417b43 100644 --- a/react/features/conference/components/native/InsecureRoomNameLabel.js +++ b/react/features/conference/components/native/InsecureRoomNameLabel.tsx @@ -1,8 +1,7 @@ -// @flow - import React from 'react'; import { connect } from 'react-redux'; +import { translate } from '../../../base/i18n/functions'; import { IconWarning } from '../../../base/icons/svg'; import Label from '../../../base/label/components/native/Label'; import AbstractInsecureRoomNameLabel, { _mapStateToProps } from '../AbstractInsecureRoomNameLabel'; @@ -27,4 +26,4 @@ class InsecureRoomNameLabel extends AbstractInsecureRoomNameLabel { } } -export default connect(_mapStateToProps)(InsecureRoomNameLabel); +export default translate(connect(_mapStateToProps)(InsecureRoomNameLabel)); diff --git a/react/features/conference/components/native/Labels.js b/react/features/conference/components/native/Labels.tsx similarity index 89% rename from react/features/conference/components/native/Labels.js rename to react/features/conference/components/native/Labels.tsx index 0f6719b6bc..32fa8bc03c 100644 --- a/react/features/conference/components/native/Labels.js +++ b/react/features/conference/components/native/Labels.tsx @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { TouchableOpacity, View } from 'react-native'; +import { TouchableOpacity, View, ViewStyle } from 'react-native'; import TranscribingLabel from '../../../transcribing/components/TranscribingLabel.native'; import VideoQualityLabel from '../../../video-quality/components/VideoQualityLabel.native'; @@ -8,19 +8,19 @@ import InsecureRoomNameLabel from './InsecureRoomNameLabel'; import { LABEL_ID_INSECURE_ROOM_NAME, LABEL_ID_QUALITY, LABEL_ID_TRANSCRIBING, LabelHitSlop } from './constants'; import styles from './styles'; -type Props = { +interface IProps { /** * Creates a function to be invoked when the onPress of the touchables are * triggered. */ - createOnPress: Function + createOnPress: Function; } /** * A container that renders the conference indicators, if any. */ -class Labels extends Component { +class Labels extends Component { /** * Implements React {@code Component}'s render. @@ -32,7 +32,7 @@ class Labels extends Component { + style = { styles.indicatorContainer as ViewStyle }> { - const raisedHandsCount = useSelector(state => + const raisedHandsCount = useSelector((state: IReduxState) => (state['features/base/participants'].raisedHandsQueue || []).length); - return raisedHandsCount > 0 && ( + return raisedHandsCount > 0 ? (