Remove duplicated virtualized lists.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Card, CardItem, Container, Content, Text } from "native-base";
|
||||
import Dinero from "dinero.js";
|
||||
import { Card, CardItem, Text } from "native-base";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FlatList, RefreshControl, StyleSheet } from "react-native";
|
||||
import Dinero from "dinero.js";
|
||||
import { FlatList, RefreshControl, StyleSheet, View } from "react-native";
|
||||
|
||||
export default function JobLines({ job, loading, refetch }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!job) {
|
||||
<Card>
|
||||
<Text>Job is not defined.</Text>
|
||||
@@ -16,49 +17,44 @@ export default function JobLines({ job, loading, refetch }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Content
|
||||
padder
|
||||
<View>
|
||||
<FlatList
|
||||
data={job.joblines}
|
||||
refreshControl={
|
||||
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
|
||||
}
|
||||
>
|
||||
<FlatList
|
||||
data={job.joblines}
|
||||
style={{ flex: 1 }}
|
||||
contentContainerStyle={localStyles.listContentContainer}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={(object) => (
|
||||
<Card>
|
||||
<CardItem style={localStyles.flexRow}>
|
||||
<Text style={localStyles.growWithEllipsis}>{`${
|
||||
object.item.line_desc
|
||||
}${
|
||||
object.item.part_qty > 1 ? ` x ${object.item.part_qty}` : ""
|
||||
}`}</Text>
|
||||
{object.item.part_type && (
|
||||
<Text style={localStyles.sideMargins}>
|
||||
{t(`jobdetail.part_types.${object.item.part_type}`)}
|
||||
</Text>
|
||||
)}
|
||||
contentContainerStyle={localStyles.listContentContainer}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={(object) => (
|
||||
<Card>
|
||||
<CardItem style={localStyles.flexRow}>
|
||||
<Text style={localStyles.growWithEllipsis}>{`${
|
||||
object.item.line_desc
|
||||
}${
|
||||
object.item.part_qty > 1 ? ` x ${object.item.part_qty}` : ""
|
||||
}`}</Text>
|
||||
{object.item.part_type && (
|
||||
<Text style={localStyles.sideMargins}>
|
||||
{Dinero({
|
||||
amount: Math.round((object.item.act_price || 0) * 100),
|
||||
}).toFormat()}
|
||||
{t(`jobdetail.part_types.${object.item.part_type}`)}
|
||||
</Text>
|
||||
</CardItem>
|
||||
<CardItem style={localStyles.flexRow}>
|
||||
{object.item.mod_lbr_ty && (
|
||||
<Text>
|
||||
{t(`jobdetail.lbr_types.${object.item.mod_lbr_ty}`)}
|
||||
</Text>
|
||||
)}
|
||||
</CardItem>
|
||||
</Card>
|
||||
)}
|
||||
/>
|
||||
</Content>
|
||||
</Container>
|
||||
)}
|
||||
<Text style={localStyles.sideMargins}>
|
||||
{Dinero({
|
||||
amount: Math.round((object.item.act_price || 0) * 100),
|
||||
}).toFormat()}
|
||||
</Text>
|
||||
</CardItem>
|
||||
<CardItem style={localStyles.flexRow}>
|
||||
{object.item.mod_lbr_ty && (
|
||||
<Text>
|
||||
{t(`jobdetail.lbr_types.${object.item.mod_lbr_ty}`)}
|
||||
</Text>
|
||||
)}
|
||||
</CardItem>
|
||||
</Card>
|
||||
)}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user