fix web scrollable flatlist, driveby fix gif select

This commit is contained in:
Samuel Newman
2025-04-17 18:13:50 +03:00
parent 27bd1bb65e
commit e5de53f33d
3 changed files with 21 additions and 12 deletions
+3 -3
View File
@@ -193,7 +193,7 @@ export function Inner({
onInteractOutside={preventDefault} onInteractOutside={preventDefault}
onFocusOutside={preventDefault} onFocusOutside={preventDefault}
onDismiss={close} onDismiss={close}
style={{display: 'flex', flexDirection: 'column'}}> style={{height: '100%', display: 'flex', flexDirection: 'column'}}>
{header} {header}
<View style={[gtMobile ? a.p_2xl : a.p_xl, contentContainerStyle]}> <View style={[gtMobile ? a.p_2xl : a.p_xl, contentContainerStyle]}>
{children} {children}
@@ -227,10 +227,10 @@ export const InnerFlatList = React.forwardRef<
web({maxHeight: '80vh'}), web({maxHeight: '80vh'}),
webInnerStyle, webInnerStyle,
]} ]}
contentContainerStyle={[a.px_0, webInnerContentContainerStyle]}> contentContainerStyle={[a.h_full, a.px_0, webInnerContentContainerStyle]}>
<FlatList <FlatList
ref={ref} ref={ref}
style={[gtMobile ? a.px_2xl : a.px_xl, flatten(style)]} style={[a.h_full, gtMobile ? a.px_2xl : a.px_xl, flatten(style)]}
{...props} {...props}
/> />
</Inner> </Inner>
+4 -6
View File
@@ -172,7 +172,7 @@ function GifList({
</Button> </Button>
)} )}
<TextField.Root> <TextField.Root style={[!gtMobile && isWeb && a.flex_1]}>
<TextField.Icon icon={Search} /> <TextField.Icon icon={Search} />
<TextField.Input <TextField.Input
label={_(msg`Search GIFs`)} label={_(msg`Search GIFs`)}
@@ -206,11 +206,9 @@ function GifList({
renderItem={renderItem} renderItem={renderItem}
numColumns={gtMobile ? 3 : 2} numColumns={gtMobile ? 3 : 2}
columnWrapperStyle={[a.gap_sm]} columnWrapperStyle={[a.gap_sm]}
contentContainerStyle={[ contentContainerStyle={[native([a.px_xl, {minHeight: height}])]}
native([a.px_xl, {minHeight: height}]), webInnerStyle={[web({minHeight: '80vh'})]}
web(a.h_full_vh), webInnerContentContainerStyle={[web(a.pb_0)]}
]}
style={[web(a.h_full_vh)]}
ListHeaderComponent={ ListHeaderComponent={
<> <>
{listHeader} {listHeader}
+14 -3
View File
@@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import { import {
type AccessibilityProps, type AccessibilityProps,
type StyleProp,
StyleSheet, StyleSheet,
TextInput, TextInput,
type TextInputProps, type TextInputProps,
@@ -45,9 +46,12 @@ const Context = React.createContext<{
onBlur: () => {}, onBlur: () => {},
}) })
export type RootProps = React.PropsWithChildren<{isInvalid?: boolean}> export type RootProps = React.PropsWithChildren<{
isInvalid?: boolean
style?: StyleProp<ViewStyle>
}>
export function Root({children, isInvalid = false}: RootProps) { export function Root({children, isInvalid = false, style}: RootProps) {
const inputRef = React.useRef<TextInput>(null) const inputRef = React.useRef<TextInput>(null)
const { const {
state: hovered, state: hovered,
@@ -82,7 +86,14 @@ export function Root({children, isInvalid = false}: RootProps) {
return ( return (
<Context.Provider value={context}> <Context.Provider value={context}>
<View <View
style={[a.flex_row, a.align_center, a.relative, a.w_full, a.px_md]} style={[
a.flex_row,
a.align_center,
a.relative,
a.w_full,
a.px_md,
style,
]}
{...web({ {...web({
onClick: () => inputRef.current?.focus(), onClick: () => inputRef.current?.focus(),
onMouseOver: onHoverIn, onMouseOver: onHoverIn,