Fixed scrollView warning

This commit is contained in:
Arnaud Vergnet 2020-04-07 00:31:07 +02:00
parent b2891ddeea
commit 2da2b631ee

View file

@ -1,7 +1,7 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import {FlatList, ScrollView, StyleSheet} from "react-native"; import {FlatList, StyleSheet, View} from "react-native";
import {Avatar, Button, Card, Divider, List, withTheme} from 'react-native-paper'; import {Avatar, Button, Card, Divider, List, withTheme} from 'react-native-paper';
import AuthenticatedScreen from "../../components/Amicale/AuthenticatedScreen"; import AuthenticatedScreen from "../../components/Amicale/AuthenticatedScreen";
import {openBrowser} from "../../utils/WebBrowser"; import {openBrowser} from "../../utils/WebBrowser";
@ -28,9 +28,16 @@ class ProfileScreen extends React.Component<Props, State> {
data: Object; data: Object;
flatListData: Array<Object>;
constructor(props) { constructor(props) {
super(props); super(props);
this.colors = props.theme.colors; this.colors = props.theme.colors;
this.flatListData = [
{id: '0'},
{id: '1'},
{id: '2'},
]
} }
componentDidMount() { componentDidMount() {
@ -51,19 +58,32 @@ class ProfileScreen extends React.Component<Props, State> {
getScreen = (data: Object) => { getScreen = (data: Object) => {
this.data = data[0]; this.data = data[0];
return ( return (
<ScrollView> <View>
{this.getPersonalCard()} {/*$FlowFixMe*/}
{this.getClubCard()} <FlatList
{this.getMembershipCar()} renderItem={this.getRenderItem}
data={this.flatListData}
/>
<LogoutDialog <LogoutDialog
{...this.props} {...this.props}
visible={this.state.dialogVisible} visible={this.state.dialogVisible}
onDismiss={this.hideDisconnectDialog} onDismiss={this.hideDisconnectDialog}
/> />
</ScrollView> </View>
) )
}; };
getRenderItem = ({item}: Object) => {
switch (item.id) {
case '0':
return this.getPersonalCard();
case '1':
return this.getClubCard();
case '2':
return this.getMembershipCar();
}
};
getPersonalCard() { getPersonalCard() {
return ( return (
<Card style={styles.card}> <Card style={styles.card}>