Skip to content

Commit

Permalink
fix scrollable view
Browse files Browse the repository at this point in the history
  • Loading branch information
code-z2 committed Sep 20, 2024
1 parent d560d7a commit a2e407a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/[action].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ActionSheet = () => {
>
<Usdc className="h-8 w-8" />
<Text className="text-base font-normal font-poppins-regular">
{Number(balance).toFixed(0)} USDC available
{Math.floor(Number(balance))} USDC available
</Text>
</Badge>
</View>
Expand Down
2 changes: 1 addition & 1 deletion components/ActionableCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const actions: {

export const ActionableCards = () => {
return (
<HomeContentWrapper className="mt-6">
<HomeContentWrapper className="mt-6" contentClassname="items-center">
<Animated.View
layout={CurvedTransition.easingX(Easing.in(Easing.exp))
.easingY(Easing.out(Easing.quad))
Expand Down
13 changes: 9 additions & 4 deletions components/HomeContentWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { View, ViewProps } from "react-native";
import { FC, PropsWithChildren } from "react";
import { Text } from "./ui/text";
import { cn } from "~/lib/utils";

export const HomeContentWrapper: FC<
PropsWithChildren<{ sectionTitle?: string }> & ViewProps
> = ({ children, sectionTitle, ...props }) => {
PropsWithChildren<{
sectionTitle?: string;
contentClassname?: string;
}> &
ViewProps
> = ({ children, sectionTitle, contentClassname, ...props }) => {
return (
<View className="gap-4 p-4" {...props}>
<View className={cn("gap-4 p-4", props.className)} {...props}>
{sectionTitle && (
<Text className="font-poppins-semibold text-base ml-4 p-4">
{sectionTitle}
</Text>
)}
<View className="items-center">{children}</View>
<View className={contentClassname}>{children}</View>
</View>
);
};
Expand Down
23 changes: 11 additions & 12 deletions components/TransactionSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FlatList, View } from "react-native";
import { Text } from "./ui/text";
import { BottomSheetModal } from "@gorhom/bottom-sheet";
import { BottomSheetFlatList, BottomSheetModal } from "@gorhom/bottom-sheet";
import { useCallback, useEffect, useMemo, useRef } from "react";
import { Card } from "./ui/card";
import Animated from "react-native-reanimated";
Expand Down Expand Up @@ -87,7 +87,8 @@ export const TransactionSheet = ({
>
<HomeContentWrapper
sectionTitle="Transactions"
className="w-full h-full"
contentClassname="flex-1"
className="flex-1 w-full"
>
<AnimatePresence>
{isFetching ? (
Expand All @@ -102,16 +103,14 @@ export const TransactionSheet = ({
/>
</View>
) : transactions?.length ? (
<View className="w-full h-full">
<FlatList
data={transactions}
keyExtractor={(item) => item.txHash}
renderItem={({ item, index }) => (
<TransactionItem item={item} index={index} />
)}
ItemSeparatorComponent={Separator}
/>
</View>
<BottomSheetFlatList
data={transactions}
keyExtractor={(item) => item.txHash}
renderItem={({ item, index }) => (
<TransactionItem item={item} index={index} />
)}
ItemSeparatorComponent={Separator}
/>
) : (
<EmptyList state={animationState} />
)}
Expand Down
4 changes: 3 additions & 1 deletion lib/useProxy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ export const useProxy = () => {
);
if (response.data.error) {
return Err(response.data.error);
} else if (response.data.success) {
return Ok(response.data);
}
return Ok(response.data);
return Err("Transaction failed with code: " + response.data.code);
} catch (error) {
if (axios.isAxiosError(error)) {
return Err(error.response?.data?.message || error.message);
Expand Down
2 changes: 1 addition & 1 deletion proxy/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ app.get("/txs/:address", async (req, res) => {
const txHash = tx.hash.toUpperCase();
const height = tx.height;

if (transactionsMap.has(txHash)) {
if (transactionsMap.has(txHash) || tx.tx_result.code > 0) {
continue;
}

Expand Down

0 comments on commit a2e407a

Please sign in to comment.