Chore: Migrate AdminPanelView to Typescript (#3377)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Alex Junior 2021-09-15 10:18:53 -03:00 committed by GitHub
parent b59fa0f199
commit 93d734bfa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { WebView } from 'react-native-webview'; import { WebView } from 'react-native-webview';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { DrawerScreenProps } from '@react-navigation/drawer';
import I18n from '../../i18n'; import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
@ -10,17 +10,22 @@ import { withTheme } from '../../theme';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
class AdminPanelView extends React.Component { interface IAdminPanelViewProps {
static navigationOptions = ({ navigation, isMasterDetail }) => ({ baseUrl: string;
token: string;
}
interface INavigationOptions {
navigation: DrawerScreenProps<any>;
isMasterDetail: boolean;
}
class AdminPanelView extends React.Component<IAdminPanelViewProps, any> {
static navigationOptions = ({ navigation, isMasterDetail }: INavigationOptions) => ({
headerLeft: isMasterDetail ? undefined : () => <HeaderButton.Drawer navigation={navigation} />, headerLeft: isMasterDetail ? undefined : () => <HeaderButton.Drawer navigation={navigation} />,
title: I18n.t('Admin_Panel') title: I18n.t('Admin_Panel')
}); });
static propTypes = {
baseUrl: PropTypes.string,
token: PropTypes.string
};
render() { render() {
const { baseUrl, token } = this.props; const { baseUrl, token } = this.props;
if (!baseUrl) { if (!baseUrl) {
@ -40,7 +45,7 @@ class AdminPanelView extends React.Component {
} }
} }
const mapStateToProps = state => ({ const mapStateToProps = (state: any) => ({
baseUrl: state.server.server, baseUrl: state.server.server,
token: getUserSelector(state).token token: getUserSelector(state).token
}); });