Skip to content

Commit

Permalink
fix: quick manager height
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Dec 2, 2024
1 parent f079f09 commit aed00f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useAccounts } from '@/hooks/account';
import React from 'react';
import { Dimensions, FlatList, TouchableOpacity, View } from 'react-native';
import { TouchableOpacity, View } from 'react-native';
import { useTheme2024 } from '@/hooks/theme';
import { createGetStyles2024 } from '@/utils/styles';
import { AddressItemInner2024 } from '@/screens/Address/components/AddressItemInner2024';
Expand Down Expand Up @@ -114,7 +114,6 @@ export const AddressQuickManager: React.FC<Props> = ({ type, onCancel }) => {
const getStyle = createGetStyles2024(({ colors2024 }) => ({
list: {
padding: 16,
maxHeight: Dimensions.get('window').height,
marginBottom: 56,
},
addressItem: {
Expand Down
14 changes: 11 additions & 3 deletions apps/mobile/src/screens/Address/AddressListScreenButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
removeGlobalBottomSheetModal2024,
} from '@/components2024/GlobalBottomSheetModal';
import { MODAL_NAMES } from '@/components2024/GlobalBottomSheetModal/types';
import { IS_ANDROID } from '@/core/native/utils';
import { useAccounts } from '@/hooks/account';
import { useTheme2024 } from '@/hooks/theme';
import { createGetStyles2024 } from '@/utils/styles';
import React from 'react';
Expand Down Expand Up @@ -36,19 +38,25 @@ export const AddressListScreenButton: React.FC<Props> = ({
type = 'address',
}) => {
const { styles } = useTheme2024({ getStyle });
const { accounts } = useAccounts({
disableAutoFetch: true,
});
const maxHeight = Dimensions.get('window').height - 104;
const contentHeight =
accounts.length * (94 + 12) + (IS_ANDROID ? 60 + 56 : 0);

const onPress = React.useCallback(() => {
const id = createGlobalBottomSheetModal2024({
name: MODAL_NAMES.ADDRESS_QUICK_MANAGER,
bottomSheetModalProps: {
enableDynamicSizing: true,
maxDynamicContentSize: Dimensions.get('window').height - 104,
snapPoints: [Math.min(contentHeight, maxHeight)],
},
type,
onCancel: () => {
removeGlobalBottomSheetModal2024(id);
},
});
}, [type]);
}, [contentHeight, maxHeight, type]);

return (
<TouchableOpacity
Expand Down

0 comments on commit aed00f7

Please sign in to comment.