From e17817ae0630c52e4f94682b3cafe86fea471a79 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Wed, 10 Nov 2021 16:12:26 -0300 Subject: [PATCH] Chore: Migrate AddChannelTeamView to Typescript (#3471) Co-authored-by: AlexAlexandre --- ...nnelTeamView.js => AddChannelTeamView.tsx} | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) rename app/views/{AddChannelTeamView.js => AddChannelTeamView.tsx} (77%) diff --git a/app/views/AddChannelTeamView.js b/app/views/AddChannelTeamView.tsx similarity index 77% rename from app/views/AddChannelTeamView.js rename to app/views/AddChannelTeamView.tsx index b93f5fb7..d477f9ba 100644 --- a/app/views/AddChannelTeamView.js +++ b/app/views/AddChannelTeamView.tsx @@ -1,5 +1,6 @@ import React, { useEffect } from 'react'; -import PropTypes from 'prop-types'; +import { StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack'; +import { RouteProp } from '@react-navigation/native'; import { connect } from 'react-redux'; import * as List from '../containers/List'; @@ -9,8 +10,16 @@ import * as HeaderButton from '../containers/HeaderButton'; import SafeAreaView from '../containers/SafeAreaView'; import I18n from '../i18n'; -const setHeader = (navigation, isMasterDetail) => { - const options = { +type TNavigation = StackNavigationProp; + +interface IAddChannelTeamView { + route: RouteProp<{ AddChannelTeamView: { teamId: string; teamChannels: object[] } }, 'AddChannelTeamView'>; + navigation: TNavigation; + isMasterDetail: boolean; +} + +const setHeader = (navigation: TNavigation, isMasterDetail: boolean) => { + const options: StackNavigationOptions = { headerTitle: I18n.t('Add_Channel_to_Team') }; @@ -21,7 +30,7 @@ const setHeader = (navigation, isMasterDetail) => { navigation.setOptions(options); }; -const AddChannelTeamView = ({ navigation, route, isMasterDetail }) => { +const AddChannelTeamView = ({ navigation, route, isMasterDetail }: IAddChannelTeamView) => { const { teamId, teamChannels } = route.params; const { theme } = useTheme(); @@ -66,13 +75,7 @@ const AddChannelTeamView = ({ navigation, route, isMasterDetail }) => { ); }; -AddChannelTeamView.propTypes = { - route: PropTypes.object, - navigation: PropTypes.object, - isMasterDetail: PropTypes.bool -}; - -const mapStateToProps = state => ({ +const mapStateToProps = (state: any) => ({ isMasterDetail: state.app.isMasterDetail });