Skip to content

Commit

Permalink
Formatting + unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlixH committed Nov 26, 2021
1 parent 1f32d81 commit 7851438
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 51 deletions.
79 changes: 46 additions & 33 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { StatusBar } from 'react-native';
import { RootSiblingParent } from 'react-native-root-siblings';
import { scale } from 'react-native-size-matters';

import computeStyleSheet from './AppStyles';
import DeepLinkingManager from './deeplinking/DeepLinkingManager';
import I18nManager from './I18n/I18nManager';
import LocationManager from './location/LocationManager';
Expand Down Expand Up @@ -172,7 +171,8 @@ function createChargingStationDetailsTabsNavigator(props: BaseProps) {
barStyle={barStyle}
labeled
shifting={true}
backBehavior="history">
backBehavior="history"
>
<ChargingStationDetailsTabs.Screen
name="ChargingStationActions"
component={ChargingStationActions}
Expand Down Expand Up @@ -277,17 +277,31 @@ function createTransactionDetailsTabsNavigator(props: BaseProps) {
function createSitesNavigator(props: BaseProps) {
return (
<SitesStack.Navigator initialRouteName="Sites" screenOptions={{ headerShown: false }}>
<SitesStack.Screen name="Sites" component={Sites} initialParams={props?.route?.params?.params} />
<SitesStack.Screen name="SiteAreas" component={SiteAreas} initialParams={props?.route?.params?.params} />
<SitesStack.Screen name="ChargingStations" component={ChargingStations} initialParams={props?.route?.params?.params} />
<ChargingStationsStack.Screen name="AddCar" component={AddCar} initialParams={props?.route?.params?.params} />
<SitesStack.Screen
name="Sites"
component={Sites}
initialParams={props?.route?.params?.params}
/>
<SitesStack.Screen
name="SiteAreas"
component={SiteAreas}
initialParams={props?.route?.params?.params}
/>
<SitesStack.Screen
name="ChargingStations"
component={ChargingStations}
initialParams={props?.route?.params?.params}
/>
<ChargingStationsStack.Screen
name="AddCar" component={AddCar}
initialParams={props?.route?.params?.params}
/>
<ChargingStationsStack.Screen
name="AddPaymentMethod"
component={StripePaymentMethodCreationForm}
initialParams={props?.route?.params?.params}
/>
<SitesStack.Screen
name="ChargingStationDetailsTabs"
<SitesStack.Screen name="ChargingStationDetailsTabs"
component={createChargingStationDetailsTabsNavigator}
initialParams={props?.route?.params?.params}
/>
Expand All @@ -301,15 +315,23 @@ function createSitesNavigator(props: BaseProps) {
component={createTransactionDetailsTabsNavigator}
initialParams={props?.route?.params?.params}
/>
<SitesStack.Screen name="ReportError" component={ReportError} initialParams={props?.route?.params?.params} />
<SitesStack.Screen
name="ReportError"
component={ReportError}
initialParams={props?.route?.params?.params}
/>
</SitesStack.Navigator>
);
}

function createChargingStationsNavigator(props: BaseProps) {
return (
<ChargingStationsStack.Navigator initialRouteName="ChargingStations" screenOptions={{ headerShown: false, gestureEnabled: false }}>
<ChargingStationsStack.Screen name="ChargingStations" component={ChargingStations} initialParams={props?.route?.params?.params} />
<ChargingStationsStack.Screen
name="ChargingStations"
component={ChargingStations}
initialParams={props?.route?.params?.params}
/>
<ChargingStationsStack.Screen
name="ChargingStationDetailsTabs"
component={createChargingStationDetailsTabsNavigator}
Expand All @@ -332,7 +354,11 @@ function createChargingStationsNavigator(props: BaseProps) {
component={createTransactionDetailsTabsNavigator}
initialParams={props?.route?.params?.params}
/>
<ChargingStationsStack.Screen name="ReportError" component={ReportError} initialParams={props?.route?.params?.params} />
<ChargingStationsStack.Screen
name="ReportError"
component={ReportError}
initialParams={props?.route?.params?.params}
/>
</ChargingStationsStack.Navigator>
);
}
Expand Down Expand Up @@ -407,7 +433,11 @@ function createInvoicesNavigator(props: BaseProps) {
function createPaymentMethodsNavigator(props: BaseProps) {
return (
<PaymentMethodsStack.Navigator initialRouteName="PaymentMethods" screenOptions={{ headerShown: false }}>
<PaymentMethodsStack.Screen name="PaymentMethods" component={PaymentMethods} initialParams={props?.route?.params?.params} />
<PaymentMethodsStack.Screen
name="PaymentMethods"
component={PaymentMethods}
initialParams={props?.route?.params?.params}
/>
<PaymentMethodsStack.Screen
name="StripePaymentMethodCreationForm"
component={StripePaymentMethodCreationForm}
Expand All @@ -431,34 +461,18 @@ function createAppDrawerNavigator(props: BaseProps) {
backBehavior={'history'}
drawerPosition="left"
drawerContent={(drawerProps) => <Sidebar {...drawerProps} />}>
<AppDrawer.Screen
name="ChargingStationsNavigator"
component={createChargingStationsNavigator}
initialParams={props?.route?.params?.params}
/>
<AppDrawer.Screen name="ChargingStationsNavigator" component={createChargingStationsNavigator} initialParams={props?.route?.params?.params}/>
<AppDrawer.Screen name="QRCodeScanner" component={ChargingStationQrCode} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen name="SitesNavigator" component={createSitesNavigator} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen name="StatisticsNavigator" component={createStatsNavigator} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen name="ReportErrorNavigator" component={createReportErrorNavigator} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen
name="TransactionHistoryNavigator"
component={createTransactionHistoryNavigator}
initialParams={props?.route?.params?.params}
/>
<AppDrawer.Screen
name="TransactionInProgressNavigator"
component={createTransactionInProgressNavigator}
initialParams={props?.route?.params?.params}
/>
<AppDrawer.Screen name="TransactionHistoryNavigator" component={createTransactionHistoryNavigator} initialParams={props?.route?.params?.params}/>
<AppDrawer.Screen name="TransactionInProgressNavigator" component={createTransactionInProgressNavigator} initialParams={props?.route?.params?.params}/>
<AppDrawer.Screen name="UsersNavigator" component={createUsersNavigator} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen name="TagsNavigator" component={createTagsNavigator} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen name="CarsNavigator" component={createCarsNavigator} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen name="InvoicesNavigator" component={createInvoicesNavigator} initialParams={props?.route?.params?.params} />
<AppDrawer.Screen
name="PaymentMethodsNavigator"
component={createPaymentMethodsNavigator}
initialParams={props?.route?.params?.params}
/>
<AppDrawer.Screen name="PaymentMethodsNavigator" component={createPaymentMethodsNavigator} initialParams={props?.route?.params?.params}/>
</AppDrawer.Navigator>
);
}
Expand Down Expand Up @@ -563,7 +577,6 @@ export default class App extends React.Component<Props, State> {

public render() {
const { showAppUpdateDialog } = this.state;
const commonColors = Utils.getCurrentCommonColor();
return (
this.state.isNavigationStateLoaded && (
<RootSiblingParent>
Expand Down
13 changes: 2 additions & 11 deletions src/screens/auth/login/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import I18n from 'i18n-js';
import { Button, CheckBox, Form, Icon, Item, Spinner, Text, View } from 'native-base';
import React from 'react';
import {
BackHandler,
Keyboard,
KeyboardAvoidingView,
ScrollView,
TextInput,
TouchableOpacity
} from 'react-native';

import { BackHandler, Keyboard, KeyboardAvoidingView, ScrollView, TextInput, TouchableOpacity } from 'react-native';
import DialogModal from '../../../components/modal/DialogModal';
import ExitAppDialog from '../../../components/modal/exit-app/ExitAppDialog';
import computeModalCommonStyle from '../../../components/modal/ModalCommonStyle';
Expand All @@ -23,7 +15,6 @@ import Utils from '../../../utils/Utils';
import BaseScreen from '../../base-screen/BaseScreen';
import AuthHeader from '../AuthHeader';
import computeStyleSheet from '../AuthStyles';
import BaseAutoRefreshScreen from '../../base-screen/BaseAutoRefreshScreen';

export interface Props extends BaseProps {}

Expand All @@ -48,7 +39,7 @@ interface State {
showNoTenantFoundDialog: boolean;
}

export default class Login extends BaseAutoRefreshScreen<Props, State> {
export default class Login extends BaseScreen<Props, State> {
public state: State;
public props: Props;
private tenants: TenantConnection[] = [];
Expand Down
6 changes: 0 additions & 6 deletions src/screens/base-screen/BaseScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ export default class BaseScreen<P, S> extends React.Component<Props, State> {
}
}

public onAppStateChange(nextAppState: AppStateStatus): void {
if(nextAppState === 'active') {
this.componentDidFocus();
}
}

public getHeaderComponent(): HeaderComponent {
return this.headerComponent;
}
Expand Down
3 changes: 2 additions & 1 deletion src/screens/charging-stations/list/ChargingStations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export default class ChargingStations extends BaseAutoRefreshScreen<Props, State
refreshing,
satelliteMap
} = this.state;
const mapIsDisplayed = showMap && !Utils.isEmptyArray(this.state.chargingStations);
const chargingStationsWithGPSCoordinates = chargingStations.filter((chargingStation) =>
Utils.containsGPSCoordinates(chargingStation.coordinates)
);
Expand Down Expand Up @@ -409,7 +410,7 @@ export default class ChargingStations extends BaseAutoRefreshScreen<Props, State
onFilterChanged={(newFilters: ChargingStationsFiltersDef) => this.filterChanged(newFilters)}
ref={(chargingStationsFilters: ChargingStationsFilters) => this.setScreenFilters(chargingStationsFilters)}
/>
{showMap ? (
{mapIsDisplayed ? (
<View style={style.map}>
{this.currentRegion && (
<ClusterMap
Expand Down

0 comments on commit 7851438

Please sign in to comment.