🚨 Stop embedding a VirtualizedList inside a ScrollView

pull/11/head
Alexis Drai 2 years ago
parent 6d3001e87c
commit d1ad460e49

@ -1,7 +1,7 @@
// screens/moves/MoveListScreen.tsx // screens/moves/MoveListScreen.tsx
import React from 'react'; import React from 'react';
import { Button, FlatList, ScrollView, StyleSheet, View } from 'react-native'; import { Button, FlatList, StyleSheet, View } from 'react-native';
import { StackNavigationProp } from '@react-navigation/stack'; import { StackNavigationProp } from '@react-navigation/stack';
import { RootStackParamList } from "../../navigation/navigationTypes"; import { RootStackParamList } from "../../navigation/navigationTypes";
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
@ -37,18 +37,18 @@ const MoveListScreen = ({ navigation }: Props) => {
); );
return ( return (
<ScrollView>
<Button title="Add Move" onPress={() => navigation.navigate(MOVE_FORM, { move: undefined })}/>
<View>
<FlatList <FlatList
data={moves} data={moves}
ListHeaderComponent={
<Button title="Add Move" onPress={() => navigation.navigate(MOVE_FORM, { move: undefined })}/>
}
renderItem={({ item }) => ( renderItem={({ item }) => (
<View style={styles.listItemContainer}> <View style={styles.listItemContainer}>
<MoveListItem <MoveListItem
move={item} move={item}
onPress={() => navigation.navigate(MOVE_DETAIL, { move: item })} onPress={() => navigation.navigate(MOVE_DETAIL, { move: item })}
/> />
<Button title="Delete" <Button title="X"
color={styles.deleteButton.backgroundColor} color={styles.deleteButton.backgroundColor}
onPress={() => { onPress={() => {
if (item.id) { if (item.id) {
@ -59,8 +59,6 @@ const MoveListScreen = ({ navigation }: Props) => {
)} )}
keyExtractor={(item) => item.name} keyExtractor={(item) => item.name}
/> />
</View>
</ScrollView>
); );
}; };

Loading…
Cancel
Save