Compare commits
No commits in common. "4d0df7a5b7d7f8b33893b5a7a9f06d01bc86253d" and "300558ac56438a60312ed9e73abf0634f7ce1d75" have entirely different histories.
4d0df7a5b7
...
300558ac56
11 changed files with 413 additions and 402 deletions
|
|
@ -22,7 +22,7 @@ import {TouchableRipple, useTheme} from 'react-native-paper';
|
|||
import {Dimensions, Image, View} from 'react-native';
|
||||
|
||||
type PropsType = {
|
||||
image?: string | number;
|
||||
image: string;
|
||||
isActive: boolean;
|
||||
onPress: () => void;
|
||||
};
|
||||
|
|
@ -51,17 +51,13 @@ function DashboardEditPreviewItem(props: PropsType) {
|
|||
width: itemSize,
|
||||
height: itemSize,
|
||||
}}>
|
||||
{props.image ? (
|
||||
<Image
|
||||
source={
|
||||
typeof props.image === 'string' ? {uri: props.image} : props.image
|
||||
}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
<Image
|
||||
source={{uri: props.image}}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</TouchableRipple>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -21,22 +21,36 @@ import * as React from 'react';
|
|||
import {Animated} from 'react-native';
|
||||
import {withTheme} from 'react-native-paper';
|
||||
import {Collapsible} from 'react-navigation-collapsible';
|
||||
import {StackNavigationProp} from '@react-navigation/stack';
|
||||
import TabIcon from './TabIcon';
|
||||
import TabHomeIcon from './TabHomeIcon';
|
||||
import {BottomTabBarProps} from '@react-navigation/bottom-tabs';
|
||||
import {NavigationState} from '@react-navigation/native';
|
||||
import {
|
||||
PartialState,
|
||||
Route,
|
||||
} from '@react-navigation/routers/lib/typescript/src/types';
|
||||
|
||||
type RouteType = Route<string> & {
|
||||
state?: NavigationState | PartialState<NavigationState>;
|
||||
type RouteType = {
|
||||
name: string;
|
||||
key: string;
|
||||
params: {collapsible: Collapsible};
|
||||
state: {
|
||||
index: number;
|
||||
routes: Array<RouteType>;
|
||||
};
|
||||
};
|
||||
|
||||
interface PropsType extends BottomTabBarProps {
|
||||
type PropsType = {
|
||||
state: {
|
||||
index: number;
|
||||
routes: Array<RouteType>;
|
||||
};
|
||||
descriptors: {
|
||||
[key: string]: {
|
||||
options: {
|
||||
tabBarLabel: string;
|
||||
title: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
navigation: StackNavigationProp<any>;
|
||||
theme: ReactNativePaper.Theme;
|
||||
}
|
||||
};
|
||||
|
||||
type StateType = {
|
||||
translateY: any;
|
||||
|
|
@ -150,7 +164,7 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
|
|||
onLongPress={onLongPress}
|
||||
icon={this.getTabBarIcon(route, isFocused)}
|
||||
color={color}
|
||||
label={label as string}
|
||||
label={label}
|
||||
focused={isFocused}
|
||||
extraData={state.index > index}
|
||||
key={route.key}
|
||||
|
|
@ -179,12 +193,9 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
|
|||
if (isFocused) {
|
||||
const stackState = route.state;
|
||||
const stackRoute =
|
||||
stackState && stackState.index
|
||||
? stackState.routes[stackState.index]
|
||||
: null;
|
||||
const params: {collapsible: Collapsible} | null | undefined = stackRoute
|
||||
? (stackRoute.params as {collapsible: Collapsible})
|
||||
: null;
|
||||
stackState != null ? stackState.routes[stackState.index] : null;
|
||||
const params: {collapsible: Collapsible} | null =
|
||||
stackRoute != null ? stackRoute.params : null;
|
||||
const collapsible = params != null ? params.collapsible : null;
|
||||
if (collapsible != null) {
|
||||
this.setState({
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
|
||||
import i18n from 'i18n-js';
|
||||
|
|
@ -38,63 +40,18 @@ import ClubListScreen from '../screens/Amicale/Clubs/ClubListScreen';
|
|||
import ClubAboutScreen from '../screens/Amicale/Clubs/ClubAboutScreen';
|
||||
import ClubDisplayScreen from '../screens/Amicale/Clubs/ClubDisplayScreen';
|
||||
import {
|
||||
CreateScreenCollapsibleStack,
|
||||
createScreenCollapsibleStack,
|
||||
getWebsiteStack,
|
||||
} from '../utils/CollapsibleUtils';
|
||||
import BugReportScreen from '../screens/Other/FeedbackScreen';
|
||||
import WebsiteScreen from '../screens/Services/WebsiteScreen';
|
||||
import EquipmentScreen, {
|
||||
DeviceType,
|
||||
} from '../screens/Amicale/Equipment/EquipmentListScreen';
|
||||
import EquipmentScreen from '../screens/Amicale/Equipment/EquipmentListScreen';
|
||||
import EquipmentLendScreen from '../screens/Amicale/Equipment/EquipmentRentScreen';
|
||||
import EquipmentConfirmScreen from '../screens/Amicale/Equipment/EquipmentConfirmScreen';
|
||||
import DashboardEditScreen from '../screens/Other/Settings/DashboardEditScreen';
|
||||
import GameStartScreen from '../screens/Game/screens/GameStartScreen';
|
||||
import ImageGalleryScreen from '../screens/Media/ImageGalleryScreen';
|
||||
|
||||
export enum MainRoutes {
|
||||
Main = 'main',
|
||||
Gallery = 'gallery',
|
||||
Settings = 'settings',
|
||||
DashboardEdit = 'dashboard-edit',
|
||||
About = 'about',
|
||||
Dependencies = 'dependencies',
|
||||
Debug = 'debug',
|
||||
GameStart = 'game-start',
|
||||
GameMain = 'game-main',
|
||||
Login = 'login',
|
||||
SelfMenu = 'self-menu',
|
||||
Proximo = 'proximo',
|
||||
ProximoList = 'proximo-list',
|
||||
ProximoAbout = 'proximo-about',
|
||||
Profile = 'profile',
|
||||
ClubList = 'club-list',
|
||||
ClubInformation = 'club-information',
|
||||
ClubAbout = 'club-about',
|
||||
EquipmentList = 'equipment-list',
|
||||
EquipmentRent = 'equipment-rent',
|
||||
EquipmentConfirm = 'equipment-confirm',
|
||||
Vote = 'vote',
|
||||
Feedback = 'feedback',
|
||||
}
|
||||
|
||||
type DefaultParams = {[key in MainRoutes]: object | undefined};
|
||||
|
||||
export interface FullParamsList extends DefaultParams {
|
||||
login: {nextScreen: string};
|
||||
'equipment-confirm': {
|
||||
item?: DeviceType;
|
||||
dates: [string, string];
|
||||
};
|
||||
'equipment-rent': {item?: DeviceType};
|
||||
gallery: {images: Array<{url: string}>};
|
||||
}
|
||||
|
||||
// Don't know why but TS is complaining without this
|
||||
// See: https://stackoverflow.com/questions/63652687/interface-does-not-satisfy-the-constraint-recordstring-object-undefined
|
||||
export type MainStackParamsList = FullParamsList &
|
||||
Record<string, object | undefined>;
|
||||
|
||||
const modalTransition =
|
||||
Platform.OS === 'ios'
|
||||
? TransitionPresets.ModalPresentationIOS
|
||||
|
|
@ -106,17 +63,19 @@ const defaultScreenOptions = {
|
|||
...TransitionPresets.SlideFromRightIOS,
|
||||
};
|
||||
|
||||
const MainStack = createStackNavigator<MainStackParamsList>();
|
||||
const MainStack = createStackNavigator();
|
||||
|
||||
function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||
function MainStackComponent(props: {
|
||||
createTabNavigator: () => React.Node,
|
||||
}): React.Node {
|
||||
const {createTabNavigator} = props;
|
||||
return (
|
||||
<MainStack.Navigator
|
||||
initialRouteName={MainRoutes.Main}
|
||||
initialRouteName="main"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
<MainStack.Screen
|
||||
name={MainRoutes.Main}
|
||||
name="main"
|
||||
component={createTabNavigator}
|
||||
options={{
|
||||
headerShown: false,
|
||||
|
|
@ -124,62 +83,62 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
|||
}}
|
||||
/>
|
||||
<MainStack.Screen
|
||||
name={MainRoutes.Gallery}
|
||||
name="gallery"
|
||||
component={ImageGalleryScreen}
|
||||
options={{
|
||||
headerShown: false,
|
||||
...modalTransition,
|
||||
}}
|
||||
/>
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Settings,
|
||||
{createScreenCollapsibleStack(
|
||||
'settings',
|
||||
MainStack,
|
||||
SettingsScreen,
|
||||
i18n.t('screens.settings.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.DashboardEdit,
|
||||
{createScreenCollapsibleStack(
|
||||
'dashboard-edit',
|
||||
MainStack,
|
||||
DashboardEditScreen,
|
||||
i18n.t('screens.settings.dashboardEdit.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.About,
|
||||
{createScreenCollapsibleStack(
|
||||
'about',
|
||||
MainStack,
|
||||
AboutScreen,
|
||||
i18n.t('screens.about.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Dependencies,
|
||||
{createScreenCollapsibleStack(
|
||||
'dependencies',
|
||||
MainStack,
|
||||
AboutDependenciesScreen,
|
||||
i18n.t('screens.about.libs'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Debug,
|
||||
{createScreenCollapsibleStack(
|
||||
'debug',
|
||||
MainStack,
|
||||
DebugScreen,
|
||||
i18n.t('screens.about.debug'),
|
||||
)}
|
||||
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.GameStart,
|
||||
{createScreenCollapsibleStack(
|
||||
'game-start',
|
||||
MainStack,
|
||||
GameStartScreen,
|
||||
i18n.t('screens.game.title'),
|
||||
true,
|
||||
undefined,
|
||||
null,
|
||||
'transparent',
|
||||
)}
|
||||
<MainStack.Screen
|
||||
name={MainRoutes.GameMain}
|
||||
name="game-main"
|
||||
component={GameMainScreen}
|
||||
options={{
|
||||
title: i18n.t('screens.game.title'),
|
||||
}}
|
||||
/>
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Login,
|
||||
{createScreenCollapsibleStack(
|
||||
'login',
|
||||
MainStack,
|
||||
LoginScreen,
|
||||
i18n.t('screens.login.title'),
|
||||
|
|
@ -189,26 +148,26 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
|||
)}
|
||||
{getWebsiteStack('website', MainStack, WebsiteScreen, '')}
|
||||
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.SelfMenu,
|
||||
{createScreenCollapsibleStack(
|
||||
'self-menu',
|
||||
MainStack,
|
||||
SelfMenuScreen,
|
||||
i18n.t('screens.menu.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Proximo,
|
||||
{createScreenCollapsibleStack(
|
||||
'proximo',
|
||||
MainStack,
|
||||
ProximoMainScreen,
|
||||
i18n.t('screens.proximo.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.ProximoList,
|
||||
{createScreenCollapsibleStack(
|
||||
'proximo-list',
|
||||
MainStack,
|
||||
ProximoListScreen,
|
||||
i18n.t('screens.proximo.articleList'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.ProximoAbout,
|
||||
{createScreenCollapsibleStack(
|
||||
'proximo-about',
|
||||
MainStack,
|
||||
ProximoAboutScreen,
|
||||
i18n.t('screens.proximo.title'),
|
||||
|
|
@ -216,60 +175,60 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
|||
{...modalTransition},
|
||||
)}
|
||||
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Profile,
|
||||
{createScreenCollapsibleStack(
|
||||
'profile',
|
||||
MainStack,
|
||||
ProfileScreen,
|
||||
i18n.t('screens.profile.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.ClubList,
|
||||
{createScreenCollapsibleStack(
|
||||
'club-list',
|
||||
MainStack,
|
||||
ClubListScreen,
|
||||
i18n.t('screens.clubs.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.ClubInformation,
|
||||
{createScreenCollapsibleStack(
|
||||
'club-information',
|
||||
MainStack,
|
||||
ClubDisplayScreen,
|
||||
i18n.t('screens.clubs.details'),
|
||||
true,
|
||||
{...modalTransition},
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.ClubAbout,
|
||||
{createScreenCollapsibleStack(
|
||||
'club-about',
|
||||
MainStack,
|
||||
ClubAboutScreen,
|
||||
i18n.t('screens.clubs.title'),
|
||||
true,
|
||||
{...modalTransition},
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.EquipmentList,
|
||||
{createScreenCollapsibleStack(
|
||||
'equipment-list',
|
||||
MainStack,
|
||||
EquipmentScreen,
|
||||
i18n.t('screens.equipment.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.EquipmentRent,
|
||||
{createScreenCollapsibleStack(
|
||||
'equipment-rent',
|
||||
MainStack,
|
||||
EquipmentLendScreen,
|
||||
i18n.t('screens.equipment.book'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.EquipmentConfirm,
|
||||
{createScreenCollapsibleStack(
|
||||
'equipment-confirm',
|
||||
MainStack,
|
||||
EquipmentConfirmScreen,
|
||||
i18n.t('screens.equipment.confirm'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Vote,
|
||||
{createScreenCollapsibleStack(
|
||||
'vote',
|
||||
MainStack,
|
||||
VoteScreen,
|
||||
i18n.t('screens.vote.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
MainRoutes.Feedback,
|
||||
{createScreenCollapsibleStack(
|
||||
'feedback',
|
||||
MainStack,
|
||||
BugReportScreen,
|
||||
i18n.t('screens.feedback.title'),
|
||||
|
|
@ -279,10 +238,25 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
|||
}
|
||||
|
||||
type PropsType = {
|
||||
defaultHomeRoute: string | null;
|
||||
defaultHomeData: {[key: string]: string};
|
||||
defaultHomeRoute: string | null,
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
defaultHomeData: {[key: string]: string},
|
||||
};
|
||||
|
||||
export default function MainNavigator(props: PropsType) {
|
||||
return <MainStackComponent createTabNavigator={() => TabNavigator(props)} />;
|
||||
export default class MainNavigator extends React.Component<PropsType> {
|
||||
createTabNavigator: () => React.Node;
|
||||
|
||||
constructor(props: PropsType) {
|
||||
super(props);
|
||||
this.createTabNavigator = (): React.Node => (
|
||||
<TabNavigator
|
||||
defaultHomeRoute={props.defaultHomeRoute}
|
||||
defaultHomeData={props.defaultHomeData}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
render(): React.Node {
|
||||
return <MainStackComponent createTabNavigator={this.createTabNavigator} />;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,8 @@
|
|||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
|
||||
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
|
||||
|
|
@ -42,7 +44,7 @@ import WebsitesHomeScreen from '../screens/Services/ServicesScreen';
|
|||
import ServicesSectionScreen from '../screens/Services/ServicesSectionScreen';
|
||||
import AmicaleContactScreen from '../screens/Amicale/AmicaleContactScreen';
|
||||
import {
|
||||
CreateScreenCollapsibleStack,
|
||||
createScreenCollapsibleStack,
|
||||
getWebsiteStack,
|
||||
} from '../utils/CollapsibleUtils';
|
||||
import Mascot, {MASCOT_STYLE} from '../components/Mascot/Mascot';
|
||||
|
|
@ -60,25 +62,25 @@ const defaultScreenOptions = {
|
|||
|
||||
const ServicesStack = createStackNavigator();
|
||||
|
||||
function ServicesStackComponent() {
|
||||
function ServicesStackComponent(): React.Node {
|
||||
return (
|
||||
<ServicesStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'index',
|
||||
ServicesStack,
|
||||
WebsitesHomeScreen,
|
||||
i18n.t('screens.services.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'services-section',
|
||||
ServicesStack,
|
||||
ServicesSectionScreen,
|
||||
'SECTION',
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'amicale-contact',
|
||||
ServicesStack,
|
||||
AmicaleContactScreen,
|
||||
|
|
@ -90,19 +92,19 @@ function ServicesStackComponent() {
|
|||
|
||||
const ProxiwashStack = createStackNavigator();
|
||||
|
||||
function ProxiwashStackComponent() {
|
||||
function ProxiwashStackComponent(): React.Node {
|
||||
return (
|
||||
<ProxiwashStack.Navigator
|
||||
initialRouteName="index"
|
||||
headerMode="screen"
|
||||
screenOptions={defaultScreenOptions}>
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'index',
|
||||
ProxiwashStack,
|
||||
ProxiwashScreen,
|
||||
i18n.t('screens.proxiwash.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'proxiwash-about',
|
||||
ProxiwashStack,
|
||||
ProxiwashAboutScreen,
|
||||
|
|
@ -114,7 +116,7 @@ function ProxiwashStackComponent() {
|
|||
|
||||
const PlanningStack = createStackNavigator();
|
||||
|
||||
function PlanningStackComponent() {
|
||||
function PlanningStackComponent(): React.Node {
|
||||
return (
|
||||
<PlanningStack.Navigator
|
||||
initialRouteName="index"
|
||||
|
|
@ -125,7 +127,7 @@ function PlanningStackComponent() {
|
|||
component={PlanningScreen}
|
||||
options={{title: i18n.t('screens.planning.title')}}
|
||||
/>
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'planning-information',
|
||||
PlanningStack,
|
||||
PlanningDisplayScreen,
|
||||
|
|
@ -140,11 +142,10 @@ const HomeStack = createStackNavigator();
|
|||
function HomeStackComponent(
|
||||
initialRoute: string | null,
|
||||
defaultData: {[key: string]: string},
|
||||
) {
|
||||
): React.Node {
|
||||
let params;
|
||||
if (initialRoute != null) {
|
||||
if (initialRoute != null)
|
||||
params = {data: defaultData, nextScreen: initialRoute, shouldOpen: true};
|
||||
}
|
||||
const {colors} = useTheme();
|
||||
return (
|
||||
<HomeStack.Navigator
|
||||
|
|
@ -160,7 +161,7 @@ function HomeStackComponent(
|
|||
headerStyle: {
|
||||
backgroundColor: colors.surface,
|
||||
},
|
||||
headerTitle: () => (
|
||||
headerTitle: (): React.Node => (
|
||||
<View style={{flexDirection: 'row'}}>
|
||||
<Mascot
|
||||
style={{
|
||||
|
|
@ -202,19 +203,19 @@ function HomeStackComponent(
|
|||
options={{title: i18n.t('screens.scanner.title')}}
|
||||
/>
|
||||
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'club-information',
|
||||
HomeStack,
|
||||
ClubDisplayScreen,
|
||||
i18n.t('screens.clubs.details'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'feed-information',
|
||||
HomeStack,
|
||||
FeedItemScreen,
|
||||
i18n.t('screens.home.feed'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'planning-information',
|
||||
HomeStack,
|
||||
PlanningDisplayScreen,
|
||||
|
|
@ -226,7 +227,7 @@ function HomeStackComponent(
|
|||
|
||||
const PlanexStack = createStackNavigator();
|
||||
|
||||
function PlanexStackComponent() {
|
||||
function PlanexStackComponent(): React.Node {
|
||||
return (
|
||||
<PlanexStack.Navigator
|
||||
initialRouteName="index"
|
||||
|
|
@ -238,7 +239,7 @@ function PlanexStackComponent() {
|
|||
PlanexScreen,
|
||||
i18n.t('screens.planex.title'),
|
||||
)}
|
||||
{CreateScreenCollapsibleStack(
|
||||
{createScreenCollapsibleStack(
|
||||
'group-select',
|
||||
PlanexStack,
|
||||
GroupSelectionScreen,
|
||||
|
|
@ -251,49 +252,60 @@ function PlanexStackComponent() {
|
|||
const Tab = createBottomTabNavigator();
|
||||
|
||||
type PropsType = {
|
||||
defaultHomeRoute: string | null;
|
||||
defaultHomeData: {[key: string]: string};
|
||||
defaultHomeRoute: string | null,
|
||||
defaultHomeData: {[key: string]: string},
|
||||
};
|
||||
|
||||
export default function TabNavigator(props: PropsType) {
|
||||
let defaultRoute = 'home';
|
||||
if (!props.defaultHomeRoute) {
|
||||
defaultRoute = AsyncStorageManager.getString(
|
||||
AsyncStorageManager.PREFERENCES.defaultStartScreen.key,
|
||||
).toLowerCase();
|
||||
}
|
||||
const createHomeStackComponent = () =>
|
||||
HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
|
||||
export default class TabNavigator extends React.Component<PropsType> {
|
||||
createHomeStackComponent: () => React.Node;
|
||||
|
||||
return (
|
||||
<Tab.Navigator
|
||||
initialRouteName={defaultRoute}
|
||||
tabBar={(tabProps) => <CustomTabBar {...tabProps} />}>
|
||||
<Tab.Screen
|
||||
name="services"
|
||||
component={ServicesStackComponent}
|
||||
options={{title: i18n.t('screens.services.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="proxiwash"
|
||||
component={ProxiwashStackComponent}
|
||||
options={{title: i18n.t('screens.proxiwash.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="home"
|
||||
component={createHomeStackComponent}
|
||||
options={{title: i18n.t('screens.home.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="planning"
|
||||
component={PlanningStackComponent}
|
||||
options={{title: i18n.t('screens.planning.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="planex"
|
||||
component={PlanexStackComponent}
|
||||
options={{title: i18n.t('screens.planex.title')}}
|
||||
/>
|
||||
</Tab.Navigator>
|
||||
);
|
||||
defaultRoute: string;
|
||||
|
||||
constructor(props: PropsType) {
|
||||
super(props);
|
||||
if (props.defaultHomeRoute != null) this.defaultRoute = 'home';
|
||||
else
|
||||
this.defaultRoute = AsyncStorageManager.getString(
|
||||
AsyncStorageManager.PREFERENCES.defaultStartScreen.key,
|
||||
).toLowerCase();
|
||||
this.createHomeStackComponent = (): React.Node =>
|
||||
HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
|
||||
}
|
||||
|
||||
render(): React.Node {
|
||||
return (
|
||||
<Tab.Navigator
|
||||
initialRouteName={this.defaultRoute}
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
tabBar={(props: {...}): React.Node => <CustomTabBar {...props} />}>
|
||||
<Tab.Screen
|
||||
name="services"
|
||||
option
|
||||
component={ServicesStackComponent}
|
||||
options={{title: i18n.t('screens.services.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="proxiwash"
|
||||
component={ProxiwashStackComponent}
|
||||
options={{title: i18n.t('screens.proxiwash.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="home"
|
||||
component={this.createHomeStackComponent}
|
||||
options={{title: i18n.t('screens.home.title')}}
|
||||
/>
|
||||
<Tab.Screen
|
||||
name="planning"
|
||||
component={PlanningStackComponent}
|
||||
options={{title: i18n.t('screens.planning.title')}}
|
||||
/>
|
||||
|
||||
<Tab.Screen
|
||||
name="planex"
|
||||
component={PlanexStackComponent}
|
||||
options={{title: i18n.t('screens.planex.title')}}
|
||||
/>
|
||||
</Tab.Navigator>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,11 +50,11 @@ const LIST_ITEM_HEIGHT = 64;
|
|||
/**
|
||||
* Class defining a screen showing the list of libraries used by the app, taken from package.json
|
||||
*/
|
||||
export default class AboutDependenciesScreen extends React.Component<{}> {
|
||||
export default class AboutDependenciesScreen extends React.Component<null> {
|
||||
data: Array<ListItemType>;
|
||||
|
||||
constructor() {
|
||||
super({});
|
||||
super(null);
|
||||
this.data = generateListFromObject(packageJson.dependencies);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ type DatasetItemType = {
|
|||
/**
|
||||
* Class defining a planning event information page.
|
||||
*/
|
||||
class AmicaleContactScreen extends React.Component<{}> {
|
||||
class AmicaleContactScreen extends React.Component<null> {
|
||||
// Dataset containing information about contacts
|
||||
CONTACT_DATASET: Array<DatasetItemType>;
|
||||
|
||||
constructor() {
|
||||
super({});
|
||||
super(null);
|
||||
this.CONTACT_DATASET = [
|
||||
{
|
||||
name: i18n.t('screens.amicaleAbout.roles.interSchools'),
|
||||
|
|
|
|||
179
src/screens/Other/FeedbackScreen.js
Normal file
179
src/screens/Other/FeedbackScreen.js
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* Copyright (c) 2019 - 2020 Arnaud Vergnet.
|
||||
*
|
||||
* This file is part of Campus INSAT.
|
||||
*
|
||||
* Campus INSAT is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Campus INSAT is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {Avatar, Button, Card, Paragraph, withTheme} from 'react-native-paper';
|
||||
import i18n from 'i18n-js';
|
||||
import {Linking, View} from 'react-native';
|
||||
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
||||
import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
|
||||
|
||||
const links = {
|
||||
bugsGit: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/',
|
||||
trello: 'https://trello.com/b/RMej49Uq/application-campus-insa',
|
||||
facebook: 'https://www.facebook.com/campus.insat',
|
||||
feedbackMail: `mailto:app@amicale-insat.fr?subject=[FEEDBACK] Application CAMPUS
|
||||
&body=Coucou Arnaud j'ai du feedback\n\n\n\nBien cordialement.`,
|
||||
feedbackDiscord: 'https://discord.gg/W8MeTec',
|
||||
};
|
||||
|
||||
class FeedbackScreen extends React.Component<null> {
|
||||
/**
|
||||
* Gets link buttons
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
static getButtons(isFeedback: boolean): React.Node {
|
||||
return (
|
||||
<Card.Actions
|
||||
style={{
|
||||
flex: 1,
|
||||
flexWrap: 'wrap',
|
||||
}}>
|
||||
{isFeedback ? (
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
flexWrap: 'wrap',
|
||||
flexDirection: 'row',
|
||||
width: '100%',
|
||||
}}>
|
||||
<Button
|
||||
icon="email"
|
||||
mode="contained"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.feedbackMail);
|
||||
}}>
|
||||
MAIL
|
||||
</Button>
|
||||
<Button
|
||||
icon="facebook"
|
||||
mode="contained"
|
||||
color="#2e88fe"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.facebook);
|
||||
}}>
|
||||
Facebook
|
||||
</Button>
|
||||
<Button
|
||||
icon="discord"
|
||||
mode="contained"
|
||||
color="#7289da"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.feedbackDiscord);
|
||||
}}>
|
||||
Discord
|
||||
</Button>
|
||||
</View>
|
||||
) : (
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
flexWrap: 'wrap',
|
||||
flexDirection: 'row',
|
||||
width: '100%',
|
||||
}}>
|
||||
<Button
|
||||
icon="git"
|
||||
mode="contained"
|
||||
color="#609927"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.bugsGit);
|
||||
}}>
|
||||
GITETUD
|
||||
</Button>
|
||||
<Button
|
||||
icon="calendar"
|
||||
mode="contained"
|
||||
color="#026AA7"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.trello);
|
||||
}}>
|
||||
TRELLO
|
||||
</Button>
|
||||
</View>
|
||||
)}
|
||||
</Card.Actions>
|
||||
);
|
||||
}
|
||||
|
||||
render(): React.Node {
|
||||
return (
|
||||
<CollapsibleScrollView style={{padding: 5}}>
|
||||
<Card>
|
||||
<Card.Title
|
||||
title={i18n.t('screens.feedback.feedback')}
|
||||
subtitle={i18n.t('screens.feedback.feedbackSubtitle')}
|
||||
left={(iconProps: CardTitleIconPropsType): React.Node => (
|
||||
<Avatar.Icon size={iconProps.size} icon="comment" />
|
||||
)}
|
||||
/>
|
||||
<Card.Content>
|
||||
<Paragraph>
|
||||
{i18n.t('screens.feedback.feedbackDescription')}
|
||||
</Paragraph>
|
||||
</Card.Content>
|
||||
{FeedbackScreen.getButtons(true)}
|
||||
<Card.Title
|
||||
title={i18n.t('screens.feedback.contribute')}
|
||||
subtitle={i18n.t('screens.feedback.contributeSubtitle')}
|
||||
left={(iconProps: CardTitleIconPropsType): React.Node => (
|
||||
<Avatar.Icon size={iconProps.size} icon="handshake" />
|
||||
)}
|
||||
/>
|
||||
<Card.Content>
|
||||
<Paragraph>
|
||||
{i18n.t('screens.feedback.contributeDescription')}
|
||||
</Paragraph>
|
||||
</Card.Content>
|
||||
{FeedbackScreen.getButtons(false)}
|
||||
</Card>
|
||||
</CollapsibleScrollView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withTheme(FeedbackScreen);
|
||||
|
|
@ -1,169 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 - 2020 Arnaud Vergnet.
|
||||
*
|
||||
* This file is part of Campus INSAT.
|
||||
*
|
||||
* Campus INSAT is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Campus INSAT is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import {Avatar, Button, Card, Paragraph, withTheme} from 'react-native-paper';
|
||||
import i18n from 'i18n-js';
|
||||
import {Linking, View} from 'react-native';
|
||||
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
||||
|
||||
const links = {
|
||||
bugsGit: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/',
|
||||
trello: 'https://trello.com/b/RMej49Uq/application-campus-insa',
|
||||
facebook: 'https://www.facebook.com/campus.insat',
|
||||
feedbackMail: `mailto:app@amicale-insat.fr?subject=[FEEDBACK] Application CAMPUS
|
||||
&body=Coucou Arnaud j'ai du feedback\n\n\n\nBien cordialement.`,
|
||||
feedbackDiscord: 'https://discord.gg/W8MeTec',
|
||||
};
|
||||
|
||||
function getButtons(isFeedback: boolean) {
|
||||
return (
|
||||
<Card.Actions
|
||||
style={{
|
||||
flex: 1,
|
||||
flexWrap: 'wrap',
|
||||
}}>
|
||||
{isFeedback ? (
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
flexWrap: 'wrap',
|
||||
flexDirection: 'row',
|
||||
width: '100%',
|
||||
}}>
|
||||
<Button
|
||||
icon="email"
|
||||
mode="contained"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.feedbackMail);
|
||||
}}>
|
||||
MAIL
|
||||
</Button>
|
||||
<Button
|
||||
icon="facebook"
|
||||
mode="contained"
|
||||
color="#2e88fe"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.facebook);
|
||||
}}>
|
||||
Facebook
|
||||
</Button>
|
||||
<Button
|
||||
icon="discord"
|
||||
mode="contained"
|
||||
color="#7289da"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.feedbackDiscord);
|
||||
}}>
|
||||
Discord
|
||||
</Button>
|
||||
</View>
|
||||
) : (
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
flexWrap: 'wrap',
|
||||
flexDirection: 'row',
|
||||
width: '100%',
|
||||
}}>
|
||||
<Button
|
||||
icon="git"
|
||||
mode="contained"
|
||||
color="#609927"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.bugsGit);
|
||||
}}>
|
||||
GITETUD
|
||||
</Button>
|
||||
<Button
|
||||
icon="calendar"
|
||||
mode="contained"
|
||||
color="#026AA7"
|
||||
style={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 5,
|
||||
}}
|
||||
onPress={() => {
|
||||
Linking.openURL(links.trello);
|
||||
}}>
|
||||
TRELLO
|
||||
</Button>
|
||||
</View>
|
||||
)}
|
||||
</Card.Actions>
|
||||
);
|
||||
}
|
||||
|
||||
function FeedbackScreen() {
|
||||
return (
|
||||
<CollapsibleScrollView style={{padding: 5}}>
|
||||
<Card>
|
||||
<Card.Title
|
||||
title={i18n.t('screens.feedback.feedback')}
|
||||
subtitle={i18n.t('screens.feedback.feedbackSubtitle')}
|
||||
left={(iconProps) => (
|
||||
<Avatar.Icon size={iconProps.size} icon="comment" />
|
||||
)}
|
||||
/>
|
||||
<Card.Content>
|
||||
<Paragraph>
|
||||
{i18n.t('screens.feedback.feedbackDescription')}
|
||||
</Paragraph>
|
||||
</Card.Content>
|
||||
{getButtons(true)}
|
||||
<Card.Title
|
||||
title={i18n.t('screens.feedback.contribute')}
|
||||
subtitle={i18n.t('screens.feedback.contributeSubtitle')}
|
||||
left={(iconProps) => (
|
||||
<Avatar.Icon size={iconProps.size} icon="handshake" />
|
||||
)}
|
||||
/>
|
||||
<Card.Content>
|
||||
<Paragraph>
|
||||
{i18n.t('screens.feedback.contributeDescription')}
|
||||
</Paragraph>
|
||||
</Card.Content>
|
||||
{getButtons(false)}
|
||||
</Card>
|
||||
</CollapsibleScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
export default withTheme(FeedbackScreen);
|
||||
|
|
@ -17,9 +17,11 @@
|
|||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {StackNavigationProp} from '@react-navigation/stack';
|
||||
import {Button, Card, Paragraph} from 'react-native-paper';
|
||||
import {Button, Card, Paragraph, withTheme} from 'react-native-paper';
|
||||
import {FlatList} from 'react-native';
|
||||
import {View} from 'react-native-animatable';
|
||||
import i18n from 'i18n-js';
|
||||
|
|
@ -28,19 +30,20 @@ import type {
|
|||
ServiceItemType,
|
||||
} from '../../../managers/ServicesManager';
|
||||
import DashboardManager from '../../../managers/DashboardManager';
|
||||
import DashboardItem from '../../../components/Home/EventDashboardItem';
|
||||
import DashboardEditAccordion from '../../../components/Lists/DashboardEdit/DashboardEditAccordion';
|
||||
import DashboardEditPreviewItem from '../../../components/Lists/DashboardEdit/DashboardEditPreviewItem';
|
||||
import AsyncStorageManager from '../../../managers/AsyncStorageManager';
|
||||
import CollapsibleFlatList from '../../../components/Collapsible/CollapsibleFlatList';
|
||||
|
||||
type PropsType = {
|
||||
navigation: StackNavigationProp<any>;
|
||||
navigation: StackNavigationProp,
|
||||
};
|
||||
|
||||
type StateType = {
|
||||
currentDashboard: Array<ServiceItemType | null>;
|
||||
currentDashboardIdList: Array<string>;
|
||||
activeItem: number;
|
||||
currentDashboard: Array<ServiceItemType | null>,
|
||||
currentDashboardIdList: Array<string>,
|
||||
activeItem: number,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -72,13 +75,13 @@ class DashboardEditScreen extends React.Component<PropsType, StateType> {
|
|||
item,
|
||||
index,
|
||||
}: {
|
||||
item: ServiceItemType | null;
|
||||
index: number;
|
||||
}) => {
|
||||
item: DashboardItem,
|
||||
index: number,
|
||||
}): React.Node => {
|
||||
const {activeItem} = this.state;
|
||||
return (
|
||||
<DashboardEditPreviewItem
|
||||
image={item?.image}
|
||||
image={item.image}
|
||||
onPress={() => {
|
||||
this.setState({activeItem: index});
|
||||
}}
|
||||
|
|
@ -87,7 +90,7 @@ class DashboardEditScreen extends React.Component<PropsType, StateType> {
|
|||
);
|
||||
};
|
||||
|
||||
getDashboard(content: Array<ServiceItemType | null>) {
|
||||
getDashboard(content: Array<DashboardItem>): React.Node {
|
||||
return (
|
||||
<FlatList
|
||||
data={content}
|
||||
|
|
@ -103,7 +106,7 @@ class DashboardEditScreen extends React.Component<PropsType, StateType> {
|
|||
);
|
||||
}
|
||||
|
||||
getRenderItem = ({item}: {item: ServiceCategoryType}) => {
|
||||
getRenderItem = ({item}: {item: ServiceCategoryType}): React.Node => {
|
||||
const {currentDashboardIdList} = this.state;
|
||||
return (
|
||||
<DashboardEditAccordion
|
||||
|
|
@ -114,7 +117,7 @@ class DashboardEditScreen extends React.Component<PropsType, StateType> {
|
|||
);
|
||||
};
|
||||
|
||||
getListHeader() {
|
||||
getListHeader(): React.Node {
|
||||
const {currentDashboard} = this.state;
|
||||
return (
|
||||
<Card style={{margin: 5}}>
|
||||
|
|
@ -167,7 +170,7 @@ class DashboardEditScreen extends React.Component<PropsType, StateType> {
|
|||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
render(): React.Node {
|
||||
return (
|
||||
<CollapsibleFlatList
|
||||
data={this.content}
|
||||
|
|
@ -179,4 +182,4 @@ class DashboardEditScreen extends React.Component<PropsType, StateType> {
|
|||
}
|
||||
}
|
||||
|
||||
export default DashboardEditScreen;
|
||||
export default withTheme(DashboardEditScreen);
|
||||
|
|
@ -17,6 +17,8 @@
|
|||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// @flow
|
||||
|
||||
import * as React from 'react';
|
||||
import {View} from 'react-native';
|
||||
import i18n from 'i18n-js';
|
||||
|
|
@ -30,22 +32,24 @@ import {
|
|||
} from 'react-native-paper';
|
||||
import {Appearance} from 'react-native-appearance';
|
||||
import {StackNavigationProp} from '@react-navigation/stack';
|
||||
import type {CustomThemeType} from '../../../managers/ThemeManager';
|
||||
import ThemeManager from '../../../managers/ThemeManager';
|
||||
import AsyncStorageManager from '../../../managers/AsyncStorageManager';
|
||||
import CustomSlider from '../../../components/Overrides/CustomSlider';
|
||||
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
||||
import type {ListIconPropsType} from '../../../constants/PaperStyles';
|
||||
|
||||
type PropsType = {
|
||||
navigation: StackNavigationProp<any>;
|
||||
theme: ReactNativePaper.Theme;
|
||||
navigation: StackNavigationProp,
|
||||
theme: CustomThemeType,
|
||||
};
|
||||
|
||||
type StateType = {
|
||||
nightMode: boolean;
|
||||
nightModeFollowSystem: boolean;
|
||||
startScreenPickerSelected: string;
|
||||
selectedWash: string;
|
||||
isDebugUnlocked: boolean;
|
||||
nightMode: boolean,
|
||||
nightModeFollowSystem: boolean,
|
||||
startScreenPickerSelected: string,
|
||||
selectedWash: string,
|
||||
isDebugUnlocked: boolean,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -57,15 +61,14 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
/**
|
||||
* Loads user preferences into state
|
||||
*/
|
||||
constructor(props: PropsType) {
|
||||
super(props);
|
||||
constructor() {
|
||||
super();
|
||||
const notifReminder = AsyncStorageManager.getString(
|
||||
AsyncStorageManager.PREFERENCES.proxiwashNotifications.key,
|
||||
);
|
||||
this.savedNotificationReminder = parseInt(notifReminder, 10);
|
||||
if (Number.isNaN(this.savedNotificationReminder)) {
|
||||
if (Number.isNaN(this.savedNotificationReminder))
|
||||
this.savedNotificationReminder = 0;
|
||||
}
|
||||
|
||||
this.state = {
|
||||
nightMode: ThemeManager.getNightMode(),
|
||||
|
|
@ -117,7 +120,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
*
|
||||
* @returns {React.Node}
|
||||
*/
|
||||
getProxiwashNotifPicker() {
|
||||
getProxiwashNotifPicker(): React.Node {
|
||||
const {theme} = this.props;
|
||||
return (
|
||||
<CustomSlider
|
||||
|
|
@ -138,7 +141,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
*
|
||||
* @returns {React.Node}
|
||||
*/
|
||||
getProxiwashChangePicker() {
|
||||
getProxiwashChangePicker(): React.Node {
|
||||
const {selectedWash} = this.state;
|
||||
return (
|
||||
<RadioButton.Group
|
||||
|
|
@ -161,7 +164,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
*
|
||||
* @returns {React.Node}
|
||||
*/
|
||||
getStartScreenPicker() {
|
||||
getStartScreenPicker(): React.Node {
|
||||
const {startScreenPickerSelected} = this.state;
|
||||
return (
|
||||
<ToggleButton.Row
|
||||
|
|
@ -217,15 +220,17 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
title: string,
|
||||
subtitle: string,
|
||||
state: boolean,
|
||||
) {
|
||||
): React.Node {
|
||||
return (
|
||||
<List.Item
|
||||
title={title}
|
||||
description={subtitle}
|
||||
left={(props) => (
|
||||
left={(props: ListIconPropsType): React.Node => (
|
||||
<List.Icon color={props.color} style={props.style} icon={icon} />
|
||||
)}
|
||||
right={() => <Switch value={state} onValueChange={onPressCallback} />}
|
||||
right={(): React.Node => (
|
||||
<Switch value={state} onValueChange={onPressCallback} />
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -236,7 +241,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
title: string,
|
||||
subtitle: string,
|
||||
onLongPress?: () => void,
|
||||
) {
|
||||
): React.Node {
|
||||
const {navigation} = this.props;
|
||||
return (
|
||||
<List.Item
|
||||
|
|
@ -245,10 +250,10 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
onPress={() => {
|
||||
navigation.navigate(route);
|
||||
}}
|
||||
left={(props) => (
|
||||
left={(props: ListIconPropsType): React.Node => (
|
||||
<List.Icon color={props.color} style={props.style} icon={icon} />
|
||||
)}
|
||||
right={(props) => (
|
||||
right={(props: ListIconPropsType): React.Node => (
|
||||
<List.Icon
|
||||
color={props.color}
|
||||
style={props.style}
|
||||
|
|
@ -286,7 +291,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
render(): React.Node {
|
||||
const {nightModeFollowSystem, nightMode, isDebugUnlocked} = this.state;
|
||||
return (
|
||||
<CollapsibleScrollView>
|
||||
|
|
@ -317,7 +322,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
<List.Item
|
||||
title={i18n.t('screens.settings.startScreen')}
|
||||
description={i18n.t('screens.settings.startScreenSub')}
|
||||
left={(props) => (
|
||||
left={(props: ListIconPropsType): React.Node => (
|
||||
<List.Icon
|
||||
color={props.color}
|
||||
style={props.style}
|
||||
|
|
@ -340,7 +345,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
<List.Item
|
||||
title={i18n.t('screens.settings.proxiwashNotifReminder')}
|
||||
description={i18n.t('screens.settings.proxiwashNotifReminderSub')}
|
||||
left={(props) => (
|
||||
left={(props: ListIconPropsType): React.Node => (
|
||||
<List.Icon
|
||||
color={props.color}
|
||||
style={props.style}
|
||||
|
|
@ -354,7 +359,7 @@ class SettingsScreen extends React.Component<PropsType, StateType> {
|
|||
<List.Item
|
||||
title={i18n.t('screens.settings.proxiwashChangeWash')}
|
||||
description={i18n.t('screens.settings.proxiwashChangeWashSub')}
|
||||
left={(props) => (
|
||||
left={(props: ListIconPropsType): React.Node => (
|
||||
<List.Icon
|
||||
color={props.color}
|
||||
style={props.style}
|
||||
|
|
@ -21,7 +21,7 @@ import * as React from 'react';
|
|||
import {useTheme} from 'react-native-paper';
|
||||
import {createCollapsibleStack} from 'react-navigation-collapsible';
|
||||
import StackNavigator, {StackNavigationOptions} from '@react-navigation/stack';
|
||||
import {StackNavigationState, TypedNavigator} from '@react-navigation/native';
|
||||
import {StackNavigationState} from '@react-navigation/native';
|
||||
import {StackNavigationEventMap} from '@react-navigation/stack/lib/typescript/src/types';
|
||||
|
||||
type StackNavigatorType = import('@react-navigation/native').TypedNavigator<
|
||||
|
|
@ -50,7 +50,7 @@ type StackNavigatorType = import('@react-navigation/native').TypedNavigator<
|
|||
*/
|
||||
export function CreateScreenCollapsibleStack(
|
||||
name: string,
|
||||
Stack: TypedNavigator<any, any, any, any, any>,
|
||||
Stack: StackNavigatorType,
|
||||
component: React.ComponentType<any>,
|
||||
title: string,
|
||||
useNativeDriver: boolean = true,
|
||||
|
|
@ -91,7 +91,7 @@ export function CreateScreenCollapsibleStack(
|
|||
*/
|
||||
export function getWebsiteStack(
|
||||
name: string,
|
||||
Stack: TypedNavigator<any, any, any, any, any>,
|
||||
Stack: StackNavigatorType,
|
||||
component: React.ComponentType<any>,
|
||||
title: string,
|
||||
) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue