-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Finally fix the vault scroll performance (#1741)
- Loading branch information
1 parent
a4c58e6
commit 4b421b9
Showing
7 changed files
with
217 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { useNavigation } from "@react-navigation/native"; | ||
import { Text, View, TouchableOpacity, StyleSheet } from "react-native"; | ||
import { Image } from "expo-image"; | ||
|
||
import { DestinyIconStyles, ICON_SIZE } from "@/app/utilities/UISize.ts"; | ||
import { CRAFTED_OVERLAY } from "@/app/inventory/logic/Constants.ts"; | ||
import type { DestinyIconData } from "@/app/inventory/logic/Types.ts"; | ||
import EmptyCell from "@/app/inventory/cells/EmptyCell.tsx"; | ||
|
||
type Props = { | ||
readonly iconData: DestinyIconData | undefined; | ||
}; | ||
|
||
export default function DestinyCell2({ iconData }: Props) { | ||
"use memo"; | ||
|
||
if (iconData === undefined) { | ||
return ( | ||
<View style={styles.container}> | ||
<EmptyCell /> | ||
</View> | ||
); | ||
} | ||
|
||
const navigation = useNavigation(); | ||
const handlePress = () => { | ||
navigation.navigate("Details", { | ||
characterId: iconData.characterId, | ||
itemHash: iconData.itemHash, | ||
itemInstanceId: iconData.itemInstanceId, | ||
bucketHash: iconData.bucketHash, | ||
}); | ||
}; | ||
|
||
return ( | ||
<TouchableOpacity onPress={handlePress}> | ||
<View style={DestinyIconStyles.container}> | ||
<View style={[DestinyIconStyles.icon, { borderColor: iconData.borderColor }]}> | ||
<Image | ||
source={{ uri: iconData.icon }} | ||
cachePolicy="memory-disk" | ||
style={DestinyIconStyles.innerFrameSize} | ||
recyclingKey={iconData.icon} | ||
/> | ||
|
||
<Image | ||
source={{ uri: iconData.calculatedWaterMark }} | ||
cachePolicy="memory-disk" | ||
style={DestinyIconStyles.innerFrameSize} | ||
recyclingKey={iconData.calculatedWaterMark} | ||
/> | ||
|
||
{iconData.crafted && ( | ||
<Image source={CRAFTED_OVERLAY} cachePolicy="memory" style={DestinyIconStyles.innerFrameSize} /> | ||
)} | ||
</View> | ||
{iconData.primaryStat > 0 && ( | ||
<View style={DestinyIconStyles.primaryStat}> | ||
<Text style={DestinyIconStyles.primaryStatText}>{iconData.primaryStat}</Text> | ||
</View> | ||
)} | ||
{iconData.damageTypeIconUri && ( | ||
<View style={DestinyIconStyles.miniIconBurn}> | ||
<Image | ||
style={DestinyIconStyles.miniIconBurnSize} | ||
source={iconData.damageTypeIconUri} | ||
cachePolicy="memory" | ||
/> | ||
</View> | ||
)} | ||
{iconData.quantity > 1 && ( | ||
<View style={iconData.stackSizeMaxed ? DestinyIconStyles.quantityMaxed : DestinyIconStyles.quantity}> | ||
<Text | ||
style={ | ||
iconData.stackSizeMaxed ? DestinyIconStyles.quantityLevelTextMaxed : DestinyIconStyles.quantityLevelText | ||
} | ||
> | ||
{iconData.quantity} | ||
</Text> | ||
</View> | ||
)} | ||
</View> | ||
</TouchableOpacity> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
width: ICON_SIZE, | ||
height: ICON_SIZE, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { View } from "react-native"; | ||
|
||
import { DEFAULT_MARGIN, ICON_MARGIN, ICON_SIZE, INV_MAX_WIDTH } from "@/app/utilities/UISize.ts"; | ||
import type { DestinyIconData } from "@/app/inventory/logic/Types.ts"; | ||
import DestinyCell2 from "@/app/inventory/cells/DestinyCell2.tsx"; | ||
|
||
type Props = { | ||
readonly iconData: DestinyIconData[]; | ||
}; | ||
|
||
export default function LootItemRow({ iconData }: Props) { | ||
"use memo"; | ||
return ( | ||
<View | ||
style={{ | ||
height: ICON_SIZE + ICON_MARGIN, | ||
width: ICON_SIZE * 5 + ICON_MARGIN * 4, | ||
flexDirection: "row", | ||
justifyContent: "space-between", | ||
alignContent: "space-between", | ||
alignItems: "center", | ||
marginLeft: DEFAULT_MARGIN, | ||
marginRight: DEFAULT_MARGIN, | ||
maxWidth: INV_MAX_WIDTH, | ||
}} | ||
> | ||
<DestinyCell2 iconData={iconData[0]} /> | ||
<DestinyCell2 iconData={iconData[1]} /> | ||
<DestinyCell2 iconData={iconData[2]} /> | ||
<DestinyCell2 iconData={iconData[3]} /> | ||
<DestinyCell2 iconData={iconData[4]} /> | ||
</View> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.