Skip to content

Commit

Permalink
feat: the address book header supports clicking. (#6522)
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming authored Jan 16, 2025
1 parent 69e1bf7 commit 25091f5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
10 changes: 5 additions & 5 deletions apps/mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PODS:
- ExpoModulesCore
- ExpoFileSystem (16.0.5):
- ExpoModulesCore
- ExpoHaptics (12.6.0):
- ExpoHaptics (12.8.1):
- ExpoModulesCore
- ExpoImageManipulator (11.5.0):
- EXImageLoader
Expand Down Expand Up @@ -1686,7 +1686,7 @@ SPEC CHECKSUMS:
Burnt: dde5dd245f124a4594098e3938ba71aae4ec83c3
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
CocoaLumberjack: 5c7e64cdb877770859bddec4d3d5a0d7c9299df9
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
EXApplication: 137189a3f149b4e8e546884629392c3efc94cbd3
EXBarCodeScanner: d59fd943cebee3f913ebf4ffde0d05d344da8b78
EXConstants: 988aa430ca0f76b43cd46b66e7fae3287f9cc2fc
Expand All @@ -1698,7 +1698,7 @@ SPEC CHECKSUMS:
ExpoClipboard: b597982124f067ff9f5b89093eb3d97898d5d877
ExpoDevice: d204395e17fffdcefa7470bdef33b07719ac41b1
ExpoFileSystem: 04795dd4d47e76eaf12e38c92091f77d794f9e7f
ExpoHaptics: 604aca02e942d1d43c139cae7cf397b26f85476f
ExpoHaptics: 28a771b630353cd6e8dcf1b1e3e693e38ad7c3c3
ExpoImageManipulator: 6d37f811d47a89afb34c0ec2521c6a6ea5f5a5be
ExpoImagePicker: 9e5c745cb3e56ee00e1cfe5d6af59caab66ecf1a
ExpoKeepAwake: 0f5cad99603a3268e50af9a6eb8b76d0d9ac956c
Expand All @@ -1713,7 +1713,7 @@ SPEC CHECKSUMS:
FBLazyVector: 9f533d5a4c75ca77c8ed774aced1a91a0701781e
FBReactNativeSpec: 2db5940ee4b58968274eec0a4f1c736fc4caefa3
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
hermes-engine: 39589e9c297d024e90fe68f6830ff86c4e01498a
ImageColors: 88be684570585c07ae2750bff34eb7b78bfc53b4
IQKeyboardManagerSwift: c7955c0bdbf7b2eb29bb7daaa44e3d90f55a9a85
Expand Down Expand Up @@ -1817,7 +1817,7 @@ SPEC CHECKSUMS:
SPIndicator: 93e0a4fb23de51294ac48e874c0f081a5e293e4f
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
Yoga: 07db09965bc46c4902e20d3ae6990d95e53af8a8
Yoga: 6d01ccde54c9f8b92492beb05d468dbfed1d9881
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5

PODFILE CHECKSUM: 5b7f20a90e19262f325cab10e37056b7f3cd0ffb
Expand Down
23 changes: 18 additions & 5 deletions packages/components/src/primitives/Haptics/index.native.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { impactAsync, notificationAsync, selectionAsync } from 'expo-haptics';

import type { IHaptics } from './type';
import type {
ImpactFeedbackStyle,
import {
NotificationFeedbackType,
impactAsync,
notificationAsync,
selectionAsync,
} from 'expo-haptics';

import type { IHaptics } from './type';
import type { ImpactFeedbackStyle } from 'expo-haptics';

export const Haptics: IHaptics = {
impact(style: ImpactFeedbackStyle) {
void impactAsync(style);
Expand All @@ -18,6 +20,17 @@ export const Haptics: IHaptics = {
notification(type: NotificationFeedbackType) {
void notificationAsync(type);
},
success() {
void notificationAsync(NotificationFeedbackType.Success);
},

warning() {
void notificationAsync(NotificationFeedbackType.Warning);
},

error() {
void notificationAsync(NotificationFeedbackType.Error);
},
};

export * from './type';
3 changes: 3 additions & 0 deletions packages/components/src/primitives/Haptics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ export const Haptics: IHaptics = {
impact() {},
selection() {},
notification() {},
success() {},
warning() {},
error() {},
};

export * from './type';
3 changes: 3 additions & 0 deletions packages/components/src/primitives/Haptics/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export type IHaptics = {
impact: (style: ImpactFeedbackStyle) => void;
selection: () => void;
notification: (type: NotificationFeedbackType) => void;
success: () => void;
warning: () => void;
error: () => void;
};

export { ImpactFeedbackStyle, NotificationFeedbackType } from 'expo-haptics';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Badge,
Empty,
Icon,
IconButton,
MatchSizeableText,
SearchBar,
SectionList,
Expand All @@ -23,6 +22,7 @@ import { ETranslations } from '@onekeyhq/shared/src/locale';
import type { IFuseResultMatch } from '@onekeyhq/shared/src/modules3rdParty/fuse';
import { buildFuse } from '@onekeyhq/shared/src/modules3rdParty/fuse';
import { EModalAddressBookRoutes } from '@onekeyhq/shared/src/routes';
import { listItemPressStyle } from '@onekeyhq/shared/src/style';

import { AddressBookSectionList } from './AddressBookSectionList';
import { ListItemIconButton } from './ListItemIconButton';
Expand Down Expand Up @@ -239,19 +239,23 @@ export const AddressBookListContent = ({
<SectionList.SectionHeader
title={section.title.toUpperCase()}
justifyContent="space-between"
userSelect="none"
{...listItemPressStyle}
borderRadius="$2"
px="$3"
mx="$2"
onPress={() => onToggle(section.title)}
>
<IconButton
<Icon
size="small"
variant="tertiary"
testID={`address-cat-${section.title.toUpperCase()}-${
section.isFold ? 'fold' : 'unfold'
}`}
icon={
name={
section.isFold
? 'ChevronRightSmallOutline'
: 'ChevronDownSmallSolid'
}
onPress={() => onToggle(section.title)}
/>
</SectionList.SectionHeader>
) : null,
Expand Down
7 changes: 4 additions & 3 deletions packages/kit/src/views/Onboarding/components/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { shuffle } from 'lodash';
import { InteractionManager } from 'react-native';

import type { useForm } from '@onekeyhq/components';
import { useClipboard, useKeyboardEvent } from '@onekeyhq/components';
import { Haptics, useClipboard, useKeyboardEvent } from '@onekeyhq/components';
import { dismissKeyboard } from '@onekeyhq/shared/src/keyboard';
import platformEnv from '@onekeyhq/shared/src/platformEnv';
import timerUtils from '@onekeyhq/shared/src/utils/timerUtils';
Expand Down Expand Up @@ -250,6 +250,7 @@ export const useSuggestion = (
(value: string, inputIndex: number) => {
const arrays = value.trim().split(' ');
if (arrays.length > 1) {
Haptics.success();
let currentPhraseLength = phraseLength;
setTimeout(async () => {
clearText();
Expand All @@ -259,7 +260,7 @@ export const useSuggestion = (
) {
currentPhraseLength = arrays.length;
setPhraseLength(currentPhraseLength.toString());
await timerUtils.wait(25);
await timerUtils.wait(30);
}
const formValues = Object.values(form.getValues());
const values: string[] = formValues.slice(0, inputIndex);
Expand All @@ -276,7 +277,7 @@ export const useSuggestion = (
resetSuggestions();
await timerUtils.wait(10);
checkAllWords();
}, 25);
}, 30);
}
},
[
Expand Down

0 comments on commit 25091f5

Please sign in to comment.