Skip to content

Commit

Permalink
fix: fixed the issue of the soft keyboard closing automatically. #6596)
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming authored Feb 5, 2025
1 parent 038d1ad commit 8694fb1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/components/src/primitives/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ const ButtonComponent = ButtonFrame.styleable<IButtonProps>((props, ref) => {
) : null}
{childrenAsText ? (
<SizableText
textAlign={textAlign}
// Fix text truncation issues and Chinese punctuation display by allowing text to wrap onto multiple lines
// https://www.cnblogs.com/fresh-bright/p/13685644.html
//
textBreakStrategy="simple"
size={textVariant as FontSizeTokens}
color={outerColor || color}
>
Expand Down
11 changes: 9 additions & 2 deletions packages/kit/src/views/Home/pages/HomePageView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';

import { useIntl } from 'react-intl';
import { Animated, Easing, Keyboard } from 'react-native';
Expand Down Expand Up @@ -152,8 +152,15 @@ export function HomePageView({
[accountName, deriveInfo?.label, deriveInfo?.labelKey, intl, network?.name],
);

const prevPageIndex = useRef<number | undefined>();
const handleSelectPageIndexChange = useCallback((pageIndex: number) => {
Keyboard.dismiss();
if (
prevPageIndex.current !== undefined &&
prevPageIndex.current !== pageIndex
) {
Keyboard.dismiss();
}
prevPageIndex.current = pageIndex;
}, []);

const renderTabs = useCallback(
Expand Down

0 comments on commit 8694fb1

Please sign in to comment.