Added collapsible header to profile

This commit is contained in:
Arnaud Vergnet 2020-04-21 20:02:17 +02:00
parent b151a8ff6f
commit 96ed75ac72
2 changed files with 18 additions and 12 deletions

View file

@ -246,13 +246,7 @@ function HomeStackComponent(initialRoute: string | null, defaultData: { [key: st
title: i18n.t('screens.login'),
}}
/>
<HomeStack.Screen
name="profile"
component={ProfileScreen}
options={{
title: i18n.t('screens.profile'),
}}
/>
{createScreenCollapsibleStack("profile", HomeStack, ProfileScreen, i18n.t('screens.profile'))}
{createScreenCollapsibleStack("club-list", HomeStack, ClubListScreen, i18n.t('clubs.clubList'))}
<HomeStack.Screen
name="club-about"

View file

@ -1,16 +1,20 @@
// @flow
import * as React from 'react';
import {FlatList, StyleSheet, View} from "react-native";
import {Animated, FlatList, StyleSheet, View} from "react-native";
import {Avatar, Button, Card, Divider, List, withTheme} from 'react-native-paper';
import AuthenticatedScreen from "../../components/Amicale/AuthenticatedScreen";
import i18n from 'i18n-js';
import LogoutDialog from "../../components/Amicale/LogoutDialog";
import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton";
import CustomTabBar from "../../components/Tabbar/CustomTabBar";
import {Collapsible} from "react-navigation-collapsible";
import {withCollapsible} from "../../utils/withCollapsible";
type Props = {
navigation: Object,
theme: Object,
collapsibleStack: Collapsible,
}
type State = {
@ -52,12 +56,20 @@ class ProfileScreen extends React.Component<Props, State> {
getScreen = (data: Object) => {
this.data = data[0];
const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
return (
<View>
{/*$FlowFixMe*/}
<FlatList
<View style={{flex: 1}}>
<Animated.FlatList
renderItem={this.getRenderItem}
data={this.flatListData}
// Animations
onScroll={onScroll}
contentContainerStyle={{
paddingTop: containerPaddingTop,
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT,
minHeight: '100%'
}}
scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
/>
<LogoutDialog
{...this.props}
@ -323,4 +335,4 @@ const styles = StyleSheet.create({
});
export default withTheme(ProfileScreen);
export default withCollapsible(withTheme(ProfileScreen));