Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(TS) Convert some native components to TS (#13264)

Robert Pintilii646c58f7d12b
diff --git a/react/features/base/conference/actions.ts b/react/features/base/conference/actions.ts
index 55b1e824e8..05343577a3 100644
--- a/react/features/base/conference/actions.ts
+++ b/react/features/base/conference/actions.ts
@@ -806,7 +806,7 @@ export function setStartReactionsMuted(muted: boolean, updateBackend = false) {
export function setPassword(
conference: IJitsiConference | undefined,
method: Function | undefined,
- password: string) {
+ password?: string) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
if (!conference) {
return;
diff --git a/react/features/base/dialog/constants.ts b/react/features/base/dialog/constants.ts
index 6ae1ef77ec..37916e1482 100644
--- a/react/features/base/dialog/constants.ts
+++ b/react/features/base/dialog/constants.ts
@@ -35,7 +35,7 @@ export type DialogProps = {
/**
* The handler for the event when submitting the dialog.
*/
- onSubmit: Function;
+ onSubmit?: Function;
/**
* Additional style to be applied on the dialog.
diff --git a/react/features/base/react/components/native/LoadingIndicator.tsx b/react/features/base/react/components/native/LoadingIndicator.tsx
index 226966a528..2591fded91 100644
--- a/react/features/base/react/components/native/LoadingIndicator.tsx
+++ b/react/features/base/react/components/native/LoadingIndicator.tsx
@@ -15,6 +15,8 @@ interface IProps {
* prop of the native component.
*/
size?: 'large' | 'small' | 'medium';
+
+ style?: any;
}
/**
diff --git a/react/features/chat/actions.native.ts b/react/features/chat/actions.native.ts
index bd33ec89f6..7c0019388e 100644
--- a/react/features/chat/actions.native.ts
+++ b/react/features/chat/actions.native.ts
@@ -1,5 +1,6 @@
/* eslint-disable lines-around-comment, max-len */
+import { IParticipant } from '../base/participants/types';
import { navigate }
// @ts-ignore
from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
@@ -21,7 +22,7 @@ export * from './actions.any';
* type: OPEN_CHAT
* }}
*/
-export function openChat(participant: Object, disablePolls?: boolean) {
+export function openChat(participant: IParticipant | undefined | Object, disablePolls?: boolean) {
if (disablePolls) {
navigate(screen.conference.chat);
}
diff --git a/react/features/chat/components/native/ChatInputBar.js b/react/features/chat/components/native/ChatInputBar.tsx
similarity index 86%
rename from react/features/chat/components/native/ChatInputBar.js
rename to react/features/chat/components/native/ChatInputBar.tsx
index 88f65a5d06..53777fec31 100644
--- a/react/features/chat/components/native/ChatInputBar.js
+++ b/react/features/chat/components/native/ChatInputBar.tsx
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
-import { Platform } from 'react-native';
+import { WithTranslation } from 'react-i18next';
+import { Platform, ViewStyle } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { translate } from '../../../base/i18n/functions';
@@ -10,47 +11,42 @@ import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import styles from './styles';
-type Props = {
+interface IProps extends WithTranslation {
/**
* Callback to invoke on message send.
*/
- onSend: Function,
-
- /**
- * Function to be used to translate i18n labels.
- */
- t: Function
-};
+ onSend: Function;
+}
-type State = {
+interface IState {
/**
* Boolean to show if an extra padding needs to be added to the bar.
*/
- addPadding: boolean,
+ addPadding: boolean;
/**
* The value of the input field.
*/
- message: string,
+ message: string;
/**
* Boolean to show or hide the send button.
*/
- showSend: boolean
-};
+ showSend: boolean;
+}
/**
* Implements the chat input bar with text field and action(s).
*/
-class ChatInputBar extends Component<Props, State> {
+class ChatInputBar extends Component<IProps, IState> {
/**
* Instantiates a new instance of the component.
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this.state = {
@@ -76,7 +72,7 @@ class ChatInputBar extends Component<Props, State> {
style = { [
styles.inputBar,
this.state.addPadding ? styles.extraBarPadding : null
- ] }>
+ ] as ViewStyle[] }>
<Input
blurOnSubmit = { false }
customStyles = {{ container: styles.customInputContainer }}
@@ -98,30 +94,26 @@ class ChatInputBar extends Component<Props, State> {
);
}
- _onChangeText: string => void;
-
/**
* Callback to handle the change of the value of the text field.
*
* @param {string} text - The current value of the field.
* @returns {void}
*/
- _onChangeText(text) {
+ _onChangeText(text: string) {
this.setState({
message: text,
showSend: Boolean(text)
});
}
- _onFocused: boolean => Function;
-
/**
* Constructs a callback to be used to update the padding of the field if necessary.
*
* @param {boolean} focused - True of the field is focused.
* @returns {Function}
*/
- _onFocused(focused) {
+ _onFocused(focused: boolean) {
return () => {
Platform.OS === 'android' && this.setState({
addPadding: focused
@@ -129,8 +121,6 @@ class ChatInputBar extends Component<Props, State> {
};
}
- _onSubmit: () => void;
-
/**
* Callback to handle the submit event of the text field.
*
diff --git a/react/features/chat/components/native/ChatMessage.js b/react/features/chat/components/native/ChatMessage.tsx
similarity index 88%
rename from react/features/chat/components/native/ChatMessage.js
rename to react/features/chat/components/native/ChatMessage.tsx
index 00606e9c49..e3a901f544 100644
--- a/react/features/chat/components/native/ChatMessage.js
+++ b/react/features/chat/components/native/ChatMessage.tsx
@@ -1,14 +1,15 @@
import React from 'react';
-import { Text, View } from 'react-native';
+import { Text, View, ViewStyle } from 'react-native';
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import Avatar from '../../../base/avatar/components/Avatar';
import { translate } from '../../../base/i18n/functions';
import Linkify from '../../../base/react/components/native/Linkify';
-import { isGifMessage } from '../../../gifs/functions';
+import { isGifMessage } from '../../../gifs/functions.native';
import { MESSAGE_TYPE_ERROR, MESSAGE_TYPE_LOCAL } from '../../constants';
import { replaceNonUnicodeEmojis } from '../../functions';
-import AbstractChatMessage, { type Props } from '../AbstractChatMessage';
+import AbstractChatMessage, { IProps } from '../AbstractChatMessage';
import GifMessage from './GifMessage';
import PrivateMessageButton from './PrivateMessageButton';
@@ -18,7 +19,7 @@ import styles from './styles';
/**
* Renders a single chat message.
*/
-class ChatMessage extends AbstractChatMessage<Props> {
+class ChatMessage extends AbstractChatMessage<IProps> {
/**
* Implements {@code Component#render}.
*
@@ -31,18 +32,18 @@ class ChatMessage extends AbstractChatMessage<Props> {
// Style arrays that need to be updated in various scenarios, such as
// error messages or others.
- const detailsWrapperStyle = [
- styles.detailsWrapper
+ const detailsWrapperStyle: ViewStyle[] = [
+ styles.detailsWrapper as ViewStyle
];
- const messageBubbleStyle = [
- styles.messageBubble
+ const messageBubbleStyle: ViewStyle[] = [
+ styles.messageBubble as ViewStyle
];
if (localMessage) {
// This is a message sent by the local participant.
// The wrapper needs to be aligned to the right.
- detailsWrapperStyle.push(styles.ownMessageDetailsWrapper);
+ detailsWrapperStyle.push(styles.ownMessageDetailsWrapper as ViewStyle);
// The bubble needs some additional styling
messageBubbleStyle.push(styles.localMessageBubble);
@@ -69,11 +70,11 @@ class ChatMessage extends AbstractChatMessage<Props> {
const messageText = replaceNonUnicodeEmojis(this._getMessageText());
return (
- <View style = { styles.messageWrapper } >
+ <View style = { styles.messageWrapper as ViewStyle } >
{ this._renderAvatar() }
<View style = { detailsWrapperStyle }>
<View style = { messageBubbleStyle }>
- <View style = { styles.textWrapper } >
+ <View style = { styles.textWrapper as ViewStyle } >
{ this._renderDisplayName() }
{ isGifMessage(messageText)
? <GifMessage message = { messageText } />
@@ -94,12 +95,6 @@ class ChatMessage extends AbstractChatMessage<Props> {
);
}
- _getFormattedTimestamp: () => string;
-
- _getMessageText: () => string;
-
- _getPrivateNoticeMessage: () => string;
-
/**
* Renders the avatar of the sender.
*
@@ -171,7 +166,7 @@ class ChatMessage extends AbstractChatMessage<Props> {
}
return (
- <View style = { styles.replyContainer }>
+ <View style = { styles.replyContainer as ViewStyle }>
<PrivateMessageButton
isLobbyMessage = { lobbyChat }
participantID = { message.id }
@@ -204,9 +199,9 @@ class ChatMessage extends AbstractChatMessage<Props> {
* Maps part of the redux state to the props of this component.
*
* @param {Object} state - The Redux state.
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
return {
knocking: state['features/lobby'].knocking
};
diff --git a/react/features/chat/components/native/ChatMessageGroup.js b/react/features/chat/components/native/ChatMessageGroup.tsx
similarity index 78%
rename from react/features/chat/components/native/ChatMessageGroup.js
rename to react/features/chat/components/native/ChatMessageGroup.tsx
index 6af29a10d3..25e73e8d60 100644
--- a/react/features/chat/components/native/ChatMessageGroup.js
+++ b/react/features/chat/components/native/ChatMessageGroup.tsx
@@ -1,28 +1,29 @@
-import React, { Component, ReactElement } from 'react';
+import React, { Component } from 'react';
import { FlatList } from 'react-native';
import { MESSAGE_TYPE_LOCAL, MESSAGE_TYPE_REMOTE } from '../../constants';
+import { IMessage } from '../../reducer';
import ChatMessage from './ChatMessage';
-type Props = {
+interface IProps {
- /**
- * The messages array to render.
- */
- messages: Array<Object>
+ /**
+ * The messages array to render.
+ */
+ messages: Array<IMessage>;
}
/**
* Implements a container to render all the chat messages in a conference.
*/
-export default class ChatMessageGroup extends Component<Props> {
+export default class ChatMessageGroup extends Component<IProps> {
/**
* Instantiates a new instance of the component.
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._keyExtractor = this._keyExtractor.bind(this);
@@ -44,29 +45,25 @@ export default class ChatMessageGroup extends Component<Props> {
);
}
- _keyExtractor: Object => string;
-
/**
* Key extractor for the flatlist.
*
- * @param {Object} item - The flatlist item that we need the key to be
+ * @param {Object} _item - The flatlist item that we need the key to be
* generated for.
* @param {number} index - The index of the element.
* @returns {string}
*/
- _keyExtractor(item, index) {
+ _keyExtractor(_item: Object, index: number) {
return `key_${index}`;
}
- _renderMessage: Object => ReactElement;
-
/**
* Renders a single chat message.
*
* @param {Object} message - The chat message to render.
* @returns {React$Element<*>}
*/
- _renderMessage({ index, item: message }) {
+ _renderMessage({ index, item: message }: { index: number; item: IMessage; }) {
return (
<ChatMessage
message = { message }
diff --git a/react/features/chat/components/native/GifMessage.js b/react/features/chat/components/native/GifMessage.tsx
similarity index 66%
rename from react/features/chat/components/native/GifMessage.js
rename to react/features/chat/components/native/GifMessage.tsx
index ba7f3a54b4..fc14948f9b 100644
--- a/react/features/chat/components/native/GifMessage.js
+++ b/react/features/chat/components/native/GifMessage.tsx
@@ -1,26 +1,26 @@
import React from 'react';
-import { Image, View } from 'react-native';
+import { Image, ImageStyle, View } from 'react-native';
import { GIF_PREFIX } from '../../../gifs/constants';
import styles from './styles';
-type Props = {
+interface IProps {
/**
* The formatted gif message.
*/
- message: string
+ message: string;
}
-const GifMessage = ({ message }: Props) => {
+const GifMessage = ({ message }: IProps) => {
const url = message.substring(GIF_PREFIX.length, message.length - 1);
return (<View
style = { styles.gifContainer }>
<Image
source = {{ uri: url }}
- style = { styles.gifImage } />
+ style = { styles.gifImage as ImageStyle } />
</View>);
};
diff --git a/react/features/chat/components/native/MessageContainer.js b/react/features/chat/components/native/MessageContainer.tsx
similarity index 72%
rename from react/features/chat/components/native/MessageContainer.js
rename to react/features/chat/components/native/MessageContainer.tsx
index 07edcea0c3..8884d6ba3c 100644
--- a/react/features/chat/components/native/MessageContainer.js
+++ b/react/features/chat/components/native/MessageContainer.tsx
@@ -1,32 +1,32 @@
-import React, { ReactElement } from 'react';
-import { FlatList, Text, View } from 'react-native';
+import React from 'react';
+import { FlatList, Text, TextStyle, View, ViewStyle } from 'react-native';
import { connect } from 'react-redux';
import { translate } from '../../../base/i18n/functions';
-import AbstractMessageContainer, { type Props as AbstractProps }
- from '../AbstractMessageContainer';
+import { IMessage } from '../../reducer';
+import AbstractMessageContainer, { IProps as AbstractProps } from '../AbstractMessageContainer';
import ChatMessageGroup from './ChatMessageGroup';
import styles from './styles';
-type Props = AbstractProps & {
+interface IProps extends AbstractProps {
/**
* Function to be used to translate i18n labels.
*/
- t: Function
-};
+ t: Function;
+}
/**
* Implements a container to render all the chat messages in a conference.
*/
-class MessageContainer extends AbstractMessageContainer<Props> {
+class MessageContainer extends AbstractMessageContainer<IProps, any> {
/**
* Instantiates a new instance of the component.
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._keyExtractor = this._keyExtractor.bind(this);
@@ -57,24 +57,18 @@ class MessageContainer extends AbstractMessageContainer<Props> {
);
}
- _getMessagesGroupedBySender: () => Array<Array<Object>>;
-
- _keyExtractor: Object => string;
-
/**
* Key extractor for the flatlist.
*
- * @param {Object} item - The flatlist item that we need the key to be
+ * @param {Object} _item - The flatlist item that we need the key to be
* generated for.
* @param {number} index - The index of the element.
* @returns {string}
*/
- _keyExtractor(item, index) {
+ _keyExtractor(_item: Object, index: number) {
return `key_${index}`;
}
- _renderListEmptyComponent: () => ReactElement;
-
/**
* Renders a message when there are no messages in the chat yet.
*
@@ -84,23 +78,21 @@ class MessageContainer extends AbstractMessageContainer<Props> {
const { t } = this.props;
return (
- <View style = { styles.emptyComponentWrapper }>
- <Text style = { styles.emptyComponentText }>
+ <View style = { styles.emptyComponentWrapper as ViewStyle }>
+ <Text style = { styles.emptyComponentText as TextStyle }>
{ t('chat.noMessagesMessage') }
</Text>
</View>
);
}
- _renderMessageGroup: Object => ReactElement;
-
/**
* Renders a single chat message.
*
* @param {Array<Object>} messages - The chat message to render.
* @returns {React$Element<*>}
*/
- _renderMessageGroup({ item: messages }) {
+ _renderMessageGroup({ item: messages }: { item: IMessage[]; }) {
return <ChatMessageGroup messages = { messages } />;
}
}
diff --git a/react/features/chat/components/native/PrivateMessageButton.js b/react/features/chat/components/native/PrivateMessageButton.tsx
similarity index 81%
rename from react/features/chat/components/native/PrivateMessageButton.js
rename to react/features/chat/components/native/PrivateMessageButton.tsx
index 722bcbb8c4..195a238384 100644
--- a/react/features/chat/components/native/PrivateMessageButton.js
+++ b/react/features/chat/components/native/PrivateMessageButton.tsx
@@ -1,57 +1,49 @@
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import { CHAT_ENABLED } from '../../../base/flags/constants';
import { getFeatureFlag } from '../../../base/flags/functions';
import { translate } from '../../../base/i18n/functions';
import { IconMessage, IconReply } from '../../../base/icons/svg';
import { getParticipantById } from '../../../base/participants/functions';
+import { IParticipant } from '../../../base/participants/types';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
-import { handleLobbyChatInitialized, openChat } from '../../../chat/actions.native';
import { navigate } from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
+import { handleLobbyChatInitialized, openChat } from '../../actions.native';
-export type Props = AbstractButtonProps & {
+export interface IProps extends AbstractButtonProps {
/**
- * The Redux Dispatch function.
- */
- dispatch: Function,
-
- /**
- * The ID of the participant that the message is to be sent.
- */
- participantID: string,
-
- /**
- * True if the button is rendered as a reply button.
+ * True if message is a lobby chat message.
*/
- reply: boolean,
+ _isLobbyMessage: boolean;
/**
- * Function to be used to translate i18n labels.
+ * True if the polls feature is disabled.
*/
- t: Function,
+ _isPollsDisabled?: boolean;
/**
- * True if the polls feature is disabled.
+ * The participant object retrieved from Redux.
*/
- _isPollsDisabled: boolean,
+ _participant?: IParticipant;
/**
- * True if message is a lobby chat message.
+ * The ID of the participant that the message is to be sent.
*/
- _isLobbyMessage: boolean,
+ participantID: string;
/**
- * The participant object retrieved from Redux.
+ * True if the button is rendered as a reply button.
*/
- _participant: Object,
-};
+ reply: boolean;
+}
/**
- * Class to render a button that initiates the sending of a private message through chet.
+ * Class to render a button that initiates the sending of a private message through chat.
*/
-class PrivateMessageButton extends AbstractButton<Props, any> {
+class PrivateMessageButton extends AbstractButton<IProps, any> {
accessibilityLabel = 'toolbar.accessibilityLabel.privateMessage';
icon = IconMessage;
label = 'toolbar.privateMessage';
@@ -99,10 +91,10 @@ class PrivateMessageButton extends AbstractButton<Props, any> {
* Maps part of the Redux store to the props of this component.
*
* @param {Object} state - The Redux state.
- * @param {Props} ownProps - The own props of the component.
- * @returns {Props}
+ * @param {IProps} ownProps - The own props of the component.
+ * @returns {IProps}
*/
-export function _mapStateToProps(state: Object, ownProps: Props) {
+export function _mapStateToProps(state: IReduxState, ownProps: any) {
const enabled = getFeatureFlag(state, CHAT_ENABLED, true);
const { disablePolls } = state['features/base/config'];
const { visible = enabled, isLobbyMessage, participantID } = ownProps;
diff --git a/react/features/chat/components/native/styles.js b/react/features/chat/components/native/styles.ts
similarity index 100%
rename from react/features/chat/components/native/styles.js
rename to react/features/chat/components/native/styles.ts
diff --git a/react/features/invite/components/add-people-dialog/AbstractAddPeopleDialog.tsx b/react/features/invite/components/add-people-dialog/AbstractAddPeopleDialog.tsx
index e1733871b1..54b82ba99c 100644
--- a/react/features/invite/components/add-people-dialog/AbstractAddPeopleDialog.tsx
+++ b/react/features/invite/components/add-people-dialog/AbstractAddPeopleDialog.tsx
@@ -68,7 +68,7 @@ export interface IProps {
/**
* Whether or not to allow sip invites.
*/
- _sipInviteEnabled: boolean;
+ _sipInviteEnabled: boolean;
/**
* The Redux dispatch function.
@@ -92,7 +92,7 @@ export interface IState {
/**
* The list of invite items.
*/
- inviteItems: Array<IInviteSelectItem>;
+ inviteItems: Array<IInvitee | IInviteSelectItem>;
}
/**
diff --git a/react/features/invite/components/add-people-dialog/native/AddPeopleDialog.tsx b/react/features/invite/components/add-people-dialog/native/AddPeopleDialog.tsx
index 8cdb46e137..9bba9d7797 100644
--- a/react/features/invite/components/add-people-dialog/native/AddPeopleDialog.tsx
+++ b/react/features/invite/components/add-people-dialog/native/AddPeopleDialog.tsx
@@ -1,7 +1,6 @@
-/* eslint-disable lines-around-comment */
-
import _ from 'lodash';
import React, { ReactElement } from 'react';
+import { WithTranslation } from 'react-i18next';
import {
ActivityIndicator,
FlatList,
@@ -23,7 +22,6 @@ import {
IconSearch,
IconShare
} from '../../../../base/icons/svg';
-// @ts-ignore
import JitsiScreen from '../../../../base/modal/components/JitsiScreen';
import AvatarListItem from '../../../../base/react/components/native/AvatarListItem';
import { Item } from '../../../../base/react/types';
@@ -33,19 +31,16 @@ import HeaderNavigationButton
from '../../../../mobile/navigation/components/HeaderNavigationButton';
import { beginShareRoom } from '../../../../share-room/actions';
import { INVITE_TYPES } from '../../../constants';
+import { IInviteSelectItem, IInvitee } from '../../../types';
import AbstractAddPeopleDialog, {
- // @ts-ignore
- type Props as AbstractProps,
- // @ts-ignore
- type State as AbstractState,
+ type IProps as AbstractProps,
+ type IState as AbstractState,
_mapStateToProps as _abstractMapStateToProps
} from '../AbstractAddPeopleDialog';
-// @ts-ignore
import styles, { AVATAR_SIZE } from './styles';
-
-interface IProps extends AbstractProps {
+interface IProps extends AbstractProps, WithTranslation {
/**
* True if the invite dialog should be open, false otherwise.
@@ -55,12 +50,7 @@ interface IProps extends AbstractProps {
/**
* Default prop for navigation between screen components(React Navigation).
*/
- navigation: Object;
-
- /**
- * Function used to translate i18n labels.
- */
- t: Function;
+ navigation: any;
/**
* Theme used for styles.
@@ -95,9 +85,7 @@ interface IState extends AbstractState {
/**
* Implements a special dialog to invite people from a directory service.
*/
-class AddPeopleDialog
- // @ts-ignore
- extends AbstractAddPeopleDialog<IProps, IState> {
+class AddPeopleDialog extends AbstractAddPeopleDialog<IProps, IState> {
/**
* Default state object to reset the state to when needed.
*/
@@ -119,7 +107,7 @@ class AddPeopleDialog
searchTimeout: number;
/**
- * Contrustor of the component.
+ * Constructor of the component.
*
* @inheritdoc
*/
@@ -151,7 +139,6 @@ class AddPeopleDialog
componentDidMount() {
const { navigation, t } = this.props;
- // @ts-ignore
navigation.setOptions({
headerRight: () => (
<HeaderNavigationButton
@@ -171,7 +158,6 @@ class AddPeopleDialog
componentDidUpdate(prevProps: IProps) {
const { navigation, t } = this.props;
- // @ts-ignore
navigation.setOptions({
// eslint-disable-next-line react/no-multi-comp
headerRight: () => (
@@ -197,12 +183,9 @@ class AddPeopleDialog
*/
render() {
const {
- // @ts-ignore
_addPeopleEnabled,
- // @ts-ignore
_dialOutEnabled
} = this.props;
- // @ts-ignore
const { inviteItems, selectableItems } = this.state;
let placeholderKey = 'searchPlaceholder';
@@ -302,7 +285,6 @@ class AddPeopleDialog
});
// Clear search results
- // @ts-ignore
this._onTypeQuery('');
}
@@ -314,10 +296,9 @@ class AddPeopleDialog
_onInvite() {
// @ts-ignore
this._invite(this.state.inviteItems)
- .then((invitesLeftToSend: ArrayLike<any>) => {
+ .then((invitesLeftToSend: IInvitee[]) => {
if (invitesLeftToSend.length) {
this.setState({
- // @ts-ignore
inviteItems: invitesLeftToSend
});
this._showFailedInviteAlert();
@@ -333,26 +314,22 @@ class AddPeopleDialog
*/
_onPressItem(item: Item) {
return () => {
- // @ts-ignore
const { inviteItems } = this.state;
const finderKey = item.type === INVITE_TYPES.PHONE ? 'number' : 'user_id';
if (inviteItems.find(
- // @ts-ignore
- _.matchesProperty(finderKey, item[finderKey]))) {
+ _.matchesProperty(finderKey, item[finderKey as keyof typeof item]))) {
// Item is already selected, need to unselect it.
this.setState({
- // @ts-ignore
inviteItems: inviteItems.filter(
- // @ts-ignore
- (element: any) => item[finderKey] !== element[finderKey])
+ (element: any) => item[finderKey as keyof typeof item] !== element[finderKey])
});
} else {
// Item is not selected yet, need to add to the list.
- const items: Array<Object> = inviteItems.concat(item);
+ // @ts-ignore
+ const items = inviteItems.concat(item);
this.setState({
- // @ts-ignore
inviteItems: _.sortBy(items, [ 'name', 'number' ])
});
}
@@ -365,12 +342,10 @@ class AddPeopleDialog
* @returns {void}
*/
_onShareMeeting() {
- // @ts-ignore
if (this.state.inviteItems.length > 0) {
// The use probably intended to invite people.
this._onInvite();
} else {
- // @ts-ignore
this.props.dispatch(beginShareRoom());
}
}
@@ -388,7 +363,6 @@ class AddPeopleDialog
});
clearTimeout(this.searchTimeout);
- // @ts-ignore
this.searchTimeout = setTimeout(() => {
this.setState({
searchInprogress: true
@@ -462,9 +436,8 @@ class AddPeopleDialog
*/
_renderItem(flatListItem: any, index: number): ReactElement | null {
const { item } = flatListItem;
- // @ts-ignore
const { inviteItems } = this.state;
- let selected = false;
+ let selected: IInvitee | IInviteSelectItem | undefined | boolean = false;
const renderableItem = this._getRenderableItem(flatListItem);
if (!renderableItem) {
@@ -570,7 +543,6 @@ class AddPeopleDialog
* @returns {void}
*/
_showFailedInviteAlert() {
- // @ts-ignore
this.props.dispatch(openDialog(AlertDialog, {
contentKey: {
key: 'inviteDialog.alertText'
@@ -583,14 +555,15 @@ class AddPeopleDialog
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
+ * @param {any} _ownProps - Component's own props.
* @returns {{
* _isVisible: boolean
* }}
*/
-function _mapStateToProps(state: IReduxState) {
+function _mapStateToProps(state: IReduxState, _ownProps: any) {
return {
..._abstractMapStateToProps(state)
};
}
-// @ts-ignore
+
export default translate(connect(_mapStateToProps)(AddPeopleDialog));
diff --git a/react/features/invite/components/add-people-dialog/native/styles.js b/react/features/invite/components/add-people-dialog/native/styles.ts
similarity index 100%
rename from react/features/invite/components/add-people-dialog/native/styles.js
rename to react/features/invite/components/add-people-dialog/native/styles.ts
diff --git a/react/features/invite/components/add-people-dialog/web/InviteContactsForm.tsx b/react/features/invite/components/add-people-dialog/web/InviteContactsForm.tsx
index 4bb38bec1d..f6d0a58e38 100644
--- a/react/features/invite/components/add-people-dialog/web/InviteContactsForm.tsx
+++ b/react/features/invite/components/add-people-dialog/web/InviteContactsForm.tsx
@@ -325,7 +325,7 @@ class InviteContactsForm extends AbstractAddPeopleDialog<IProps, IState> {
const userTypes = [ INVITE_TYPES.USER, INVITE_TYPES.VIDEO_ROOM, INVITE_TYPES.ROOM ];
const users = response.filter(item => userTypes.includes(item.type));
- const userDisplayItems = [];
+ const userDisplayItems: any = [];
for (const user of users) {
const { name, phone } = user;
diff --git a/react/features/invite/components/dial-in-info-page/DialInInfoApp.native.js b/react/features/invite/components/dial-in-info-page/DialInInfoApp.native.ts
similarity index 100%
rename from react/features/invite/components/dial-in-info-page/DialInInfoApp.native.js
rename to react/features/invite/components/dial-in-info-page/DialInInfoApp.native.ts
diff --git a/react/features/invite/components/dial-in-info-page/NoRoomError.native.js b/react/features/invite/components/dial-in-info-page/NoRoomError.native.ts
similarity index 100%
rename from react/features/invite/components/dial-in-info-page/NoRoomError.native.js
rename to react/features/invite/components/dial-in-info-page/NoRoomError.native.ts
diff --git a/react/features/invite/components/dial-in-summary/native/DialInSummary.js b/react/features/invite/components/dial-in-summary/native/DialInSummary.tsx
similarity index 85%
rename from react/features/invite/components/dial-in-summary/native/DialInSummary.js
rename to react/features/invite/components/dial-in-summary/native/DialInSummary.tsx
index e83adbcced..88563fc392 100644
--- a/react/features/invite/components/dial-in-summary/native/DialInSummary.js
+++ b/react/features/invite/components/dial-in-summary/native/DialInSummary.tsx
@@ -1,11 +1,11 @@
-// @flow
-
+import { Route } from '@react-navigation/native';
import React, { PureComponent } from 'react';
-import { Linking, View } from 'react-native';
+import { WithTranslation } from 'react-i18next';
+import { Linking, View, ViewStyle } from 'react-native';
import { WebView } from 'react-native-webview';
import { connect } from 'react-redux';
-import { type Dispatch } from 'redux';
+import { IStore } from '../../../../app/types';
import { openDialog } from '../../../../base/dialog/actions';
import { translate } from '../../../../base/i18n/functions';
import JitsiScreen from '../../../../base/modal/components/JitsiScreen';
@@ -15,38 +15,32 @@ import { getDialInfoPageURLForURIString } from '../../../functions';
import DialInSummaryErrorDialog from './DialInSummaryErrorDialog';
import styles, { INDICATOR_COLOR } from './styles';
+interface IProps extends WithTranslation {
-type Props = {
-
- dispatch: Dispatch<any>,
+ dispatch: IStore['dispatch'];
/**
* Default prop for navigating between screen components(React Navigation).
*/
- navigation: Object,
+ navigation: any;
/**
* Default prop for navigating between screen components(React Navigation).
*/
- route: Object,
-
- /**
- * Translation function.
- */
- t: Function
-};
+ route: Route<'', { summaryUrl: string; }>;
+}
/**
* Implements a React native component that displays the dial in info page for a specific room.
*/
-class DialInSummary extends PureComponent<Props> {
+class DialInSummary extends PureComponent<IProps> {
/**
* Initializes a new instance.
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._onError = this._onError.bind(this);
@@ -86,15 +80,13 @@ class DialInSummary extends PureComponent<Props> {
onShouldStartLoadWithRequest = { this._onNavigate }
renderLoading = { this._renderLoading }
setSupportMultipleWindows = { false }
- source = {{ uri: getDialInfoPageURLForURIString(summaryUrl) }}
+ source = {{ uri: getDialInfoPageURLForURIString(summaryUrl) ?? '' }}
startInLoadingState = { true }
style = { styles.webView } />
</JitsiScreen>
);
}
- _onError: () => void;
-
/**
* Callback to handle the error if the page fails to load.
*
@@ -104,8 +96,6 @@ class DialInSummary extends PureComponent<Props> {
this.props.dispatch(openDialog(DialInSummaryErrorDialog));
}
- _onNavigate: Object => Boolean;
-
/**
* Callback to intercept navigation inside the webview and make the native app handle the dial requests.
*
@@ -114,7 +104,7 @@ class DialInSummary extends PureComponent<Props> {
* @param {any} request - The request object.
* @returns {boolean}
*/
- _onNavigate(request) {
+ _onNavigate(request: { url: string; }) {
const { url } = request;
const { route } = this.props;
const summaryUrl = route.params?.summaryUrl;
@@ -126,8 +116,6 @@ class DialInSummary extends PureComponent<Props> {
return url === getDialInfoPageURLForURIString(summaryUrl);
}
- _renderLoading: () => React$Component<any>;
-
/**
* Renders the loading indicator.
*
@@ -135,7 +123,7 @@ class DialInSummary extends PureComponent<Props> {
*/
_renderLoading() {
return (
- <View style = { styles.indicatorWrapper }>
+ <View style = { styles.indicatorWrapper as ViewStyle }>
<LoadingIndicator
color = { INDICATOR_COLOR }
size = 'large' />
diff --git a/react/features/invite/components/dial-in-summary/native/DialInSummaryErrorDialog.js b/react/features/invite/components/dial-in-summary/native/DialInSummaryErrorDialog.tsx
similarity index 84%
rename from react/features/invite/components/dial-in-summary/native/DialInSummaryErrorDialog.js
rename to react/features/invite/components/dial-in-summary/native/DialInSummaryErrorDialog.tsx
index 6b5c901ac1..b000192e61 100644
--- a/react/features/invite/components/dial-in-summary/native/DialInSummaryErrorDialog.js
+++ b/react/features/invite/components/dial-in-summary/native/DialInSummaryErrorDialog.tsx
@@ -1,6 +1,5 @@
-// @flow
-
import React, { Component } from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import AlertDialog from '../../../../base/dialog/components/native/AlertDialog';
@@ -9,7 +8,7 @@ import { translate } from '../../../../base/i18n/functions';
/**
* Dialog to inform the user that we couldn't fetch the dial-in info page.
*/
-class DialInSummaryErrorDialog extends Component<{}> {
+class DialInSummaryErrorDialog extends Component<WithTranslation> {
/**
* Implements React's {@link Component#render()}.
*
@@ -22,8 +21,6 @@ class DialInSummaryErrorDialog extends Component<{}> {
contentKey = 'info.dialInSummaryError' />
);
}
-
- _onSubmit: () => boolean;
}
export default translate(connect()(DialInSummaryErrorDialog));
diff --git a/react/features/invite/components/dial-in-summary/native/styles.js b/react/features/invite/components/dial-in-summary/native/styles.ts
similarity index 98%
rename from react/features/invite/components/dial-in-summary/native/styles.js
rename to react/features/invite/components/dial-in-summary/native/styles.ts
index 240d215ade..35a8be1d1a 100644
--- a/react/features/invite/components/dial-in-summary/native/styles.js
+++ b/react/features/invite/components/dial-in-summary/native/styles.ts
@@ -1,5 +1,3 @@
-// @flow
-
import BaseTheme from '../../../../base/ui/components/BaseTheme.native';
export const INDICATOR_COLOR = BaseTheme.palette.ui07;
diff --git a/react/features/large-video/components/LargeVideo.native.js b/react/features/large-video/components/LargeVideo.native.tsx
similarity index 89%
rename from react/features/large-video/components/LargeVideo.native.js
rename to react/features/large-video/components/LargeVideo.native.tsx
index 3315f54561..18589baf34 100644
--- a/react/features/large-video/components/LargeVideo.native.js
+++ b/react/features/large-video/components/LargeVideo.native.tsx
@@ -1,77 +1,76 @@
-// @flow
-
import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
-import type { Dispatch } from 'redux';
+import { IReduxState, IStore } from '../../app/types';
import { JitsiTrackEvents } from '../../base/lib-jitsi-meet';
import ParticipantView from '../../base/participants/components/ParticipantView.native';
import { getParticipantById, isLocalScreenshareParticipant } from '../../base/participants/functions';
import { trackStreamingStatusChanged } from '../../base/tracks/actions.native';
import { getVideoTrackByParticipant, isLocalVideoTrackDesktop } from '../../base/tracks/functions.native';
+import { ITrack } from '../../base/tracks/types';
import { AVATAR_SIZE } from './styles';
/**
* The type of the React {@link Component} props of {@link LargeVideo}.
*/
-type Props = {
+interface IProps {
/**
* Whether video should be disabled.
*/
- _disableVideo: boolean,
+ _disableVideo: boolean;
/**
* Application's viewport height.
*/
- _height: number,
+ _height: number;
/**
* The ID of the participant (to be) depicted by LargeVideo.
*
* @private
*/
- _participantId: string,
+ _participantId: string;
/**
* The video track that will be displayed in the thumbnail.
*/
- _videoTrack: ?Object,
+ _videoTrack?: ITrack;
/**
* Application's viewport height.
*/
- _width: number,
+ _width: number;
/**
* Invoked to trigger state changes in Redux.
*/
- dispatch: Dispatch<any>,
+ dispatch: IStore['dispatch'];
/**
* Callback to invoke when the {@code LargeVideo} is clicked/pressed.
*/
- onClick: Function,
-};
+ onClick?: Function;
+}
/**
* The type of the React {@link Component} state of {@link LargeVideo}.
*/
-type State = {
+interface IState {
/**
* Size for the Avatar. It will be dynamically adjusted based on the
* available size.
*/
- avatarSize: number,
+ avatarSize: number;
/**
* Whether the connectivity indicator will be shown or not. It will be true
* by default, but it may be turned off if there is not enough space.
*/
- useConnectivityInfoLabel: boolean
-};
+ useConnectivityInfoLabel: boolean;
+}
const DEFAULT_STATE = {
avatarSize: AVATAR_SIZE,
@@ -84,14 +83,14 @@ const DEFAULT_STATE = {
*
* @augments Component
*/
-class LargeVideo extends PureComponent<Props, State> {
+class LargeVideo extends PureComponent<IProps, IState> {
/**
* Creates new LargeVideo component.
*
- * @param {Props} props - The props of the component.
+ * @param {IProps} props - The props of the component.
* @returns {LargeVideo}
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this.handleTrackStreamingStatusChanged = this.handleTrackStreamingStatusChanged.bind(this);
@@ -108,7 +107,7 @@ class LargeVideo extends PureComponent<Props, State> {
*
* @inheritdoc
*/
- static getDerivedStateFromProps(props: Props) {
+ static getDerivedStateFromProps(props: IProps) {
const { _height, _width } = props;
// Get the size, rounded to the nearest even number.
@@ -152,7 +151,7 @@ class LargeVideo extends PureComponent<Props, State> {
* @inheritdoc
* @returns {void}
*/
- componentDidUpdate(prevProps: Props) {
+ componentDidUpdate(prevProps: IProps) {
// TODO: after converting this component to a react function component,
// use a custom hook to update local track streaming status.
const { _videoTrack, dispatch } = this.props;
@@ -200,7 +199,7 @@ class LargeVideo extends PureComponent<Props, State> {
* @param {JitsiTrackStreamingStatus} streamingStatus - The updated track streaming status.
* @returns {void}
*/
- handleTrackStreamingStatusChanged(jitsiTrack, streamingStatus) {
+ handleTrackStreamingStatusChanged(jitsiTrack: any, streamingStatus: string) {
this.props.dispatch(trackStreamingStatusChanged(jitsiTrack, streamingStatus));
}
@@ -240,11 +239,11 @@ class LargeVideo extends PureComponent<Props, State> {
*
* @param {Object} state - Redux state.
* @private
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
const { participantId } = state['features/large-video'];
- const participant = getParticipantById(state, participantId);
+ const participant = getParticipantById(state, participantId ?? '');
const { clientHeight: height, clientWidth: width } = state['features/base/responsive-ui'];
const videoTrack = getVideoTrackByParticipant(state, participant);
let disableVideo = false;
@@ -258,7 +257,7 @@ function _mapStateToProps(state) {
return {
_disableVideo: disableVideo,
_height: height,
- _participantId: participantId,
+ _participantId: participantId ?? '',
_videoTrack: videoTrack,
_width: width
};
diff --git a/react/features/large-video/components/LargeVideoBackground.native.js b/react/features/large-video/components/LargeVideoBackground.native.ts
similarity index 100%
rename from react/features/large-video/components/LargeVideoBackground.native.js
rename to react/features/large-video/components/LargeVideoBackground.native.ts
diff --git a/react/features/large-video/components/styles.js b/react/features/large-video/components/styles.ts
similarity index 100%
rename from react/features/large-video/components/styles.js
rename to react/features/large-video/components/styles.ts
diff --git a/react/features/lobby/components/native/LobbyChatScreen.js b/react/features/lobby/components/native/LobbyChatScreen.tsx
similarity index 95%
rename from react/features/lobby/components/native/LobbyChatScreen.js
rename to react/features/lobby/components/native/LobbyChatScreen.tsx
index f1c4d71db6..8370e2f0d4 100644
--- a/react/features/lobby/components/native/LobbyChatScreen.js
+++ b/react/features/lobby/components/native/LobbyChatScreen.tsx
@@ -6,7 +6,7 @@ import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import ChatInputBar from '../../../chat/components/native/ChatInputBar';
import MessageContainer from '../../../chat/components/native/MessageContainer';
import AbstractLobbyScreen, {
- Props as AbstractProps,
+ IProps as AbstractProps,
_mapStateToProps as abstractMapStateToProps
} from '../AbstractLobbyScreen';
@@ -30,6 +30,7 @@ class LobbyChatScreen extends
return (
<JitsiScreen style = { styles.lobbyChatWrapper }>
+ {/* @ts-ignore */}
<MessageContainer messages = { _lobbyChatMessages } />
<ChatInputBar onSend = { this._onSendMessage } />
</JitsiScreen>
diff --git a/react/features/lobby/components/native/LobbyScreen.js b/react/features/lobby/components/native/LobbyScreen.tsx
similarity index 87%
rename from react/features/lobby/components/native/LobbyScreen.js
rename to react/features/lobby/components/native/LobbyScreen.tsx
index 451a7a4779..0f7d8abe93 100644
--- a/react/features/lobby/components/native/LobbyScreen.js
+++ b/react/features/lobby/components/native/LobbyScreen.tsx
@@ -1,7 +1,8 @@
-import React, { ReactElement } from 'react';
-import { Text, View } from 'react-native';
+import React from 'react';
+import { Text, TextStyle, View, ViewStyle } from 'react-native';
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import { getConferenceName } from '../../../base/conference/functions';
import { translate } from '../../../base/i18n/functions';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
@@ -20,29 +21,28 @@ import { preJoinStyles } from '../../../prejoin/components/native/styles';
import AudioMuteButton from '../../../toolbox/components/AudioMuteButton';
import VideoMuteButton from '../../../toolbox/components/VideoMuteButton';
import AbstractLobbyScreen, {
- Props as AbstractProps,
+ IProps as AbstractProps,
_mapStateToProps as abstractMapStateToProps } from '../AbstractLobbyScreen';
import styles from './styles';
-
-type Props = AbstractProps & {
+interface IProps extends AbstractProps {
/**
* The current aspect ratio of the screen.
*/
- _aspectRatio: Symbol,
+ _aspectRatio: Symbol;
/**
* The room name.
*/
- _roomName: string
+ _roomName: string;
}
/**
* Implements a waiting screen that represents the participant being in the lobby.
*/
-class LobbyScreen extends AbstractLobbyScreen<Props> {
+class LobbyScreen extends AbstractLobbyScreen<IProps> {
/**
* Implements {@code PureComponent#render}.
*
@@ -70,7 +70,7 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
style = { contentWrapperStyles }>
<BrandingImageBackground />
<View style = { largeVideoContainerStyles }>
- <View style = { preJoinStyles.displayRoomNameBackdrop }>
+ <View style = { preJoinStyles.displayRoomNameBackdrop as ViewStyle }>
<Text
numberOfLines = { 1 }
style = { preJoinStyles.preJoinRoomName }>
@@ -79,7 +79,7 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
</View>
<LargeVideo />
</View>
- <View style = { contentContainerStyles }>
+ <View style = { contentContainerStyles as ViewStyle }>
{ this._renderToolbarButtons() }
{ this._renderContent() }
</View>
@@ -87,32 +87,6 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
);
}
- _getScreenTitleKey: () => string;
-
- _onAskToJoin: () => void;
-
- _onCancel: () => boolean;
-
- _onChangeDisplayName: Object => void;
-
- _onChangeEmail: Object => void;
-
- _onChangePassword: Object => void;
-
- _onEnableEdit: () => void;
-
- _onJoinWithPassword: () => void;
-
- _onSwitchToKnockMode: () => void;
-
- _onSwitchToPasswordMode: () => void;
-
- _renderContent: () => ReactElement;
-
- _renderToolbarButtons: () => ReactElement;
-
- _onNavigateToLobbyChat: () => void;
-
/**
* Navigates to the lobby chat screen.
*
@@ -137,7 +111,7 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
<LoadingIndicator
color = { BaseTheme.palette.icon01 }
style = { styles.loadingIndicator } />
- <Text style = { styles.joiningMessage }>
+ <Text style = { styles.joiningMessage as TextStyle }>
{ this.props.t('lobby.joiningMessage') }
</Text>
{ this._renderStandardButtons() }
@@ -183,7 +157,6 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
return (
<Input
autoCapitalize = 'none'
- autoCompleteType = 'off'
customStyles = {{ input: styles.customInput }}
error = { _passwordJoinFailed }
onChange = { this._onChangePassword }
@@ -225,7 +198,7 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
*/
_renderToolbarButtons() {
return (
- <View style = { preJoinStyles.toolboxContainer }>
+ <View style = { preJoinStyles.toolboxContainer as ViewStyle }>
<AudioMuteButton
styles = { preJoinStyles.buttonStylesBorderless } />
<VideoMuteButton
@@ -244,7 +217,7 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
const { displayName } = this.state;
return (
- <View style = { styles.formWrapper }>
+ <View style = { styles.formWrapper as ViewStyle }>
{
_knocking && _isLobbyChatActive
&& <Button
@@ -282,14 +255,14 @@ class LobbyScreen extends AbstractLobbyScreen<Props> {
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
- * @param {Props} ownProps - The own props of the component.
+ * @param {IProps} ownProps - The own props of the component.
* @returns {{
* _aspectRatio: Symbol
* }}
*/
-function _mapStateToProps(state: Object, ownProps: Props) {
+function _mapStateToProps(state: IReduxState) {
return {
- ...abstractMapStateToProps(state, ownProps),
+ ...abstractMapStateToProps(state),
_aspectRatio: state['features/base/responsive-ui'].aspectRatio,
_roomName: getConferenceName(state)
};
diff --git a/react/features/lobby/components/native/styles.js b/react/features/lobby/components/native/styles.ts
similarity index 99%
rename from react/features/lobby/components/native/styles.js
rename to react/features/lobby/components/native/styles.ts
index de75626c16..d329305cf0 100644
--- a/react/features/lobby/components/native/styles.js
+++ b/react/features/lobby/components/native/styles.ts
@@ -1,6 +1,5 @@
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
-
export default {
lobbyChatWrapper: {
diff --git a/react/features/mobile/navigation/components/RootNavigationContainer.tsx b/react/features/mobile/navigation/components/RootNavigationContainer.tsx
index 25075a7167..96f206cebd 100644
--- a/react/features/mobile/navigation/components/RootNavigationContainer.tsx
+++ b/react/features/mobile/navigation/components/RootNavigationContainer.tsx
@@ -82,6 +82,7 @@ const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: IProps) =
name = { screen.welcome.main }
options = { welcomeScreenOptions } />
<RootStack.Screen
+ // @ts-ignore
component = { DialInSummary }
name = { screen.dialInSummary }
options = { dialInSummaryScreenOptions } />
diff --git a/react/features/mobile/navigation/components/lobby/LobbyNavigationContainerRef.ts b/react/features/mobile/navigation/components/lobby/LobbyNavigationContainerRef.ts
index 49534a4d2b..a0993dab88 100644
--- a/react/features/mobile/navigation/components/lobby/LobbyNavigationContainerRef.ts
+++ b/react/features/mobile/navigation/components/lobby/LobbyNavigationContainerRef.ts
@@ -10,7 +10,7 @@ export const lobbyNavigationContainerRef = React.createRef<NavigationContainerRe
* @param {Object} params - Params to pass to the destination route.
* @returns {Function}
*/
-export function navigate(name: string, params: Object) {
+export function navigate(name: string, params?: Object) {
return lobbyNavigationContainerRef.current?.navigate(name, params);
}
diff --git a/react/features/notifications/components/native/Notification.tsx b/react/features/notifications/components/native/Notification.tsx
index 178e2d2515..a218fe32d6 100644
--- a/react/features/notifications/components/native/Notification.tsx
+++ b/react/features/notifications/components/native/Notification.tsx
@@ -1,6 +1,6 @@
import React, { useCallback, useContext, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
-import { Animated, Text, View } from 'react-native';
+import { Animated, Text, TextStyle, View, ViewStyle } from 'react-native';
import Icon from '../../../base/icons/components/Icon';
import {
@@ -19,7 +19,6 @@ import { NOTIFICATION_ICON, NOTIFICATION_TYPE } from '../../constants';
import { INotificationProps } from '../../types';
import { NotificationsTransitionContext } from '../NotificationsTransition';
-// @ts-ignore
import styles from './styles';
@@ -153,7 +152,7 @@ const Notification = ({
if (descriptionArray?.length) {
return (
<>
- <Text style = { styles.contentTextTitle }>
+ <Text style = { styles.contentTextTitle as TextStyle }>
{titleText}
</Text>
{
@@ -170,7 +169,7 @@ const Notification = ({
}
return (
- <Text style = { styles.contentTextTitle }>
+ <Text style = { styles.contentTextTitle as TextStyle }>
{titleText}
</Text>
);
@@ -186,12 +185,12 @@ const Notification = ({
{
opacity: notificationOpacityAnimation
}
- ] }>
+ ] as ViewStyle[] }>
<View
- style = { icon === NOTIFICATION_ICON.PARTICIPANTS
+ style = { (icon === NOTIFICATION_ICON.PARTICIPANTS
? styles.contentColumn
- : styles.interactiveContentColumn }>
- <View style = { styles.iconContainer }>
+ : styles.interactiveContentColumn) as ViewStyle }>
+ <View style = { styles.iconContainer as ViewStyle }>
<Icon
color = { ICON_COLOR[appearance as keyof typeof ICON_COLOR] }
size = { 24 }
@@ -202,7 +201,7 @@ const Notification = ({
style = { styles.contentContainer }>
{_renderContent()}
</View>
- <View style = { styles.btnContainer }>
+ <View style = { styles.btnContainer as ViewStyle }>
{mapAppearanceToButtons()}
</View>
</View>
diff --git a/react/features/notifications/components/native/NotificationsContainer.tsx b/react/features/notifications/components/native/NotificationsContainer.tsx
index 9e6b4e8694..5d0091c34f 100644
--- a/react/features/notifications/components/native/NotificationsContainer.tsx
+++ b/react/features/notifications/components/native/NotificationsContainer.tsx
@@ -10,8 +10,6 @@ import { areThereNotifications } from '../../functions';
import NotificationsTransition from '../NotificationsTransition';
import Notification from './Notification';
-// eslint-disable-next-line lines-around-comment
-// @ts-ignore
import styles from './styles';
diff --git a/react/features/notifications/components/native/styles.js b/react/features/notifications/components/native/styles.ts
similarity index 99%
rename from react/features/notifications/components/native/styles.js
rename to react/features/notifications/components/native/styles.ts
index 0182b96847..6c56d124f2 100644
--- a/react/features/notifications/components/native/styles.js
+++ b/react/features/notifications/components/native/styles.ts
@@ -1,5 +1,3 @@
-// @flow
-
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
const contentColumn = {
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/AddBreakoutRoomButton.tsx b/react/features/participants-pane/components/breakout-rooms/components/native/AddBreakoutRoomButton.tsx
index 90c56168aa..c60930ed38 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/AddBreakoutRoomButton.tsx
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/AddBreakoutRoomButton.tsx
@@ -5,7 +5,6 @@ import Button from '../../../../../base/ui/components/native/Button';
import { BUTTON_TYPES } from '../../../../../base/ui/constants.native';
import { createBreakoutRoom } from '../../../../../breakout-rooms/actions';
-// @ts-ignore
import styles from './styles';
/**
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/AutoAssignButton.tsx b/react/features/participants-pane/components/breakout-rooms/components/native/AutoAssignButton.tsx
index 8ae550e194..12be92ed0d 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/AutoAssignButton.tsx
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/AutoAssignButton.tsx
@@ -5,7 +5,6 @@ import Button from '../../../../../base/ui/components/native/Button';
import { BUTTON_TYPES } from '../../../../../base/ui/constants.native';
import { autoAssignToBreakoutRooms } from '../../../../../breakout-rooms/actions';
-// @ts-ignore
import styles from './styles';
/**
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.js b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.tsx
similarity index 88%
rename from react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.js
rename to react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.tsx
index 685c728ca7..7520434571 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.js
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomContextMenu.tsx
@@ -1,6 +1,6 @@
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
-import { TouchableOpacity } from 'react-native';
+import { TouchableOpacity, ViewStyle } from 'react-native';
import { Text } from 'react-native-paper';
import { useDispatch, useSelector } from 'react-redux';
@@ -13,17 +13,18 @@ import { IconCloseLarge, IconRingGroup } from '../../../../../base/icons/svg';
import { isLocalParticipantModerator } from '../../../../../base/participants/functions';
import { closeBreakoutRoom, moveToRoom, removeBreakoutRoom } from '../../../../../breakout-rooms/actions';
import { getBreakoutRoomsConfig } from '../../../../../breakout-rooms/functions';
+import { IRoom } from '../../../../../breakout-rooms/types';
import styles from '../../../native/styles';
-type Props = {
+interface IProps {
/**
* The room for which the menu is open.
*/
- room: Object
+ room: IRoom;
}
-const BreakoutRoomContextMenu = ({ room }: Props) => {
+const BreakoutRoomContextMenu = ({ room }: IProps) => {
const dispatch = useDispatch();
const isLocalModerator = useSelector(isLocalParticipantModerator);
const { hideJoinRoomButton } = useSelector(getBreakoutRoomsConfig);
@@ -53,7 +54,7 @@ const BreakoutRoomContextMenu = ({ room }: Props) => {
!hideJoinRoomButton && (
<TouchableOpacity
onPress = { onJoinRoom }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconRingGroup } />
@@ -65,7 +66,7 @@ const BreakoutRoomContextMenu = ({ room }: Props) => {
&& (room?.participants && Object.keys(room.participants).length > 0
? <TouchableOpacity
onPress = { onCloseBreakoutRoom }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconCloseLarge } />
@@ -73,7 +74,7 @@ const BreakoutRoomContextMenu = ({ room }: Props) => {
</TouchableOpacity>
: <TouchableOpacity
onPress = { onRemoveBreakoutRoom }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconCloseLarge } />
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomParticipantItem.js b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomParticipantItem.tsx
similarity index 75%
rename from react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomParticipantItem.js
rename to react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomParticipantItem.tsx
index afdea62a09..0982f0c357 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomParticipantItem.js
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/BreakoutRoomParticipantItem.tsx
@@ -1,27 +1,27 @@
-// @flow
-
import React, { useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
+import { IReduxState } from '../../../../../app/types';
import { isLocalParticipantModerator, isParticipantModerator } from '../../../../../base/participants/functions';
+import { IRoom } from '../../../../../breakout-rooms/types';
import { showRoomParticipantMenu } from '../../../../actions.native';
import ParticipantItem from '../../../native/ParticipantItem';
-type Props = {
+interface IProps {
/**
* Participant to be displayed.
*/
- item: Object,
+ item: any;
/**
* The room the participant is in.
*/
- room: Object
-};
+ room: IRoom;
+}
-const BreakoutRoomParticipantItem = ({ item, room }: Props) => {
- const { defaultRemoteDisplayName } = useSelector(state => state['features/base/config']);
+const BreakoutRoomParticipantItem = ({ item, room }: IProps) => {
+ const { defaultRemoteDisplayName = '' } = useSelector((state: IReduxState) => state['features/base/config']);
const moderator = useSelector(isLocalParticipantModerator);
const dispatch = useDispatch();
const onPress = useCallback(() => {
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/CollapsibleRoom.js b/react/features/participants-pane/components/breakout-rooms/components/native/CollapsibleRoom.tsx
similarity index 80%
rename from react/features/participants-pane/components/breakout-rooms/components/native/CollapsibleRoom.js
rename to react/features/participants-pane/components/breakout-rooms/components/native/CollapsibleRoom.tsx
index 34c74c872a..f71f787b9f 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/CollapsibleRoom.js
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/CollapsibleRoom.tsx
@@ -4,6 +4,7 @@ import { FlatList } from 'react-native';
import { useDispatch } from 'react-redux';
import { openSheet } from '../../../../../base/dialog/actions';
+import { IRoom } from '../../../../../breakout-rooms/types';
import { participantMatchesSearch } from '../../../../functions';
import CollapsibleList from '../../../native/CollapsibleList';
import styles from '../../../native/styles';
@@ -11,17 +12,17 @@ import styles from '../../../native/styles';
import BreakoutRoomContextMenu from './BreakoutRoomContextMenu';
import BreakoutRoomParticipantItem from './BreakoutRoomParticipantItem';
-type Props = {
+interface IProps {
/**
* Room to display.
*/
- room: Object,
+ room: IRoom;
/**
* Participants search string.
*/
- searchString: string
+ searchString: string;
}
/**
@@ -30,12 +31,11 @@ type Props = {
* @param {Object} item - The participant.
* @returns {string} - The user ID.
*/
-function _keyExtractor(item: Object) {
+function _keyExtractor(item: any) {
return item.jid;
}
-
-export const CollapsibleRoom = ({ room, searchString }: Props) => {
+export const CollapsibleRoom = ({ room, searchString }: IProps) => {
const dispatch = useDispatch();
const { t } = useTranslation();
const _openContextMenu = useCallback(() => {
@@ -50,7 +50,7 @@ export const CollapsibleRoom = ({ room, searchString }: Props) => {
// a certain height percentage for every section in order for all to fit
// inside the participants pane container
const containerStyle
- = roomParticipantsNr > 2 && styles.collapsibleRoomContainer;
+ = roomParticipantsNr > 2 ? styles.collapsibleRoomContainer : undefined;
return (
<CollapsibleList
@@ -62,11 +62,12 @@ export const CollapsibleRoom = ({ room, searchString }: Props) => {
data = { Object.values(room.participants || {}) }
horizontal = { false }
keyExtractor = { _keyExtractor }
- // eslint-disable-next-line react/jsx-no-bind
+ // eslint-disable-next-line react/jsx-no-bind, no-confusing-arrow
renderItem = { ({ item: participant }) => participantMatchesSearch(participant, searchString)
- && <BreakoutRoomParticipantItem
+ ? <BreakoutRoomParticipantItem
item = { participant }
- room = { room } /> }
+ room = { room } />
+ : null }
scrollEnabled = { true }
showsHorizontalScrollIndicator = { false }
windowSize = { 2 } />
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/LeaveBreakoutRoomButton.tsx b/react/features/participants-pane/components/breakout-rooms/components/native/LeaveBreakoutRoomButton.tsx
index 613c8d00f3..0dc5eb09b3 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/LeaveBreakoutRoomButton.tsx
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/LeaveBreakoutRoomButton.tsx
@@ -7,7 +7,6 @@ import Button from '../../../../../base/ui/components/native/Button';
import { BUTTON_TYPES } from '../../../../../base/ui/constants.native';
import { moveToRoom } from '../../../../../breakout-rooms/actions';
-// @ts-ignore
import styles from './styles';
/**
diff --git a/react/features/participants-pane/components/breakout-rooms/components/native/styles.js b/react/features/participants-pane/components/breakout-rooms/components/native/styles.ts
similarity index 99%
rename from react/features/participants-pane/components/breakout-rooms/components/native/styles.js
rename to react/features/participants-pane/components/breakout-rooms/components/native/styles.ts
index c9ca04722d..c38802bc51 100644
--- a/react/features/participants-pane/components/breakout-rooms/components/native/styles.js
+++ b/react/features/participants-pane/components/breakout-rooms/components/native/styles.ts
@@ -1,4 +1,4 @@
-import BaseTheme from '../../../../../base/ui/components/BaseTheme';
+import BaseTheme from '../../../../../base/ui/components/BaseTheme.native';
const baseButton = {
borderRadius: BaseTheme.shape.borderRadius,
diff --git a/react/features/participants-pane/components/native/CollapsibleList.js b/react/features/participants-pane/components/native/CollapsibleList.tsx
similarity index 76%
rename from react/features/participants-pane/components/native/CollapsibleList.js
rename to react/features/participants-pane/components/native/CollapsibleList.tsx
index 9c455b2c57..83d1a204b8 100644
--- a/react/features/participants-pane/components/native/CollapsibleList.js
+++ b/react/features/participants-pane/components/native/CollapsibleList.tsx
@@ -1,37 +1,35 @@
-// @flow
-
import React, { useCallback, useState } from 'react';
-import { Text, TouchableOpacity, View } from 'react-native';
+import { GestureResponderEvent, Text, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native';
import Icon from '../../../base/icons/components/Icon';
import { IconArrowDown, IconArrowUp } from '../../../base/icons/svg';
import { StyleType } from '../../../base/styles/functions.native';
import styles from '../breakout-rooms/components/native/styles';
-type Props = {
+interface IProps {
/**
* The children to be displayed within this list.
*/
- children: React$Node,
+ children: React.ReactNode;
/**
* Additional style to be appended to the CollapsibleList container.
*/
- containerStyle?: StyleType,
+ containerStyle?: StyleType;
/**
* Callback to invoke when the {@code CollapsibleList} is long pressed.
*/
- onLongPress?: Function,
+ onLongPress?: (e?: GestureResponderEvent) => void;
/**
* Collapsible list title.
*/
- title: Object
+ title: Object;
}
-const CollapsibleList = ({ children, containerStyle, onLongPress, title }: Props) => {
+const CollapsibleList = ({ children, containerStyle, onLongPress, title }: IProps) => {
const [ collapsed, setCollapsed ] = useState(false);
const _toggleCollapsed = useCallback(() => {
setCollapsed(!collapsed);
@@ -42,15 +40,15 @@ const CollapsibleList = ({ children, containerStyle, onLongPress, title }: Props
<TouchableOpacity
onLongPress = { onLongPress }
onPress = { _toggleCollapsed }
- style = { styles.collapsibleList }>
+ style = { styles.collapsibleList as ViewStyle }>
<TouchableOpacity
onPress = { _toggleCollapsed }
- style = { styles.arrowIcon }>
+ style = { styles.arrowIcon as ViewStyle }>
<Icon
size = { 18 }
src = { collapsed ? IconArrowDown : IconArrowUp } />
</TouchableOpacity>
- <Text style = { styles.listTile }>
+ <Text style = { styles.listTile as TextStyle }>
{
title
}
diff --git a/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js b/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.tsx
similarity index 75%
rename from react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js
rename to react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.tsx
index 3a88217026..33d508bdbd 100644
--- a/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.js
+++ b/react/features/participants-pane/components/native/ContextMenuLobbyParticipantReject.tsx
@@ -1,38 +1,42 @@
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
-import { TouchableOpacity, View } from 'react-native';
+import { TouchableOpacity, View, ViewStyle } from 'react-native';
import { Text } from 'react-native-paper';
import { useDispatch, useSelector } from 'react-redux';
-import { Avatar } from '../../../base/avatar';
+import Avatar from '../../../base/avatar/components/Avatar';
import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
import Icon from '../../../base/icons/components/Icon';
import { IconCloseLarge } from '../../../base/icons/svg';
+import { IParticipant } from '../../../base/participants/types';
import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
import { getKnockingParticipantsById } from '../../../lobby/functions';
import styles from './styles';
-type Props = {
+interface IProps {
/**
* Participant reference.
*/
- participant: Object
-};
+ participant: IParticipant;
+}
-const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
+const ContextMenuLobbyParticipantReject = ({ participant: p }: IProps) => {
const dispatch = useDispatch();
const knockParticipantsIDArr = useSelector(getKnockingParticipantsById);
const knockParticipantIsAvailable = knockParticipantsIDArr.find(knockPartId => knockPartId === p.id);
const displayName = p.name;
- const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
+ const reject = useCallback(() => {
+ dispatch(setKnockingParticipantApproval(p.id, false));
+ },
+ [ dispatch ]);
const { t } = useTranslation();
// eslint-disable-next-line react/no-multi-comp
const renderMenuHeader = () => (
<View
- style = { styles.contextMenuItemSectionAvatar }>
+ style = { styles.contextMenuItemSectionAvatar as ViewStyle }>
<Avatar
participantId = { p.id }
size = { 24 } />
@@ -47,11 +51,10 @@ const ContextMenuLobbyParticipantReject = ({ participant: p }: Props) => {
addScrollViewPadding = { false }
/* eslint-disable-next-line react/jsx-no-bind */
renderHeader = { renderMenuHeader }
- showSlidingView = { Boolean(knockParticipantIsAvailable) }
- style = { styles.contextMenuMore }>
+ showSlidingView = { Boolean(knockParticipantIsAvailable) }>
<TouchableOpacity
onPress = { reject }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconCloseLarge } />
diff --git a/react/features/participants-pane/components/native/ContextMenuMore.js b/react/features/participants-pane/components/native/ContextMenuMore.tsx
similarity index 86%
rename from react/features/participants-pane/components/native/ContextMenuMore.js
rename to react/features/participants-pane/components/native/ContextMenuMore.tsx
index 54de7a87e4..9a39e737eb 100644
--- a/react/features/participants-pane/components/native/ContextMenuMore.js
+++ b/react/features/participants-pane/components/native/ContextMenuMore.tsx
@@ -1,9 +1,10 @@
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
-import { TouchableOpacity, View } from 'react-native';
+import { TouchableOpacity, View, ViewStyle } from 'react-native';
import { Divider, Text } from 'react-native-paper';
import { useDispatch, useSelector } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import {
requestDisableAudioModeration,
requestDisableVideoModeration,
@@ -33,7 +34,7 @@ export const ContextMenuMore = () => {
}, [ dispatch ]);
const { t } = useTranslation();
- const isModerationSupported = useSelector(isAvModerationSupported);
+ const isModerationSupported = useSelector((state: IReduxState) => isAvModerationSupported()(state));
const allModerators = useSelector(isEveryoneModerator);
const participantCount = useSelector(getParticipantCount);
@@ -52,28 +53,29 @@ export const ContextMenuMore = () => {
showSlidingView = { true }>
<TouchableOpacity
onPress = { muteAllVideo }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconVideoOff } />
<Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
</TouchableOpacity>
{isModerationSupported && ((participantCount === 1 || !allModerators)) && <>
+ {/* @ts-ignore */}
<Divider style = { styles.divider } />
- <View style = { styles.contextMenuItem }>
+ <View style = { styles.contextMenuItem as ViewStyle }>
<Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.allow')}</Text>
</View>
{isAudioModerationEnabled
? <TouchableOpacity
onPress = { disableAudioModeration }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Text style = { styles.contextMenuItemTextNoIcon }>
{t('participantsPane.actions.audioModeration')}
</Text>
</TouchableOpacity>
: <TouchableOpacity
onPress = { enableAudioModeration }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconCheck } />
@@ -84,14 +86,14 @@ export const ContextMenuMore = () => {
{isVideoModerationEnabled
? <TouchableOpacity
onPress = { disableVideoModeration }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Text style = { styles.contextMenuItemTextNoIcon }>
{t('participantsPane.actions.videoModeration')}
</Text>
</TouchableOpacity>
: <TouchableOpacity
onPress = { enableVideoModeration }
- style = { styles.contextMenuItem }>
+ style = { styles.contextMenuItem as ViewStyle }>
<Icon
size = { 24 }
src = { IconCheck } />
diff --git a/react/features/participants-pane/components/native/LobbyParticipantItem.js b/react/features/participants-pane/components/native/LobbyParticipantItem.tsx
similarity index 80%
rename from react/features/participants-pane/components/native/LobbyParticipantItem.js
rename to react/features/participants-pane/components/native/LobbyParticipantItem.tsx
index 3655bb4c96..ccfb6b8b18 100644
--- a/react/features/participants-pane/components/native/LobbyParticipantItem.js
+++ b/react/features/participants-pane/components/native/LobbyParticipantItem.tsx
@@ -1,6 +1,7 @@
import React, { useCallback } from 'react';
import { useDispatch } from 'react-redux';
+import { IParticipant } from '../../../base/participants/types';
import Button from '../../../base/ui/components/native/Button';
import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
@@ -8,23 +9,22 @@ import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
import ParticipantItem from './ParticipantItem';
import styles from './styles';
-
-type Props = {
+interface IProps {
/**
* Participant reference.
*/
- participant: Object
-};
+ participant: IParticipant;
+}
-export const LobbyParticipantItem = ({ participant: p }: Props) => {
+export const LobbyParticipantItem = ({ participant: p }: IProps) => {
const dispatch = useDispatch();
- const admit = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, true), [ dispatch ]));
- const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
+ const admit = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, true)), [ dispatch ]);
+ const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false)), [ dispatch ]);
return (
<ParticipantItem
- displayName = { p.name }
+ displayName = { p.name ?? '' }
isKnockingParticipant = { true }
key = { p.id }
participantID = { p.id } >
diff --git a/react/features/participants-pane/components/native/LobbyParticipantList.js b/react/features/participants-pane/components/native/LobbyParticipantList.tsx
similarity index 91%
rename from react/features/participants-pane/components/native/LobbyParticipantList.js
rename to react/features/participants-pane/components/native/LobbyParticipantList.tsx
index 0f30d23904..d7a1be5a1c 100644
--- a/react/features/participants-pane/components/native/LobbyParticipantList.js
+++ b/react/features/participants-pane/components/native/LobbyParticipantList.tsx
@@ -1,8 +1,6 @@
-// @flow
-
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
-import { ScrollView, Text, View } from 'react-native';
+import { ScrollView, Text, TextStyle, View, ViewStyle } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import Button from '../../../base/ui/components/native/Button';
@@ -14,7 +12,6 @@ import CollapsibleList from './CollapsibleList';
import { LobbyParticipantItem } from './LobbyParticipantItem';
import styles from './styles';
-
const LobbyParticipantList = () => {
const lobbyEnabled = useSelector(getLobbyEnabled);
const participants = useSelector(getKnockingParticipants);
@@ -30,8 +27,8 @@ const LobbyParticipantList = () => {
}
const title = (
- <View style = { styles.lobbyListDetails } >
- <Text style = { styles.lobbyListDescription }>
+ <View style = { styles.lobbyListDetails as ViewStyle } >
+ <Text style = { styles.lobbyListDescription as TextStyle }>
{ t('participantsPane.headings.waitingLobby',
{ count: participants.length }) }
</Text>
diff --git a/react/features/participants-pane/components/native/MeetingParticipantItem.js b/react/features/participants-pane/components/native/MeetingParticipantItem.tsx
similarity index 85%
rename from react/features/participants-pane/components/native/MeetingParticipantItem.js
rename to react/features/participants-pane/components/native/MeetingParticipantItem.tsx
index aaa8666c29..8b4fbf1252 100644
--- a/react/features/participants-pane/components/native/MeetingParticipantItem.js
+++ b/react/features/participants-pane/components/native/MeetingParticipantItem.tsx
@@ -1,6 +1,7 @@
import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import {
getLocalParticipant,
@@ -9,7 +10,7 @@ import {
hasRaisedHand,
isParticipantModerator
} from '../../../base/participants/functions';
-import { FakeParticipant } from '../../../base/participants/types';
+import { FakeParticipant, IParticipant } from '../../../base/participants/types';
import {
isParticipantAudioMuted,
isParticipantVideoMuted
@@ -20,88 +21,85 @@ import { getParticipantAudioMediaState, getParticipantVideoMediaState } from '..
import ParticipantItem from './ParticipantItem';
-
-type Props = {
+interface IProps {
/**
* Media state for audio.
*/
- _audioMediaState: MediaState,
+ _audioMediaState: MediaState;
/**
* Whether or not to disable the moderator indicator.
*/
- _disableModeratorIndicator: boolean,
+ _disableModeratorIndicator?: boolean;
/**
* The display name of the participant.
*/
- _displayName: string,
+ _displayName: string;
/**
* The type of fake participant.
*/
- _fakeParticipant: FakeParticipant,
+ _fakeParticipant: FakeParticipant;
/**
* Whether or not the user is a moderator.
*/
- _isModerator: boolean,
+ _isModerator: boolean;
/**
* True if the participant is the local participant.
*/
- _local: boolean,
+ _local: boolean;
/**
* Shared video local participant owner.
*/
- _localVideoOwner: boolean,
+ _localVideoOwner: boolean;
/**
* The participant ID.
*/
- _participantID: string,
+ _participantID: string;
/**
* True if the participant have raised hand.
*/
- _raisedHand: boolean,
+ _raisedHand: boolean;
/**
* Media state for video.
*/
- _videoMediaState: MediaState,
+ _videoMediaState: MediaState;
/**
* The redux dispatch function.
*/
- dispatch: Function,
+ dispatch: Function;
/**
* The participant.
*/
- participant: ?Object
-};
+ participant?: IParticipant;
+}
/**
* Implements the MeetingParticipantItem component.
*/
-class MeetingParticipantItem extends PureComponent<Props> {
+class MeetingParticipantItem extends PureComponent<IProps> {
/**
* Creates new MeetingParticipantItem instance.
*
- * @param {Props} props - The props of the component.
+ * @param {IProps} props - The props of the component.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._onPress = this._onPress.bind(this);
}
- _onPress: () => void;
-
/**
* Handles MeetingParticipantItem press events.
*
@@ -166,12 +164,12 @@ class MeetingParticipantItem extends PureComponent<Props> {
* @param {Object} state - The Redux state.
* @param {Object} ownProps - The own props of the component.
* @private
- * @returns {Props}
+ * @returns {IProps}
*/
-function mapStateToProps(state, ownProps): Object {
+function mapStateToProps(state: IReduxState, ownProps: any) {
const { participant } = ownProps;
const { ownerId } = state['features/shared-video'];
- const localParticipantId = getLocalParticipant(state).id;
+ const localParticipantId = getLocalParticipant(state)?.id;
const _isAudioMuted = Boolean(participant && isParticipantAudioMuted(participant, state));
const _isVideoMuted = isParticipantVideoMuted(participant, state);
const audioMediaState = getParticipantAudioMediaState(participant, _isAudioMuted, state);
diff --git a/react/features/participants-pane/components/native/MeetingParticipantList.tsx b/react/features/participants-pane/components/native/MeetingParticipantList.tsx
index 1e82582182..b409c31e50 100644
--- a/react/features/participants-pane/components/native/MeetingParticipantList.tsx
+++ b/react/features/participants-pane/components/native/MeetingParticipantList.tsx
@@ -78,7 +78,7 @@ interface IProps extends WithTranslation {
/**
* The remote participants.
*/
- _sortedRemoteParticipants: Map<string, string>;
+ _sortedRemoteParticipants: string[];
/**
* The current visitors count if any.
@@ -229,7 +229,7 @@ class MeetingParticipantList extends PureComponent<IProps> {
= isLocalModerator
? containerStyleModerator : styles.notLocalModeratorContainer;
const finalContainerStyle
- = _participantsCount > 6 && containerStyle;
+ = _participantsCount > 6 ? containerStyle : undefined;
const { color, shareDialogVisible } = _inviteOthersControl;
const _visitorsLabelText = _visitorsCount > 0
? t('participantsPane.headings.visitors', { count: _visitorsCount })
@@ -289,7 +289,7 @@ class MeetingParticipantList extends PureComponent<IProps> {
* @private
* @returns {IProps}
*/
-function _mapStateToProps(state: IReduxState): Object {
+function _mapStateToProps(state: IReduxState) {
const _participantsCount = getParticipantCountWithFake(state);
const { remoteParticipants } = state['features/filmstrip'];
const { shareDialogVisible } = state['features/share-room'];
diff --git a/react/features/participants-pane/components/native/ParticipantItem.js b/react/features/participants-pane/components/native/ParticipantItem.tsx
similarity index 78%
rename from react/features/participants-pane/components/native/ParticipantItem.js
rename to react/features/participants-pane/components/native/ParticipantItem.tsx
index 21b0bdc770..fb09cd26ab 100644
--- a/react/features/participants-pane/components/native/ParticipantItem.js
+++ b/react/features/participants-pane/components/native/ParticipantItem.tsx
@@ -1,7 +1,6 @@
import React from 'react';
-import type { Node } from 'react';
import { useTranslation } from 'react-i18next';
-import { TouchableOpacity, View } from 'react-native';
+import { GestureResponderEvent, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native';
import { Text } from 'react-native-paper';
import Avatar from '../../../base/avatar/components/Avatar';
@@ -10,62 +9,62 @@ import { AudioStateIcons, MEDIA_STATE, type MediaState, VideoStateIcons } from '
import { RaisedHandIndicator } from './RaisedHandIndicator';
import styles from './styles';
-type Props = {
+interface IProps {
/**
* Media state for audio.
*/
- audioMediaState?: MediaState,
+ audioMediaState?: MediaState;
/**
* React children.
*/
- children?: Node,
+ children?: React.ReactNode;
/**
* Whether or not to disable the moderator indicator.
*/
- disableModeratorIndicator?: boolean,
+ disableModeratorIndicator?: boolean;
/**
* The name of the participant. Used for showing lobby names.
*/
- displayName: string,
+ displayName: string;
/**
* Is the participant waiting?
*/
- isKnockingParticipant: boolean,
+ isKnockingParticipant?: boolean;
/**
* Whether or not the user is a moderator.
*/
- isModerator?: boolean,
+ isModerator?: boolean;
/**
* True if the participant is local.
*/
- local?: boolean,
+ local?: boolean;
/**
* Callback to be invoked on pressing the participant item.
*/
- onPress?: Function,
+ onPress?: (e?: GestureResponderEvent) => void;
/**
* The ID of the participant.
*/
- participantID: string,
+ participantID: string;
/**
* True if the participant have raised hand.
*/
- raisedHand?: boolean,
+ raisedHand?: boolean;
/**
* Media state for video.
*/
- videoMediaState?: MediaState
+ videoMediaState?: MediaState;
}
/**
@@ -85,15 +84,15 @@ function ParticipantItem({
raisedHand,
audioMediaState = MEDIA_STATE.NONE,
videoMediaState = MEDIA_STATE.NONE
-}: Props) {
+}: IProps) {
const { t } = useTranslation();
return (
- <View style = { styles.participantContainer } >
+ <View style = { styles.participantContainer as ViewStyle } >
<TouchableOpacity
onPress = { onPress }
- style = { styles.participantContent }>
+ style = { styles.participantContent as ViewStyle }>
<Avatar
displayName = { displayName }
participantId = { participantID }
@@ -103,23 +102,23 @@ function ParticipantItem({
styles.participantDetailsContainer,
raisedHand && styles.participantDetailsContainerRaisedHand
] }>
- <View style = { styles.participantNameContainer }>
+ <View style = { styles.participantNameContainer as ViewStyle }>
<Text
numberOfLines = { 1 }
- style = { styles.participantName }>
+ style = { styles.participantName as TextStyle }>
{ displayName }
{ local && ` (${t('chat.you')})` }
</Text>
</View>
{ isModerator && !disableModeratorIndicator
- && <Text style = { styles.moderatorLabel }>{ t('videothumbnail.moderator') }</Text>
+ && <Text style = { styles.moderatorLabel as TextStyle }>{ t('videothumbnail.moderator') }</Text>
}
</View>
{
!isKnockingParticipant
&& <>
{ raisedHand && <RaisedHandIndicator /> }
- <View style = { styles.participantStatesContainer }>
+ <View style = { styles.participantStatesContainer as ViewStyle }>
<View style = { styles.participantStateVideo }>{ VideoStateIcons[videoMediaState] }</View>
<View>{ AudioStateIcons[audioMediaState] }</View>
</View>
diff --git a/react/features/participants-pane/components/native/ParticipantsPane.js b/react/features/participants-pane/components/native/ParticipantsPane.tsx
similarity index 86%
rename from react/features/participants-pane/components/native/ParticipantsPane.js
rename to react/features/participants-pane/components/native/ParticipantsPane.tsx
index d858c6abba..0e14ceb36d 100644
--- a/react/features/participants-pane/components/native/ParticipantsPane.js
+++ b/react/features/participants-pane/components/native/ParticipantsPane.tsx
@@ -1,8 +1,7 @@
-// @flow
-
import React, { useState } from 'react';
import { useSelector } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { isLocalParticipantModerator } from '../../../base/participants/functions';
import { equals } from '../../../base/redux/functions';
@@ -24,7 +23,6 @@ import MeetingParticipantList from './MeetingParticipantList';
import ParticipantsPaneFooter from './ParticipantsPaneFooter';
import styles from './styles';
-
/**
* Participants pane.
*
@@ -33,12 +31,12 @@ import styles from './styles';
const ParticipantsPane = () => {
const [ searchString, setSearchString ] = useState('');
const isLocalModerator = useSelector(isLocalParticipantModerator);
- const { conference } = useSelector(state => state['features/base/conference']);
+ const { conference } = useSelector((state: IReduxState) => state['features/base/conference']);
const _isBreakoutRoomsSupported = conference?.getBreakoutRooms()?.isSupported();
const currentRoomId = useSelector(getCurrentRoomId);
- const rooms: Array<Object> = Object.values(useSelector(getBreakoutRooms, equals))
- .filter((room: Object) => room.id !== currentRoomId)
- .sort((p1: Object, p2: Object) => (p1?.name || '').localeCompare(p2?.name || ''));
+ const rooms = Object.values(useSelector(getBreakoutRooms, equals))
+ .filter(room => room.id !== currentRoomId)
+ .sort((p1, p2) => (p1?.name || '').localeCompare(p2?.name || ''));
const inBreakoutRoom = useSelector(isInBreakoutRoom);
const showAddBreakoutRoom = useSelector(isAddBreakoutRoomButtonVisible);
const showAutoAssign = useSelector(isAutoAssignParticipantsVisible);
@@ -46,7 +44,7 @@ const ParticipantsPane = () => {
return (
<JitsiScreen
- footerComponent = { isLocalModerator && ParticipantsPaneFooter }
+ footerComponent = { isLocalModerator ? ParticipantsPaneFooter : undefined }
style = { styles.participantsPaneContainer }>
<LobbyParticipantList />
<MeetingParticipantList
diff --git a/react/features/participants-pane/components/native/ParticipantsPaneButton.js b/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
similarity index 79%
rename from react/features/participants-pane/components/native/ParticipantsPaneButton.js
rename to react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
index 54f5ae0d28..e644d04601 100644
--- a/react/features/participants-pane/components/native/ParticipantsPaneButton.js
+++ b/react/features/participants-pane/components/native/ParticipantsPaneButton.tsx
@@ -1,7 +1,4 @@
-// @flow
-
import { connect } from 'react-redux';
-import type { Dispatch } from 'redux';
import { translate } from '../../../base/i18n/functions';
import { IconUsers } from '../../../base/icons/svg';
@@ -10,19 +7,11 @@ import { navigate }
from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Dispatch<any>
-};
-
/**
* Implements an {@link AbstractButton} to open the participants panel.
*/
-class ParticipantsPaneButton extends AbstractButton<Props, *> {
+class ParticipantsPaneButton extends AbstractButton<AbstractButtonProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.participants';
icon = IconUsers;
label = 'toolbar.participants';
diff --git a/react/features/participants-pane/components/native/ParticipantsPaneFooter.tsx b/react/features/participants-pane/components/native/ParticipantsPaneFooter.tsx
index a5c94bf956..aedb6ec51c 100644
--- a/react/features/participants-pane/components/native/ParticipantsPaneFooter.tsx
+++ b/react/features/participants-pane/components/native/ParticipantsPaneFooter.tsx
@@ -1,6 +1,6 @@
/* eslint-disable lines-around-comment */
import React, { useCallback } from 'react';
-import { View } from 'react-native';
+import { View, ViewStyle } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { openDialog, openSheet } from '../../../base/dialog/actions';
@@ -32,7 +32,7 @@ const ParticipantsPaneFooter = (): JSX.Element => {
const showMuteAll = useSelector(isMuteAllVisible);
return (
- <View style = { styles.participantsPaneFooter }>
+ <View style = { styles.participantsPaneFooter as ViewStyle }>
{
showMuteAll && (
<Button
diff --git a/react/features/participants-pane/components/native/RaisedHandIndicator.js b/react/features/participants-pane/components/native/RaisedHandIndicator.tsx
similarity index 100%
rename from react/features/participants-pane/components/native/RaisedHandIndicator.js
rename to react/features/participants-pane/components/native/RaisedHandIndicator.tsx
diff --git a/react/features/participants-pane/components/native/RoomParticipantMenu.tsx b/react/features/participants-pane/components/native/RoomParticipantMenu.tsx
index 5ac689830d..2027cd9a89 100644
--- a/react/features/participants-pane/components/native/RoomParticipantMenu.tsx
+++ b/react/features/participants-pane/components/native/RoomParticipantMenu.tsx
@@ -1,7 +1,7 @@
/* eslint-disable lines-around-comment */
import React, { PureComponent } from 'react';
import { WithTranslation } from 'react-i18next';
-import { Text, View } from 'react-native';
+import { Text, TextStyle, View, ViewStyle } from 'react-native';
import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
@@ -85,8 +85,8 @@ class RoomParticipantMenu extends PureComponent<IProps> {
<BottomSheet
renderHeader = { this._renderMenuHeader }
showSlidingView = { true }>
- <View style = { styles.contextMenuItem }>
- <Text style = { styles.contextMenuItemText }>
+ <View style = { styles.contextMenuItem as ViewStyle }>
+ <Text style = { styles.contextMenuItemText as ViewStyle }>
{t('breakoutRooms.actions.sendToBreakoutRoom')}
</Text>
</View>
@@ -120,11 +120,11 @@ class RoomParticipantMenu extends PureComponent<IProps> {
<View
style = { [
bottomSheetStyles.sheet,
- styles.participantNameContainer ] }>
+ styles.participantNameContainer ] as ViewStyle[] }>
<Avatar
displayName = { participantName }
size = { AVATAR_SIZE } />
- <Text style = { styles.participantNameLabel }>
+ <Text style = { styles.participantNameLabel as TextStyle }>
{ participantName }
</Text>
</View>
diff --git a/react/features/participants-pane/components/native/styles.js b/react/features/participants-pane/components/native/styles.ts
similarity index 100%
rename from react/features/participants-pane/components/native/styles.js
rename to react/features/participants-pane/components/native/styles.ts
diff --git a/react/features/polls/components/AbstractPollResults.tsx b/react/features/polls/components/AbstractPollResults.tsx
index 49b4dee781..4c18d3015d 100644
--- a/react/features/polls/components/AbstractPollResults.tsx
+++ b/react/features/polls/components/AbstractPollResults.tsx
@@ -1,5 +1,6 @@
import React, { ComponentType, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { GestureResponderEvent } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { createPollEvent } from '../../analytics/AnalyticsEvents';
@@ -33,13 +34,13 @@ export type AnswerInfo = {
*/
export type AbstractProps = {
answers: Array<AnswerInfo>;
- changeVote: (e: React.MouseEvent) => void;
+ changeVote: (e?: React.MouseEvent<HTMLButtonElement> | GestureResponderEvent) => void;
creatorName: string;
haveVoted: boolean;
question: string;
showDetails: boolean;
t: Function;
- toggleIsDetailed: (e: React.MouseEvent) => void;
+ toggleIsDetailed: (e?: React.MouseEvent<HTMLButtonElement> | GestureResponderEvent) => void;
};
/**
diff --git a/react/features/polls/components/native/PollAnswer.tsx b/react/features/polls/components/native/PollAnswer.tsx
index e2bcbf8d84..b1b41ea1b4 100644
--- a/react/features/polls/components/native/PollAnswer.tsx
+++ b/react/features/polls/components/native/PollAnswer.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { Text, View } from 'react-native';
+import { Text, TextStyle, View, ViewStyle } from 'react-native';
import { useSelector } from 'react-redux';
import { getLocalParticipant } from '../../../base/participants/functions';
@@ -29,25 +29,25 @@ const PollAnswer = (props: AbstractProps) => {
return (
<>
- <Text style = { dialogStyles.questionText } >{ poll.question }</Text>
- <Text style = { dialogStyles.questionOwnerText } >{
+ <Text style = { dialogStyles.questionText as TextStyle } >{ poll.question }</Text>
+ <Text style = { dialogStyles.questionOwnerText as TextStyle } >{
t('polls.by', { name: localParticipant?.name })
}
</Text>
- <View style = { chatStyles.answerContent }>
+ <View style = { chatStyles.answerContent as ViewStyle }>
{poll.answers.map((answer, index) => (
<View
key = { index }
- style = { chatStyles.switchRow } >
+ style = { chatStyles.switchRow as ViewStyle } >
<Switch
checked = { checkBoxStates[index] }
/* eslint-disable-next-line react/jsx-no-bind */
onChange = { state => setCheckbox(index, state) } />
- <Text style = { chatStyles.switchLabel }>{answer.name}</Text>
+ <Text style = { chatStyles.switchLabel as TextStyle }>{answer.name}</Text>
</View>
))}
</View>
- <View style = { chatStyles.buttonRow }>
+ <View style = { chatStyles.buttonRow as ViewStyle }>
<Button
accessibilityLabel = 'polls.answer.skip'
labelKey = 'polls.answer.skip'
diff --git a/react/features/polls/components/native/PollCreate.js b/react/features/polls/components/native/PollCreate.tsx
similarity index 88%
rename from react/features/polls/components/native/PollCreate.js
rename to react/features/polls/components/native/PollCreate.tsx
index 35bcf4de97..b0489f8e44 100644
--- a/react/features/polls/components/native/PollCreate.js
+++ b/react/features/polls/components/native/PollCreate.tsx
@@ -1,5 +1,6 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
-import { FlatList, Platform, View } from 'react-native';
+import { FlatList, Platform, View, ViewStyle } from 'react-native';
+import { TextInput } from 'react-native-gesture-handler';
import { Divider } from 'react-native-paper';
import Button from '../../../base/ui/components/native/Button';
@@ -8,12 +9,10 @@ import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import styles
from '../../../settings/components/native/styles';
import { ANSWERS_LIMIT, CHAR_LIMIT } from '../../constants';
-import AbstractPollCreate from '../AbstractPollCreate';
-import type { AbstractProps } from '../AbstractPollCreate';
+import AbstractPollCreate, { AbstractProps } from '../AbstractPollCreate';
import { chatStyles, dialogStyles } from './styles';
-
const PollCreate = (props: AbstractProps) => {
const {
addAnswer,
@@ -28,13 +27,13 @@ const PollCreate = (props: AbstractProps) => {
t
} = props;
- const answerListRef = useRef(null);
+ const answerListRef = useRef<FlatList>(null);
/*
* This ref stores the Array of answer input fields, allowing us to focus on them.
* This array is maintained by registerFieldRef and the useEffect below.
*/
- const answerInputs = useRef([]);
+ const answerInputs = useRef<TextInput[]>([]);
const registerFieldRef = useCallback((i, input) => {
if (input === null) {
return;
@@ -51,7 +50,7 @@ const PollCreate = (props: AbstractProps) => {
* This state allows us to requestFocus asynchronously, without having to worry
* about whether a newly created input field has been rendered yet or not.
*/
- const [ lastFocus, requestFocus ] = useState(null);
+ const [ lastFocus, requestFocus ] = useState<number | null>(null);
const { PRIMARY, SECONDARY, TERTIARY } = BUTTON_TYPES;
useEffect(() => {
@@ -70,7 +69,7 @@ const PollCreate = (props: AbstractProps) => {
const onQuestionKeyDown = useCallback(() => {
answerInputs.current[0].focus();
- });
+ }, []);
// Called on keypress in answer fields
const onAnswerKeyDown = useCallback((index: number, ev) => {
@@ -84,7 +83,7 @@ const PollCreate = (props: AbstractProps) => {
}, [ answers, addAnswer, removeAnswer, requestFocus ]);
/* eslint-disable react/no-multi-comp */
- const createRemoveOptionButton = onPress => (
+ const createRemoveOptionButton = (onPress: () => void) => (
<Button
labelKey = 'polls.create.removeOption'
labelStyle = { dialogStyles.optionRemoveButtonText }
@@ -95,12 +94,12 @@ const PollCreate = (props: AbstractProps) => {
/* eslint-disable react/jsx-no-bind */
- const renderListItem = ({ index }: { index: number }) =>
+ const renderListItem = ({ index }: { index: number; }) =>
// padding to take into account the two default options
(
<View
- style = { dialogStyles.optionContainer }>
+ style = { dialogStyles.optionContainer as ViewStyle }>
<Input
blurOnSubmit = { false }
label = { t('polls.create.pollOption', { index: index + 1 }) }
@@ -124,8 +123,8 @@ const PollCreate = (props: AbstractProps) => {
? chatStyles.pollCreateButtonsContainerAndroid : chatStyles.pollCreateButtonsContainerIos;
return (
- <View style = { chatStyles.pollCreateContainer }>
- <View style = { chatStyles.pollCreateSubContainer }>
+ <View style = { chatStyles.pollCreateContainer as ViewStyle }>
+ <View style = { chatStyles.pollCreateSubContainer as ViewStyle }>
<Input
autoFocus = { true }
blurOnSubmit = { false }
@@ -140,15 +139,15 @@ const PollCreate = (props: AbstractProps) => {
// This is set to help the touch event not be propagated to any subviews.
pointerEvents = { 'auto' }
value = { question } />
+ {/* @ts-ignore */}
<Divider style = { styles.fieldSeparator } />
<FlatList
- blurOnSubmit = { true }
data = { answers }
extraData = { answers }
keyExtractor = { (item, index) => index.toString() }
ref = { answerListRef }
renderItem = { renderListItem } />
- <View style = { pollCreateButtonsContainerStyles }>
+ <View style = { pollCreateButtonsContainerStyles as ViewStyle }>
<Button
accessibilityLabel = 'polls.create.addOption'
disabled = { answers.length >= ANSWERS_LIMIT }
@@ -161,7 +160,7 @@ const PollCreate = (props: AbstractProps) => {
style = { chatStyles.pollCreateAddButton }
type = { SECONDARY } />
<View
- style = { chatStyles.buttonRow }>
+ style = { chatStyles.buttonRow as ViewStyle }>
<Button
accessibilityLabel = 'polls.create.cancel'
labelKey = 'polls.create.cancel'
diff --git a/react/features/polls/components/native/PollItem.js b/react/features/polls/components/native/PollItem.tsx
similarity index 76%
rename from react/features/polls/components/native/PollItem.js
rename to react/features/polls/components/native/PollItem.tsx
index 98a45ff87a..c5a9f75b51 100644
--- a/react/features/polls/components/native/PollItem.js
+++ b/react/features/polls/components/native/PollItem.tsx
@@ -1,7 +1,5 @@
-// @flow
-
import React from 'react';
-import { View } from 'react-native';
+import { View, ViewStyle } from 'react-native';
import { useSelector } from 'react-redux';
import { shouldShowResults } from '../../functions';
@@ -10,21 +8,21 @@ import PollAnswer from './PollAnswer';
import PollResults from './PollResults';
import { chatStyles } from './styles';
-type Props = {
+interface IProps {
/**
* Id of the poll.
*/
- pollId: string,
+ pollId: string;
}
-const PollItem = ({ pollId }: Props) => {
+const PollItem = ({ pollId }: IProps) => {
const showResults = useSelector(shouldShowResults(pollId));
return (
<View
- style = { chatStyles.pollItemContainer }>
+ style = { chatStyles.pollItemContainer as ViewStyle }>
{ showResults
? <PollResults
key = { pollId }
diff --git a/react/features/polls/components/native/PollResults.js b/react/features/polls/components/native/PollResults.tsx
similarity index 69%
rename from react/features/polls/components/native/PollResults.js
rename to react/features/polls/components/native/PollResults.tsx
index b2c0a8b44a..c156aac741 100644
--- a/react/features/polls/components/native/PollResults.js
+++ b/react/features/polls/components/native/PollResults.tsx
@@ -1,7 +1,5 @@
-// @flow
-
import React, { useCallback } from 'react';
-import { FlatList, Text, View } from 'react-native';
+import { FlatList, Text, TextStyle, View, ViewStyle } from 'react-native';
import { useSelector } from 'react-redux';
import { getLocalParticipant } from '../../../base/participants/functions';
@@ -12,7 +10,6 @@ import type { AbstractProps, AnswerInfo } from '../AbstractPollResults';
import { chatStyles, dialogStyles, resultsStyles } from './styles';
-
/**
* Component that renders the poll results.
*
@@ -39,10 +36,10 @@ const PollResults = (props: AbstractProps) => {
* @returns {React.Node}
*/
const renderHeader = (answer: string, percentage: number, nbVotes: number) => (
- <View style = { resultsStyles.answerHeader }>
- <Text style = { resultsStyles.answer }>{ answer }</Text>
+ <View style = { resultsStyles.answerHeader as ViewStyle }>
+ <Text style = { resultsStyles.answer as TextStyle }>{ answer }</Text>
<View>
- <Text style = { resultsStyles.answer }>({nbVotes}) {percentage}%</Text>
+ <Text style = { resultsStyles.answer as TextStyle }>({nbVotes}) {percentage}%</Text>
</View>
</View>
);
@@ -58,21 +55,22 @@ const PollResults = (props: AbstractProps) => {
if (showDetails) {
return (
- <View style = { resultsStyles.answerContainer }>
+ <View style = { resultsStyles.answerContainer as ViewStyle }>
{ renderHeader(name, percentage, voterCount) }
- <View style = { resultsStyles.barContainer }>
- <View style = { [ resultsStyles.bar, { width: `${percentage}%` } ] } />
+ <View style = { resultsStyles.barContainer as ViewStyle }>
+ <View style = { [ resultsStyles.bar, { width: `${percentage}%` } ] as ViewStyle[] } />
</View>
{ voters && voterCount > 0
- && <View style = { resultsStyles.voters }>
- {voters.map(({ id, name: voterName }) =>
- (<Text
- key = { id }
- style = { resultsStyles.voter }>
- { voterName }
- </Text>)
- )}
- </View>}
+ && <View style = { resultsStyles.voters as ViewStyle }>
+ {/* @ts-ignore */}
+ {voters.map(({ id, name: voterName }) =>
+ (<Text
+ key = { id }
+ style = { resultsStyles.voter as TextStyle }>
+ { voterName }
+ </Text>)
+ )}
+ </View>}
</View>
);
}
@@ -81,10 +79,10 @@ const PollResults = (props: AbstractProps) => {
// else, we display a simple list
// We add a progress bar by creating an empty view of width equal to percentage.
return (
- <View style = { resultsStyles.answerContainer }>
+ <View style = { resultsStyles.answerContainer as ViewStyle }>
{ renderHeader(answer.name, percentage, voterCount) }
- <View style = { resultsStyles.barContainer }>
- <View style = { [ resultsStyles.bar, { width: `${percentage}%` } ] } />
+ <View style = { resultsStyles.barContainer as ViewStyle }>
+ <View style = { [ resultsStyles.bar, { width: `${percentage}%` } ] as ViewStyle[] } />
</View>
</View>
);
@@ -96,13 +94,15 @@ const PollResults = (props: AbstractProps) => {
/* eslint-disable react/jsx-no-bind */
return (
<View>
- <Text style = { dialogStyles.questionText } >{ question }</Text>
- <Text style = { dialogStyles.questionOwnerText } >{ t('polls.by', { name: localParticipant.name }) }</Text>
+ <Text style = { dialogStyles.questionText as TextStyle } >{ question }</Text>
+ <Text style = { dialogStyles.questionOwnerText as TextStyle } >
+ { t('polls.by', { name: localParticipant?.name }) }
+ </Text>
<FlatList
data = { answers }
keyExtractor = { (item, index) => index.toString() }
renderItem = { answer => renderRow(answer.item) } />
- <View style = { chatStyles.bottomLinks }>
+ <View style = { chatStyles.bottomLinks as ViewStyle }>
<Button
labelKey = {
showDetails
diff --git a/react/features/polls/components/native/PollsList.js b/react/features/polls/components/native/PollsList.tsx
similarity index 77%
rename from react/features/polls/components/native/PollsList.js
rename to react/features/polls/components/native/PollsList.tsx
index 6a48bac1d8..7cf2ef7a8a 100644
--- a/react/features/polls/components/native/PollsList.js
+++ b/react/features/polls/components/native/PollsList.tsx
@@ -1,20 +1,19 @@
import React, { useCallback, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
-import { FlatList, View } from 'react-native';
+import { FlatList, TextStyle, View, ViewStyle } from 'react-native';
import { Text } from 'react-native-paper';
import { useSelector } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import Icon from '../../../base/icons/components/Icon';
import { IconMessage } from '../../../base/icons/svg';
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
-
import PollItem from './PollItem';
import { chatStyles } from './styles';
-
const PollsList = () => {
- const polls = useSelector(state => state['features/polls'].polls);
+ const polls = useSelector((state: IReduxState) => state['features/polls'].polls);
const { t } = useTranslation();
const listPolls = Object.keys(polls);
@@ -24,10 +23,10 @@ const PollsList = () => {
pollId = { item } />)
, []);
- const flatlistRef = useRef();
+ const flatlistRef = useRef<FlatList>(null);
const scrollToBottom = () => {
- flatlistRef.current.scrollToEnd({ animating: true });
+ flatlistRef.current?.scrollToEnd({ animated: true });
};
useEffect(() => {
@@ -38,12 +37,12 @@ const PollsList = () => {
<>
{
listPolls.length === 0
- && <View style = { chatStyles.noPollContent }>
+ && <View style = { chatStyles.noPollContent as ViewStyle }>
<Icon
color = { BaseTheme.palette.icon03 }
size = { 160 }
src = { IconMessage } />
- <Text style = { chatStyles.noPollText } >
+ <Text style = { chatStyles.noPollText as TextStyle } >
{
t('polls.results.empty')
}
diff --git a/react/features/polls/components/native/PollsPane.js b/react/features/polls/components/native/PollsPane.tsx
similarity index 84%
rename from react/features/polls/components/native/PollsPane.js
rename to react/features/polls/components/native/PollsPane.tsx
index bb87922b38..0ff750ccb0 100644
--- a/react/features/polls/components/native/PollsPane.js
+++ b/react/features/polls/components/native/PollsPane.tsx
@@ -5,7 +5,9 @@ import React, { useEffect } from 'react';
import { Platform } from 'react-native';
import { useSelector } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
+import { StyleType } from '../../../base/styles/functions.any';
import Button from '../../../base/ui/components/native/Button';
import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import { TabBarLabelCounter }
@@ -17,12 +19,11 @@ import PollCreate from './PollCreate';
import PollsList from './PollsList';
import { chatStyles } from './styles';
-
const PollsPane = (props: AbstractProps) => {
const { createMode, onCreate, setCreateMode, t } = props;
const navigation = useNavigation();
- const { isPollsTabFocused } = useSelector(state => state['features/chat']);
- const { nbUnreadPolls } = useSelector(state => state['features/polls']);
+ const { isPollsTabFocused } = useSelector((state: IReduxState) => state['features/chat']);
+ const { nbUnreadPolls } = useSelector((state: IReduxState) => state['features/polls']);
useEffect(() => {
const activeUnreadPollsNr = !isPollsTabFocused && nbUnreadPolls > 0;
@@ -45,10 +46,10 @@ const PollsPane = (props: AbstractProps) => {
return (
<JitsiScreen
- contentContainerStyle = { chatStyles.pollPane }
+ contentContainerStyle = { chatStyles.pollPane as StyleType }
disableForcedKeyboardDismiss = { true }
hasTabNavigator = { true }
- style = { chatStyles.pollPaneContainer }>
+ style = { chatStyles.pollPaneContainer as StyleType }>
{
createMode
? <PollCreate setCreateMode = { setCreateMode } />
diff --git a/react/features/polls/components/native/styles.js b/react/features/polls/components/native/styles.ts
similarity index 100%
rename from react/features/polls/components/native/styles.js
rename to react/features/polls/components/native/styles.ts
diff --git a/react/features/prejoin/components/native/Prejoin.tsx b/react/features/prejoin/components/native/Prejoin.tsx
index 534fac51c5..91bc75f0a9 100644
--- a/react/features/prejoin/components/native/Prejoin.tsx
+++ b/react/features/prejoin/components/native/Prejoin.tsx
@@ -1,7 +1,4 @@
-/* eslint-disable lines-around-comment */
-
import { useIsFocused } from '@react-navigation/native';
-// @ts-ignore
import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
@@ -10,7 +7,8 @@ import {
StyleProp,
Text,
TextStyle,
- View
+ View,
+ ViewStyle
} from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
@@ -22,7 +20,6 @@ import { connect } from '../../../base/connection/actions.native';
import { PREJOIN_PAGE_HIDE_DISPLAY_NAME } from '../../../base/flags/constants';
import { getFeatureFlag } from '../../../base/flags/functions';
import { IconCloseLarge } from '../../../base/icons/svg';
-// @ts-ignore
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { getLocalParticipant } from '../../../base/participants/functions';
import { getFieldValue } from '../../../base/react/functions';
@@ -32,25 +29,17 @@ import Button from '../../../base/ui/components/native/Button';
import Input from '../../../base/ui/components/native/Input';
import { BUTTON_TYPES } from '../../../base/ui/constants.native';
import BrandingImageBackground from '../../../dynamic-branding/components/native/BrandingImageBackground';
-// @ts-ignore
import LargeVideo from '../../../large-video/components/LargeVideo.native';
-// @ts-ignore
import HeaderNavigationButton from '../../../mobile/navigation/components/HeaderNavigationButton';
-// @ts-ignore
import { navigateRoot } from '../../../mobile/navigation/rootNavigationContainerRef';
-// @ts-ignore
import { screen } from '../../../mobile/navigation/routes';
-// @ts-ignore
import AudioMuteButton from '../../../toolbox/components/AudioMuteButton';
-// @ts-ignore
import VideoMuteButton from '../../../toolbox/components/VideoMuteButton';
import { isDisplayNameRequired } from '../../functions';
import { IPrejoinProps } from '../../types';
-// @ts-ignore
import { preJoinStyles as styles } from './styles';
-
const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
const dispatch = useDispatch();
const isFocused = useIsFocused();
@@ -161,19 +150,16 @@ const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
<LargeVideo />
</View>
}
- <View style = { contentContainerStyles }>
- <View style = { styles.toolboxContainer }>
+ <View style = { contentContainerStyles as ViewStyle }>
+ <View style = { styles.toolboxContainer as ViewStyle }>
<AudioMuteButton
- // @ts-ignore
styles = { styles.buttonStylesBorderless } />
<VideoMuteButton
- // @ts-ignore
styles = { styles.buttonStylesBorderless } />
</View>
{
isDisplayNameVisible
&& <Input
- // @ts-ignore
customStyles = {{ input: styles.customInput }}
onChange = { onChangeDisplayName }
placeholder = { t('dialog.enterDisplayName') }
@@ -183,8 +169,7 @@ const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
accessibilityLabel = 'prejoin.joinMeeting'
disabled = { joinButtonDisabled }
labelKey = 'prejoin.joinMeeting'
- // @ts-ignore
- onClick = { !isJoining && onJoin }
+ onClick = { isJoining ? undefined : onJoin }
style = { styles.joinButton }
type = { PRIMARY } />
<Button
diff --git a/react/features/prejoin/components/native/styles.js b/react/features/prejoin/components/native/styles.ts
similarity index 99%
rename from react/features/prejoin/components/native/styles.js
rename to react/features/prejoin/components/native/styles.ts
index ae375a40e3..b5e8bc8149 100644
--- a/react/features/prejoin/components/native/styles.js
+++ b/react/features/prejoin/components/native/styles.ts
@@ -1,6 +1,5 @@
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
-
export const preJoinStyles = {
joinButton: {
diff --git a/react/features/room-lock/components/PasswordRequiredPrompt.native.js b/react/features/room-lock/components/PasswordRequiredPrompt.native.tsx
similarity index 85%
rename from react/features/room-lock/components/PasswordRequiredPrompt.native.js
rename to react/features/room-lock/components/PasswordRequiredPrompt.native.tsx
index f1fd600e6f..5dccc75e1c 100644
--- a/react/features/room-lock/components/PasswordRequiredPrompt.native.js
+++ b/react/features/room-lock/components/PasswordRequiredPrompt.native.tsx
@@ -1,56 +1,55 @@
-// @flow
-
import React, { Component } from 'react';
import { connect } from 'react-redux';
-import type { Dispatch } from 'redux';
+import { IReduxState, IStore } from '../../app/types';
import { setPassword } from '../../base/conference/actions';
+import { IJitsiConference } from '../../base/conference/reducer';
import InputDialog from '../../base/dialog/components/native/InputDialog';
import { _cancelPasswordRequiredPrompt } from '../actions';
/**
* {@code PasswordRequiredPrompt}'s React {@code Component} prop types.
*/
-type Props = {
+interface IProps {
/**
* The previously entered password, if any.
*/
- _password: ?string,
+ _password?: string;
/**
* The {@code JitsiConference} which requires a password.
*
* @type {JitsiConference}
*/
- conference: { join: Function },
+ conference: IJitsiConference;
/**
* The redux dispatch function.
*/
- dispatch: Dispatch<any>
-};
+ dispatch: IStore['dispatch'];
+}
-type State = {
+interface IState {
/**
* The previously entered password, if any.
*/
- password: ?string
+ password?: string;
}
/**
* Implements a React {@code Component} which prompts the user when a password
* is required to join a conference.
*/
-class PasswordRequiredPrompt extends Component<Props, State> {
+class PasswordRequiredPrompt extends Component<IProps, IState> {
/**
* Initializes a new {@code PasswordRequiredPrompt} instance.
*
- * @param {Props} props - The read-only React {@code Component} props with
+ * @param {IProps} props - The read-only React {@code Component} props with
* which the new instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this.state = {
@@ -104,8 +103,6 @@ class PasswordRequiredPrompt extends Component<Props, State> {
);
}
- _onCancel: () => boolean;
-
/**
* Notifies this prompt that it has been dismissed by cancel.
*
@@ -120,8 +117,6 @@ class PasswordRequiredPrompt extends Component<Props, State> {
return true;
}
- _onSubmit: (?string) => boolean;
-
/**
* Notifies this prompt that it has been dismissed by submitting a specific
* value.
@@ -131,8 +126,8 @@ class PasswordRequiredPrompt extends Component<Props, State> {
* @returns {boolean} If this prompt is to be closed/hidden, {@code true};
* otherwise, {@code false}.
*/
- _onSubmit(value: ?string) {
- const { conference }: { conference: { join: Function } } = this.props;
+ _onSubmit(value?: string) {
+ const { conference } = this.props;
this.props.dispatch(setPassword(conference, conference.join, value));
@@ -144,9 +139,9 @@ class PasswordRequiredPrompt extends Component<Props, State> {
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
return {
_password: state['features/base/conference'].password
};
diff --git a/react/features/settings/components/native/FormSection.tsx b/react/features/settings/components/native/FormSection.tsx
index 66e361d8ee..70b0067701 100644
--- a/react/features/settings/components/native/FormSection.tsx
+++ b/react/features/settings/components/native/FormSection.tsx
@@ -1,4 +1,4 @@
-import React, { ReactChildren } from 'react';
+import React from 'react';
import { WithTranslation } from 'react-i18next';
import { Text, View } from 'react-native';
@@ -16,7 +16,7 @@ interface IProps extends WithTranslation {
/**
* The children to be displayed within this Link.
*/
- children: ReactChildren;
+ children: React.ReactNode;
/**
* The i18n key of the text label of the section.
diff --git a/react/features/settings/components/native/SettingsView.tsx b/react/features/settings/components/native/SettingsView.tsx
index 79b32f7a4c..53461a45e5 100644
--- a/react/features/settings/components/native/SettingsView.tsx
+++ b/react/features/settings/components/native/SettingsView.tsx
@@ -1,5 +1,3 @@
-/* eslint-disable lines-around-comment */
-
import _ from 'lodash';
import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
@@ -10,35 +8,30 @@ import {
Platform,
ScrollView,
Text,
- View
+ View,
+ ViewStyle
} from 'react-native';
import { Divider } from 'react-native-paper';
import { connect } from 'react-redux';
-
import { getDefaultURL } from '../../../app/functions.native';
import { IReduxState } from '../../../app/types';
import Avatar from '../../../base/avatar/components/Avatar';
import { getLegalUrls } from '../../../base/config/functions.native';
import { translate } from '../../../base/i18n/functions';
-// @ts-ignore
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { getLocalParticipant } from '../../../base/participants/functions';
import { updateSettings } from '../../../base/settings/actions';
import Button from '../../../base/ui/components/native/Button';
import Input from '../../../base/ui/components/native/Input';
import Switch from '../../../base/ui/components/native/Switch';
-// @ts-ignore
import { BUTTON_TYPES } from '../../../base/ui/constants.any';
-// @ts-ignore
import { AVATAR_SIZE } from '../../../welcome/components/styles';
import { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions.native';
// @ts-ignore
import FormRow from './FormRow';
-// @ts-ignore
import FormSection from './FormSection';
-// @ts-ignore
import styles from './styles';
/**
@@ -286,20 +279,19 @@ class SettingsView extends Component<IProps, IState> {
return (
<JitsiScreen
disableForcedKeyboardDismiss = { true }
+
// @ts-ignore
safeAreaInsets = { [ addBottomInset && 'bottom', 'left', 'right' ].filter(Boolean) }
style = { styles.settingsViewContainer }>
<ScrollView bounces = { scrollBounces }>
- <View style = { styles.avatarContainer }>
+ <View style = { styles.avatarContainer as ViewStyle }>
<Avatar
participantId = { this.props._localParticipantId }
size = { AVATAR_SIZE } />
</View>
- {/* @ts-ignore */}
<FormSection
label = 'settingsView.profileSection'>
<Input
- // @ts-ignore
customStyles = {{ container: styles.customContainer }}
label = { t('settingsView.displayName') }
onChange = { this._onChangeDisplayName }
@@ -309,7 +301,6 @@ class SettingsView extends Component<IProps, IState> {
{/* @ts-ignore */}
<Divider style = { styles.fieldSeparator } />
<Input
- // @ts-ignore
autoCapitalize = 'none'
customStyles = {{ container: styles.customContainer }}
keyboardType = { 'email-address' }
@@ -319,11 +310,9 @@ class SettingsView extends Component<IProps, IState> {
textContentType = { 'emailAddress' } // iOS only
value = { email ?? '' } />
</FormSection>
- {/* @ts-ignore */}
<FormSection
label = 'settingsView.conferenceSection'>
<Input
- // @ts-ignore
autoCapitalize = 'none'
customStyles = {{ container: styles.customContainer }}
editable = { this.props._serverURLChangeEnabled }
@@ -339,7 +328,6 @@ class SettingsView extends Component<IProps, IState> {
<FormRow label = 'settingsView.startCarModeInLowBandwidthMode'>
<Switch
checked = { Boolean(startCarMode) }
- // @ts-ignore
onChange = { this._onStartCarmodeInLowBandwidthMode } />
</FormRow>
{/* @ts-ignore */}
@@ -348,7 +336,6 @@ class SettingsView extends Component<IProps, IState> {
label = 'settingsView.startWithAudioMuted'>
<Switch
checked = { Boolean(startWithAudioMuted) }
- // @ts-ignore
onChange = { this._onStartAudioMutedChange } />
</FormRow>
{/* @ts-ignore */}
@@ -356,7 +343,6 @@ class SettingsView extends Component<IProps, IState> {
<FormRow label = 'settingsView.startWithVideoMuted'>
<Switch
checked = { Boolean(startWithVideoMuted) }
- // @ts-ignore
onChange = { this._onStartVideoMutedChange } />
</FormRow>
{/* @ts-ignore */}
@@ -364,11 +350,9 @@ class SettingsView extends Component<IProps, IState> {
<FormRow label = 'videothumbnail.hideSelfView'>
<Switch
checked = { Boolean(disableSelfView) }
- // @ts-ignore
onChange = { this._onDisableSelfView } />
</FormRow>
</FormSection>
- {/* @ts-ignore */}
<FormSection
label = 'settingsView.links'>
<Button
@@ -394,10 +378,8 @@ class SettingsView extends Component<IProps, IState> {
style = { styles.linksButton }
type = { BUTTON_TYPES.TERTIARY } />
</FormSection>
- {/* @ts-ignore */}
<FormSection
label = 'settingsView.buildInfoSection'>
- {/* @ts-ignore */}
<FormRow
label = 'settingsView.version'>
<Text style = { styles.text }>
@@ -405,7 +387,6 @@ class SettingsView extends Component<IProps, IState> {
</Text>
</FormRow>
</FormSection>
- {/* @ts-ignore */}
<FormSection
label = 'settingsView.advanced'>
{ Platform.OS === 'android' && (
@@ -414,7 +395,6 @@ class SettingsView extends Component<IProps, IState> {
label = 'settingsView.disableCallIntegration'>
<Switch
checked = { Boolean(disableCallIntegration) }
- // @ts-ignore
onChange = { this._onDisableCallIntegration } />
</FormRow>
{/* @ts-ignore */}
@@ -425,7 +405,6 @@ class SettingsView extends Component<IProps, IState> {
label = 'settingsView.disableP2P'>
<Switch
checked = { Boolean(disableP2P) }
- // @ts-ignore
onChange = { this._onDisableP2P } />
</FormRow>
{/* @ts-ignore */}
@@ -436,7 +415,6 @@ class SettingsView extends Component<IProps, IState> {
label = 'settingsView.disableCrashReporting'>
<Switch
checked = { Boolean(disableCrashReporting) }
- // @ts-ignore
onChange = { this._onDisableCrashReporting } />
</FormRow>
)}
@@ -516,7 +494,7 @@ class SettingsView extends Component<IProps, IState> {
* @private
* @returns {void}
*/
- _onDisableCallIntegration(disableCallIntegration: boolean) {
+ _onDisableCallIntegration(disableCallIntegration?: boolean) {
this.setState({
disableCallIntegration
});
@@ -534,7 +512,7 @@ class SettingsView extends Component<IProps, IState> {
* @private
* @returns {void}
*/
- _onDisableP2P(disableP2P: boolean) {
+ _onDisableP2P(disableP2P?: boolean) {
this.setState({
disableP2P
});
@@ -551,7 +529,7 @@ class SettingsView extends Component<IProps, IState> {
* @private
* @returns {void}
*/
- _onDisableSelfView(disableSelfView: boolean) {
+ _onDisableSelfView(disableSelfView?: boolean) {
this.setState({
disableSelfView
});
@@ -568,7 +546,7 @@ class SettingsView extends Component<IProps, IState> {
* @private
* @returns {void}
*/
- _onStartCarmodeInLowBandwidthMode(startCarMode: boolean) {
+ _onStartCarmodeInLowBandwidthMode(startCarMode?: boolean) {
this.setState({
startCarMode
});
@@ -586,11 +564,11 @@ class SettingsView extends Component<IProps, IState> {
* @private
* @returns {void}
*/
- _onDisableCrashReporting(disableCrashReporting: boolean) {
+ _onDisableCrashReporting(disableCrashReporting?: boolean) {
if (disableCrashReporting) {
this._showCrashReportingDisableAlert();
} else {
- this._disableCrashReporting(disableCrashReporting);
+ this._disableCrashReporting(Boolean(disableCrashReporting));
}
}
@@ -612,7 +590,7 @@ class SettingsView extends Component<IProps, IState> {
* @protected
* @returns {void}
*/
- _onStartAudioMutedChange(startWithAudioMuted: boolean) {
+ _onStartAudioMutedChange(startWithAudioMuted?: boolean) {
this.setState({
startWithAudioMuted
});
@@ -630,7 +608,7 @@ class SettingsView extends Component<IProps, IState> {
* @protected
* @returns {void}
*/
- _onStartVideoMutedChange(startWithVideoMuted: boolean) {
+ _onStartVideoMutedChange(startWithVideoMuted?: boolean) {
this.setState({
startWithVideoMuted
});
diff --git a/react/features/settings/components/native/styles.js b/react/features/settings/components/native/styles.ts
similarity index 100%
rename from react/features/settings/components/native/styles.js
rename to react/features/settings/components/native/styles.ts
diff --git a/react/features/shared-video/components/native/styles.ts b/react/features/shared-video/components/native/styles.ts
index dfae7086ac..37052470bb 100644
--- a/react/features/shared-video/components/native/styles.ts
+++ b/react/features/shared-video/components/native/styles.ts
@@ -1,5 +1,3 @@
-// @flow
-
/**
* The style of toolbar buttons.
*/
diff --git a/react/features/video-menu/components/native/ConnectionStatusComponent.tsx b/react/features/video-menu/components/native/ConnectionStatusComponent.tsx
index 1d531ca467..5cbb812a4a 100644
--- a/react/features/video-menu/components/native/ConnectionStatusComponent.tsx
+++ b/react/features/video-menu/components/native/ConnectionStatusComponent.tsx
@@ -1,23 +1,18 @@
-/* eslint-disable lines-around-comment */
-
import React, { PureComponent } from 'react';
import { WithTranslation } from 'react-i18next';
-import { Text, View } from 'react-native';
+import { Text, TextStyle, View, ViewStyle } from 'react-native';
import { withTheme } from 'react-native-paper';
import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
import Avatar from '../../../base/avatar/components/Avatar';
import { hideSheet } from '../../../base/dialog/actions';
-// @ts-ignore
import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
-// @ts-ignore
import { bottomSheetStyles } from '../../../base/dialog/components/native/styles';
import { translate } from '../../../base/i18n/functions';
import { IconArrowDownLarge, IconArrowUpLarge } from '../../../base/icons/svg';
import { MEDIA_TYPE } from '../../../base/media/constants';
import { getParticipantDisplayName } from '../../../base/participants/functions';
-// @ts-ignore
import BaseIndicator from '../../../base/react/components/native/BaseIndicator';
import {
getTrackByMediaTypeAndParticipant
@@ -28,7 +23,6 @@ import {
} from '../../../connection-indicator/functions';
import statsEmitter from '../../../connection-indicator/statsEmitter';
-// @ts-ignore
import styles from './styles';
/**
@@ -155,17 +149,17 @@ class ConnectionStatusComponent extends PureComponent<IProps, IState> {
<BottomSheet
onCancel = { this._onCancel }
renderHeader = { this._renderMenuHeader }>
- <View style = { styles.statsWrapper }>
- <View style = { styles.statsInfoCell }>
- <Text style = { styles.statsTitleText }>
+ <View style = { styles.statsWrapper as ViewStyle }>
+ <View style = { styles.statsInfoCell as ViewStyle }>
+ <Text style = { styles.statsTitleText as TextStyle }>
{ t('connectionindicator.status') }
</Text>
- <Text style = { styles.statsInfoText }>
+ <Text style = { styles.statsInfoText as TextStyle }>
{ t(this.state.connectionString) }
</Text>
</View>
- <View style = { styles.statsInfoCell }>
- <Text style = { styles.statsTitleText }>
+ <View style = { styles.statsInfoCell as ViewStyle }>
+ <Text style = { styles.statsTitleText as TextStyle }>
{ t('connectionindicator.bitrate') }
</Text>
<BaseIndicator
@@ -173,7 +167,7 @@ class ConnectionStatusComponent extends PureComponent<IProps, IState> {
iconStyle = {{
color: palette.icon03
}} />
- <Text style = { styles.statsInfoText }>
+ <Text style = { styles.statsInfoText as TextStyle }>
{ this.state.downloadString }
</Text>
<BaseIndicator
@@ -181,12 +175,12 @@ class ConnectionStatusComponent extends PureComponent<IProps, IState> {
iconStyle = {{
color: palette.icon03
}} />
- <Text style = { styles.statsInfoText }>
+ <Text style = { styles.statsInfoText as TextStyle }>
{ `${this.state.uploadString} Kbps` }
</Text>
</View>
- <View style = { styles.statsInfoCell }>
- <Text style = { styles.statsTitleText }>
+ <View style = { styles.statsInfoCell as ViewStyle }>
+ <Text style = { styles.statsTitleText as TextStyle }>
{ t('connectionindicator.packetloss') }
</Text>
<BaseIndicator
@@ -194,7 +188,7 @@ class ConnectionStatusComponent extends PureComponent<IProps, IState> {
iconStyle = {{
color: palette.icon03
}} />
- <Text style = { styles.statsInfoText }>
+ <Text style = { styles.statsInfoText as TextStyle }>
{ this.state.packetLostDownloadString }
</Text>
<BaseIndicator
@@ -202,23 +196,23 @@ class ConnectionStatusComponent extends PureComponent<IProps, IState> {
iconStyle = {{
color: palette.icon03
}} />
- <Text style = { styles.statsInfoText }>
+ <Text style = { styles.statsInfoText as TextStyle }>
{ this.state.packetLostUploadString }
</Text>
</View>
- <View style = { styles.statsInfoCell }>
- <Text style = { styles.statsTitleText }>
+ <View style = { styles.statsInfoCell as ViewStyle }>
+ <Text style = { styles.statsTitleText as TextStyle }>
{ t('connectionindicator.resolution') }
</Text>
- <Text style = { styles.statsInfoText }>
+ <Text style = { styles.statsInfoText as TextStyle }>
{ this.state.resolutionString }
</Text>
</View>
- <View style = { styles.statsInfoCell }>
- <Text style = { styles.statsTitleText }>
+ <View style = { styles.statsInfoCell as ViewStyle }>
+ <Text style = { styles.statsTitleText as TextStyle }>
{ t('connectionindicator.codecs') }
</Text>
- <Text style = { styles.statsInfoText }>
+ <Text style = { styles.statsInfoText as TextStyle }>
{ this.state.codecString }
</Text>
</View>
@@ -445,11 +439,11 @@ class ConnectionStatusComponent extends PureComponent<IProps, IState> {
<View
style = { [
bottomSheetStyles.sheet,
- styles.participantNameContainer ] }>
+ styles.participantNameContainer ] as ViewStyle[] }>
<Avatar
participantId = { participantID }
size = { AVATAR_SIZE } />
- <Text style = { styles.participantNameLabel }>
+ <Text style = { styles.participantNameLabel as TextStyle }>
{ this.props._participantDisplayName }
</Text>
</View>
diff --git a/react/features/video-menu/components/native/MuteEveryonesVideoDialog.js b/react/features/video-menu/components/native/MuteEveryonesVideoDialog.tsx
similarity index 91%
rename from react/features/video-menu/components/native/MuteEveryonesVideoDialog.js
rename to react/features/video-menu/components/native/MuteEveryonesVideoDialog.tsx
index 75cbcdc48b..877af66570 100644
--- a/react/features/video-menu/components/native/MuteEveryonesVideoDialog.js
+++ b/react/features/video-menu/components/native/MuteEveryonesVideoDialog.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { ViewStyle } from 'react-native';
import Dialog from 'react-native-dialog';
import { Divider } from 'react-native-paper';
import { connect } from 'react-redux';
@@ -46,7 +47,8 @@ class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<IProps>
descriptionKey = { this.state.content }
onSubmit = { this._onSubmit }
title = { this.props.title }>
- <Divider style = { styles.dividerDialog } />
+ {/* @ts-ignore */}
+ <Divider style = { styles.dividerDialog as ViewStyle } />
{ this._renderSwitch() }
</ConfirmDialog>
);
diff --git a/react/features/video-menu/components/native/styles.js b/react/features/video-menu/components/native/styles.ts
similarity index 99%
rename from react/features/video-menu/components/native/styles.js
rename to react/features/video-menu/components/native/styles.ts
index 9940a799e4..e5c35efbcb 100644
--- a/react/features/video-menu/components/native/styles.js
+++ b/react/features/video-menu/components/native/styles.ts
@@ -1,5 +1,3 @@
-// @flow
-
import {
MD_FONT_SIZE,
MD_ITEM_HEIGHT,