Moved amicale contact to services header button

This commit is contained in:
Arnaud Vergnet 2020-04-22 23:14:04 +02:00
parent b83e748d29
commit 56effeaaf9
4 changed files with 31 additions and 20 deletions

View file

@ -29,7 +29,6 @@ import {BlueMindWebsiteScreen} from "../screens/Websites/BlueMindWebsiteScreen";
import ProfileScreen from "../screens/Amicale/ProfileScreen";
import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen";
import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen";
import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
const defaultScreenOptions = {
@ -190,13 +189,6 @@ function MainStackComponent(props: { createTabNavigator: () => React.Node }) {
title: i18n.t('screens.vote'),
}}
/>
<MainStack.Screen
name="amicale-contact"
component={AmicaleContactScreen}
options={{
title: i18n.t('screens.amicaleAbout'),
}}
/>
</MainStack.Navigator>
);
}

View file

@ -20,6 +20,7 @@ import GroupSelectionScreen from "../screens/Planex/GroupSelectionScreen";
import CustomTabBar from "../components/Tabbar/CustomTabBar";
import WebsitesHomeScreen from "../screens/Services/ServicesScreen";
import ServicesSectionScreen from "../screens/Services/ServicesSectionScreen";
import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen";
const defaultScreenOptions = {
gestureEnabled: true,
@ -73,6 +74,7 @@ function ServicesStackComponent() {
>
{createScreenCollapsibleStack("index", ServicesStack, WebsitesHomeScreen, i18n.t('screens.services'))}
{createScreenCollapsibleStack("services-section", ServicesStack, ServicesSectionScreen, "SECTION")}
{createScreenCollapsibleStack("amicale-contact", ServicesStack, AmicaleContactScreen, i18n.t('screens.amicaleAbout'), true, {...modalTransition})}
</ServicesStack.Navigator>
);
}

View file

@ -1,12 +1,17 @@
// @flow
import * as React from 'react';
import {FlatList, Image, View} from 'react-native';
import {Animated, FlatList, Image, View} from 'react-native';
import {Card, List, Text, withTheme} from 'react-native-paper';
import i18n from 'i18n-js';
import {Linking} from "expo";
import {Collapsible} from "react-navigation-collapsible";
import CustomTabBar from "../../components/Tabbar/CustomTabBar";
import {withCollapsible} from "../../utils/withCollapsible";
type Props = {};
type Props = {
collapsibleStack: Collapsible
};
type State = {};
@ -123,14 +128,22 @@ class AmicaleContactScreen extends React.Component<Props, State> {
};
render() {
const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
return (
//$FlowFixMe
<FlatList
<Animated.FlatList
data={[{key: "1"}]}
renderItem={this.getScreen}
// Animations
onScroll={onScroll}
contentContainerStyle={{
paddingTop: containerPaddingTop,
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT,
minHeight: '100%'
}}
scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
/>
);
}
}
export default withTheme(AmicaleContactScreen);
export default withCollapsible(withTheme(AmicaleContactScreen));

View file

@ -12,6 +12,7 @@ import {Avatar, Button, Card, Divider, List, Title, TouchableRipple, withTheme}
import type {CustomTheme} from "../../managers/ThemeManager";
import ConnectionManager from "../../managers/ConnectionManager";
import i18n from 'i18n-js';
import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton";
type Props = {
navigation: Object,
@ -67,12 +68,6 @@ class ServicesScreen extends React.Component<Props, State> {
image: AMICALE_IMAGE,
onPress: () => nav.navigate("profile"),
},
{
title: i18n.t('screens.amicaleAbout'),
subtitle: "CONTACT",
image: AMICALE_IMAGE,
onPress: () => nav.navigate("amicale-contact"),
},
{
title: i18n.t('screens.vote'),
subtitle: "ELECTIONS",
@ -174,9 +169,18 @@ class ServicesScreen extends React.Component<Props, State> {
componentDidMount() {
this.props.navigation.addListener('focus', this.onFocus);
this.props.navigation.setOptions({
headerRight: this.getAboutButton,
});
}
getAboutButton = () =>
<MaterialHeaderButtons>
<Item title="information" iconName="information" onPress={this.onAboutPress}/>
</MaterialHeaderButtons>;
onAboutPress = () => this.props.navigation.navigate('amicale-contact');
onFocus = () => {
this.handleNavigationParams();
this.setState({isLoggedIn: ConnectionManager.getInstance().isLoggedIn()})