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

View file

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

View file

@ -1,12 +1,17 @@
// @flow // @flow
import * as React from 'react'; 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 {Card, List, Text, withTheme} from 'react-native-paper';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import {Linking} from "expo"; 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 = {}; type State = {};
@ -123,14 +128,22 @@ class AmicaleContactScreen extends React.Component<Props, State> {
}; };
render() { render() {
const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
return ( return (
//$FlowFixMe <Animated.FlatList
<FlatList
data={[{key: "1"}]} data={[{key: "1"}]}
renderItem={this.getScreen} 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 type {CustomTheme} from "../../managers/ThemeManager";
import ConnectionManager from "../../managers/ConnectionManager"; import ConnectionManager from "../../managers/ConnectionManager";
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton";
type Props = { type Props = {
navigation: Object, navigation: Object,
@ -67,12 +68,6 @@ class ServicesScreen extends React.Component<Props, State> {
image: AMICALE_IMAGE, image: AMICALE_IMAGE,
onPress: () => nav.navigate("profile"), onPress: () => nav.navigate("profile"),
}, },
{
title: i18n.t('screens.amicaleAbout'),
subtitle: "CONTACT",
image: AMICALE_IMAGE,
onPress: () => nav.navigate("amicale-contact"),
},
{ {
title: i18n.t('screens.vote'), title: i18n.t('screens.vote'),
subtitle: "ELECTIONS", subtitle: "ELECTIONS",
@ -174,9 +169,18 @@ class ServicesScreen extends React.Component<Props, State> {
componentDidMount() { componentDidMount() {
this.props.navigation.addListener('focus', this.onFocus); 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 = () => { onFocus = () => {
this.handleNavigationParams(); this.handleNavigationParams();
this.setState({isLoggedIn: ConnectionManager.getInstance().isLoggedIn()}) this.setState({isLoggedIn: ConnectionManager.getInstance().isLoggedIn()})