From 27c591f031fbe8b3a5837c4ef7082b2ce146a050 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 25 Aug 2025 19:37:12 +0300 Subject: Fix Gif Select dialog search bar scrolling away (#8874) * fix flatlist dialogs on web * tweak gif select dialog, add style prop to textfield --- src/components/Dialog/index.web.tsx | 6 +++--- src/components/Dialog/shared.tsx | 5 +++-- src/components/dialogs/GifSelect.tsx | 14 ++++++-------- src/components/forms/TextField.tsx | 15 ++++++++++++--- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/components/Dialog/index.web.tsx b/src/components/Dialog/index.web.tsx index 12bd8819b..1417e9e91 100644 --- a/src/components/Dialog/index.web.tsx +++ b/src/components/Dialog/index.web.tsx @@ -193,7 +193,7 @@ export function Inner({ onInteractOutside={preventDefault} onFocusOutside={preventDefault} onDismiss={close} - style={{display: 'flex', flexDirection: 'column'}}> + style={{height: '100%', display: 'flex', flexDirection: 'column'}}> {header} {children} @@ -227,10 +227,10 @@ export const InnerFlatList = React.forwardRef< web({maxHeight: '80vh'}), webInnerStyle, ]} - contentContainerStyle={[a.px_0, webInnerContentContainerStyle]}> + contentContainerStyle={[a.h_full, a.px_0, webInnerContentContainerStyle]}> diff --git a/src/components/Dialog/shared.tsx b/src/components/Dialog/shared.tsx index 40d040878..b5513b19c 100644 --- a/src/components/Dialog/shared.tsx +++ b/src/components/Dialog/shared.tsx @@ -5,7 +5,6 @@ import { View, type ViewStyle, } from 'react-native' -import type React from 'react' import {atoms as a, useTheme} from '#/alf' import {Text} from '#/components/Typography' @@ -28,6 +27,8 @@ export function Header({ }) { return ( - + {children} ) diff --git a/src/components/dialogs/GifSelect.tsx b/src/components/dialogs/GifSelect.tsx index e18fdf2db..15c1ba26e 100644 --- a/src/components/dialogs/GifSelect.tsx +++ b/src/components/dialogs/GifSelect.tsx @@ -1,4 +1,4 @@ -import React, { +import { useCallback, useImperativeHandle, useMemo, @@ -119,7 +119,7 @@ function GifList({ [onSelectGif], ) - const onEndReached = React.useCallback(() => { + const onEndReached = useCallback(() => { if (isFetchingNextPage || !hasNextPage || error) return fetchNextPage() }, [isFetchingNextPage, hasNextPage, error, fetchNextPage]) @@ -172,7 +172,7 @@ function GifList({ )} - + {listHeader} diff --git a/src/components/forms/TextField.tsx b/src/components/forms/TextField.tsx index 9993317d6..3d4caa93b 100644 --- a/src/components/forms/TextField.tsx +++ b/src/components/forms/TextField.tsx @@ -48,9 +48,11 @@ const Context = createContext<{ }) Context.displayName = 'TextFieldContext' -export type RootProps = React.PropsWithChildren<{isInvalid?: boolean}> +export type RootProps = React.PropsWithChildren< + {isInvalid?: boolean} & TextStyleProp +> -export function Root({children, isInvalid = false}: RootProps) { +export function Root({children, isInvalid = false, style}: RootProps) { const inputRef = useRef(null) const { state: hovered, @@ -85,7 +87,14 @@ export function Root({children, isInvalid = false}: RootProps) { return ( inputRef.current?.focus(), onMouseOver: onHoverIn, -- cgit 1.4.1