From 93d734bfa95088e272609fbed6f8a8630eb9a335 Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Wed, 15 Sep 2021 10:18:53 -0300 Subject: [PATCH] Chore: Migrate AdminPanelView to Typescript (#3377) Co-authored-by: Diego Mello --- .../AdminPanelView/{index.js => index.tsx} | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) rename app/views/AdminPanelView/{index.js => index.tsx} (72%) diff --git a/app/views/AdminPanelView/index.js b/app/views/AdminPanelView/index.tsx similarity index 72% rename from app/views/AdminPanelView/index.js rename to app/views/AdminPanelView/index.tsx index b0101cf2..80f728e1 100644 --- a/app/views/AdminPanelView/index.js +++ b/app/views/AdminPanelView/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { WebView } from 'react-native-webview'; import { connect } from 'react-redux'; +import { DrawerScreenProps } from '@react-navigation/drawer'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; @@ -10,17 +10,22 @@ import { withTheme } from '../../theme'; import { getUserSelector } from '../../selectors/login'; import SafeAreaView from '../../containers/SafeAreaView'; -class AdminPanelView extends React.Component { - static navigationOptions = ({ navigation, isMasterDetail }) => ({ +interface IAdminPanelViewProps { + baseUrl: string; + token: string; +} + +interface INavigationOptions { + navigation: DrawerScreenProps; + isMasterDetail: boolean; +} + +class AdminPanelView extends React.Component { + static navigationOptions = ({ navigation, isMasterDetail }: INavigationOptions) => ({ headerLeft: isMasterDetail ? undefined : () => , title: I18n.t('Admin_Panel') }); - static propTypes = { - baseUrl: PropTypes.string, - token: PropTypes.string - }; - render() { const { baseUrl, token } = this.props; if (!baseUrl) { @@ -40,7 +45,7 @@ class AdminPanelView extends React.Component { } } -const mapStateToProps = state => ({ +const mapStateToProps = (state: any) => ({ baseUrl: state.server.server, token: getUserSelector(state).token });