Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/frontend/screens/ObservationsList/ObservationListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function ObservationListItemNotMemoized({
<TouchableOpacity
onPress={() => onPress(observation.docId)}
testID={testID}
style={{flex: 1, height: 80}}>
style={{flex: 1, minHeight: 80}}>
<React.Suspense
fallback={
<View style={[styles.container, style]}>
Expand Down Expand Up @@ -136,7 +136,7 @@ const styles = StyleSheet.create({
width: '100%',
paddingHorizontal: 20,
flex: 1,
height: 80,
minHeight: 80,
},
text: {
flex: 1,
Expand Down
19 changes: 2 additions & 17 deletions src/frontend/screens/ObservationsList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {View, FlatList, Dimensions, StyleSheet} from 'react-native';
import {View, FlatList, StyleSheet} from 'react-native';
import {Observation, Track} from '@comapeo/schema';
import {MessageDescriptor, defineMessages} from 'react-intl';
import {useFocusEffect} from '@react-navigation/native';
Expand Down Expand Up @@ -36,17 +36,8 @@ const m = defineMessages({
},
});

const OBSERVATION_CELL_HEIGHT = 80;
const ONE_HOUR = 60 * 60 * 1000;

function getItemLayout(_data: unknown, index: number) {
return {
length: OBSERVATION_CELL_HEIGHT,
offset: OBSERVATION_CELL_HEIGHT * index,
index,
};
}

const keyExtractor = (item: Observation | Track) => item.docId;

export const ObservationsList: React.FC<
Expand Down Expand Up @@ -80,10 +71,6 @@ export const ObservationsList: React.FC<
lastInteractionRef.current = mode === 'mine' ? Date.now() : null;
}

const rowsPerWindow = Math.ceil(
(Dimensions.get('window').height - 65) / OBSERVATION_CELL_HEIGHT,
);

const filteredData = React.useMemo(() => {
const allData = [...observations, ...tracks];

Expand Down Expand Up @@ -123,8 +110,6 @@ export const ObservationsList: React.FC<
)}
{/* re: https://github.com/digidem/comapeo-mobile/issues/586 */}
<FlatList
initialNumToRender={rowsPerWindow}
getItemLayout={getItemLayout}
keyExtractor={keyExtractor}
style={styles.container}
windowSize={3}
Expand Down Expand Up @@ -173,6 +158,6 @@ const styles = StyleSheet.create({
backgroundColor: WHITE,
},
listItem: {
height: OBSERVATION_CELL_HEIGHT,
minHeight: 80,
},
});
Loading