From 1efd6a9a65b2a5071d87b8991fe22078d75b5a9a Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Mon, 2 May 2022 14:59:49 -0300 Subject: [PATCH] Chore: Evaluate AutoTranslate- TypeScript (#4145) --- app/views/AutoTranslateView/index.tsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/app/views/AutoTranslateView/index.tsx b/app/views/AutoTranslateView/index.tsx index 14cadea6e..b01a21ecf 100644 --- a/app/views/AutoTranslateView/index.tsx +++ b/app/views/AutoTranslateView/index.tsx @@ -1,16 +1,16 @@ import React from 'react'; import { FlatList, StyleSheet, Switch } from 'react-native'; -import { RouteProp } from '@react-navigation/core'; +import { Observable, Subscription } from 'rxjs'; import { ChatsStackParamList } from '../../stacks/types'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; import * as List from '../../containers/List'; import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants'; -import { TSupportedThemes, withTheme } from '../../theme'; +import { withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; import { events, logEvent } from '../../utils/log'; -import { ISubscription } from '../../definitions/ISubscription'; +import { IBaseScreen, ISubscription } from '../../definitions'; import { Services } from '../../lib/services'; const styles = StyleSheet.create({ @@ -19,22 +19,19 @@ const styles = StyleSheet.create({ } }); -interface IAutoTranslateViewProps { - route: RouteProp; - theme: TSupportedThemes; -} +type TAutoTranslateViewProps = IBaseScreen; -class AutoTranslateView extends React.Component { +class AutoTranslateView extends React.Component { static navigationOptions = () => ({ title: I18n.t('Auto_Translate') }); private mounted: boolean; private rid: string; - private roomObservable: any; - private subscription: any; + private roomObservable?: Observable; + private subscription?: Subscription; - constructor(props: IAutoTranslateViewProps) { + constructor(props: TAutoTranslateViewProps) { super(props); this.mounted = false; this.rid = props.route.params?.rid ?? ''; @@ -111,7 +108,7 @@ class AutoTranslateView extends React.Component { renderIcon = () => { const { theme } = this.props; - return ; + return ; }; renderSwitch = () => {