Skip to content

Commit

Permalink
feat: implement zoom for chart
Browse files Browse the repository at this point in the history
  • Loading branch information
mnindrazaka committed Sep 20, 2024
1 parent 59a4e55 commit 2b4d859
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
8 changes: 8 additions & 0 deletions libs/api-contract/src/useQuery.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
QueryKey,
useQuery as useTantackQuery,
} from '@tanstack/react-query';
import { useFocusEffect } from '@react-navigation/native';
import { useCallback } from 'react';

export function useQuery<
TQueryFnData = unknown,
Expand All @@ -18,5 +20,11 @@ export function useQuery<
...options,
});

useFocusEffect(
useCallback(() => {
query.refetch();
}, [query.refetch])
);

return query;
}
2 changes: 1 addition & 1 deletion libs/ui/src/base/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Pagination = ({
disabled={currentPage === page}
theme={page === currentPage ? 'blue' : undefined}
>
{page}
{page.toString()}
</Button>
))}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
VictoryScatter,
VictoryAxis,
VictoryLegend,
VictoryZoomContainer,
} from 'victory';
import { useTransactionStatisticState } from './TransactionStatistic.state';
import { ErrorView, LoadingView } from '../../../base';
Expand Down Expand Up @@ -43,6 +44,7 @@ export const TransactionStatistic = () => {
width={600}
height={300}
padding={{ top: 50, bottom: 50, left: 80, right: 50 }}
containerComponent={<VictoryZoomContainer />}
>
<VictoryLine
style={{
Expand Down
45 changes: 45 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"tamagui": "^1.111.10",
"tslib": "^2.3.0",
"victory": "^37.1.1",
"victory-native": "^37.0.3-next.0",
"zod": "^3.23.8",
"zod-formik-adapter": "^1.3.0"
},
Expand Down

0 comments on commit 2b4d859

Please sign in to comment.