Browse Source

Moved amicale contact to services header button

Arnaud Vergnet 3 years ago
parent
commit
56effeaaf9

+ 0
- 8
src/navigation/MainNavigator.js View File

@@ -29,7 +29,6 @@ import {BlueMindWebsiteScreen} from "../screens/Websites/BlueMindWebsiteScreen";
29 29
 import ProfileScreen from "../screens/Amicale/ProfileScreen";
30 30
 import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen";
31 31
 import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
32
-import AmicaleContactScreen from "../screens/Amicale/AmicaleContactScreen";
33 32
 import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
34 33
 
35 34
 const defaultScreenOptions = {
@@ -190,13 +189,6 @@ function MainStackComponent(props: { createTabNavigator: () => React.Node }) {
190 189
                     title: i18n.t('screens.vote'),
191 190
                 }}
192 191
             />
193
-            <MainStack.Screen
194
-                name="amicale-contact"
195
-                component={AmicaleContactScreen}
196
-                options={{
197
-                    title: i18n.t('screens.amicaleAbout'),
198
-                }}
199
-            />
200 192
         </MainStack.Navigator>
201 193
     );
202 194
 }

+ 2
- 0
src/navigation/TabNavigator.js View File

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

+ 18
- 5
src/screens/Amicale/AmicaleContactScreen.js View File

@@ -1,12 +1,17 @@
1 1
 // @flow
2 2
 
3 3
 import * as React from 'react';
4
-import {FlatList, Image, View} from 'react-native';
4
+import {Animated, FlatList, Image, View} from 'react-native';
5 5
 import {Card, List, Text, withTheme} from 'react-native-paper';
6 6
 import i18n from 'i18n-js';
7 7
 import {Linking} from "expo";
8
+import {Collapsible} from "react-navigation-collapsible";
9
+import CustomTabBar from "../../components/Tabbar/CustomTabBar";
10
+import {withCollapsible} from "../../utils/withCollapsible";
8 11
 
9
-type Props = {};
12
+type Props = {
13
+    collapsibleStack: Collapsible
14
+};
10 15
 
11 16
 type State = {};
12 17
 
@@ -123,14 +128,22 @@ class AmicaleContactScreen extends React.Component<Props, State> {
123 128
     };
124 129
 
125 130
     render() {
131
+        const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
126 132
         return (
127
-            //$FlowFixMe
128
-            <FlatList
133
+            <Animated.FlatList
129 134
                 data={[{key: "1"}]}
130 135
                 renderItem={this.getScreen}
136
+                // Animations
137
+                onScroll={onScroll}
138
+                contentContainerStyle={{
139
+                    paddingTop: containerPaddingTop,
140
+                    paddingBottom: CustomTabBar.TAB_BAR_HEIGHT,
141
+                    minHeight: '100%'
142
+                }}
143
+                scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
131 144
             />
132 145
         );
133 146
     }
134 147
 }
135 148
 
136
-export default withTheme(AmicaleContactScreen);
149
+export default withCollapsible(withTheme(AmicaleContactScreen));

+ 11
- 7
src/screens/Services/ServicesScreen.js View File

@@ -12,6 +12,7 @@ import {Avatar, Button, Card, Divider, List, Title, TouchableRipple, withTheme}
12 12
 import type {CustomTheme} from "../../managers/ThemeManager";
13 13
 import ConnectionManager from "../../managers/ConnectionManager";
14 14
 import i18n from 'i18n-js';
15
+import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton";
15 16
 
16 17
 type Props = {
17 18
     navigation: Object,
@@ -68,12 +69,6 @@ class ServicesScreen extends React.Component<Props, State> {
68 69
                 onPress: () => nav.navigate("profile"),
69 70
             },
70 71
             {
71
-                title: i18n.t('screens.amicaleAbout'),
72
-                subtitle: "CONTACT",
73
-                image: AMICALE_IMAGE,
74
-                onPress: () => nav.navigate("amicale-contact"),
75
-            },
76
-            {
77 72
                 title: i18n.t('screens.vote'),
78 73
                 subtitle: "ELECTIONS",
79 74
                 image: AMICALE_IMAGE,
@@ -174,9 +169,18 @@ class ServicesScreen extends React.Component<Props, State> {
174 169
 
175 170
     componentDidMount() {
176 171
         this.props.navigation.addListener('focus', this.onFocus);
177
-
172
+        this.props.navigation.setOptions({
173
+            headerRight: this.getAboutButton,
174
+        });
178 175
     }
179 176
 
177
+    getAboutButton = () =>
178
+        <MaterialHeaderButtons>
179
+            <Item title="information" iconName="information" onPress={this.onAboutPress}/>
180
+        </MaterialHeaderButtons>;
181
+
182
+    onAboutPress = () => this.props.navigation.navigate('amicale-contact');
183
+
180 184
     onFocus = () => {
181 185
         this.handleNavigationParams();
182 186
         this.setState({isLoggedIn: ConnectionManager.getInstance().isLoggedIn()})

Loading…
Cancel
Save