Skip to content

Commit

Permalink
fix keyboard dismisses option to copy contract address or view on eth…
Browse files Browse the repository at this point in the history
…erscan (#5908)

* fix

* keyboardShouldPersistTaps

* ContextMenuButton
  • Loading branch information
greg-schrammel committed Jul 19, 2024
1 parent c5b3340 commit 59c55bb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
38 changes: 18 additions & 20 deletions src/__swaps__/screens/Swap/components/CoinRow.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import React, { memo, useCallback, useMemo } from 'react';
import { BalancePill } from '@/__swaps__/screens/Swap/components/BalancePill';
import { CoinRowButton } from '@/__swaps__/screens/Swap/components/CoinRowButton';
import { AddressOrEth, ParsedSearchAsset } from '@/__swaps__/types/assets';
import { ChainId } from '@/__swaps__/types/chains';
import { SearchAsset } from '@/__swaps__/types/search';
import { ButtonPressAnimation } from '@/components/animations';
import { ContextMenuButton } from '@/components/context-menu';
import { Box, Column, Columns, HitSlop, Inline, Text } from '@/design-system';
import { CoinRowButton } from '@/__swaps__/screens/Swap/components/CoinRowButton';
import { BalancePill } from '@/__swaps__/screens/Swap/components/BalancePill';
import { toggleFavorite } from '@/resources/favorites';
import { SwapCoinIcon } from './SwapCoinIcon';
import { ethereumUtils, haptics, showActionSheetWithOptions } from '@/utils';
import { ContextMenuButton, OnPressMenuItemEventObject } from 'react-native-ios-context-menu';
import { IS_ANDROID } from '@/env';
import { startCase } from 'lodash';
import { setClipboard } from '@/hooks/useClipboard';
import { RainbowNetworks } from '@/networks';
import * as i18n from '@/languages';
import { ETH_ADDRESS, BASE_DEGEN_ADDRESS, DEGEN_CHAIN_DEGEN_ADDRESS } from '@/references';
import { AddressOrEth, ParsedSearchAsset } from '@/__swaps__/types/assets';
import { RainbowNetworks } from '@/networks';
import { BASE_DEGEN_ADDRESS, DEGEN_CHAIN_DEGEN_ADDRESS, ETH_ADDRESS } from '@/references';
import { toggleFavorite } from '@/resources/favorites';
import { userAssetsStore } from '@/state/assets/userAssets';
import { SearchAsset } from '@/__swaps__/types/search';
import { ChainId } from '@/__swaps__/types/chains';
import { ethereumUtils, haptics, showActionSheetWithOptions } from '@/utils';
import { startCase } from 'lodash';
import React, { memo, useCallback, useMemo } from 'react';
import { GestureResponderEvent } from 'react-native';
import { OnPressMenuItemEventObject } from 'react-native-ios-context-menu';
import { SwapCoinIcon } from './SwapCoinIcon';

export const COIN_ROW_WITH_PADDING_HEIGHT = 56;

Expand Down Expand Up @@ -257,13 +257,11 @@ const InfoButton = ({ address, chainId }: { address: string; chainId: ChainId })

return (
<ContextMenuButton
isMenuPrimaryAction
// @ts-expect-error Types of property 'menuItems' are incompatible
menuConfig={menuConfig}
onPress={IS_ANDROID ? onPressAndroid : undefined}
menuItems={menuConfig.menuItems}
menuTitle={menuConfig.menuTitle}
onPressAndroid={onPressAndroid}
onPressMenuItem={handlePressMenuItem}
useActionSheetFallback={false}
wrapNativeComponent={false}
testID={`coin-row-info-button-${address}`}
>
<CoinRowButton icon="􀅳" outline size="icon 14px" />
</ContextMenuButton>
Expand Down
6 changes: 0 additions & 6 deletions src/__swaps__/screens/Swap/components/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ export const SearchInput = ({
animatedProps={searchInputValue}
onChangeText={output ? onOutputSearchQueryChange : onInputSearchQueryChange}
onBlur={() => {
runOnUI(() => {
if (isSearchFocused.value) {
handleExitSearchWorklet();
}
})();

if (isSearchFocused.value) {
if (output) {
if (useSwapsStore.getState().outputSearchQuery !== '') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const TokenToBuyList = () => {
return (
<Box style={{ height: EXPANDED_INPUT_HEIGHT - 77, width: DEVICE_WIDTH - 24 }}>
<FlashList
keyboardShouldPersistTaps="always"
ListEmptyComponent={<ListEmpty output />}
ListFooterComponent={<Animated.View style={[animatedListPadding, { width: '100%' }]} />}
ListHeaderComponent={<ChainSelection output />}
Expand Down

0 comments on commit 59c55bb

Please sign in to comment.