claude suggestions
This commit is contained in:
@@ -208,6 +208,7 @@ export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
|
|||||||
useEnableKeyboardController(isIOS)
|
useEnableKeyboardController(isIOS)
|
||||||
|
|
||||||
const [keyboardHeight, setKeyboardHeight] = React.useState(0)
|
const [keyboardHeight, setKeyboardHeight] = React.useState(0)
|
||||||
|
const keyboardVisible = keyboardHeight > 0
|
||||||
|
|
||||||
useKeyboardHandler(
|
useKeyboardHandler(
|
||||||
{
|
{
|
||||||
@@ -219,21 +220,26 @@ export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
|
|||||||
[],
|
[],
|
||||||
)
|
)
|
||||||
|
|
||||||
let paddingBottom = 0
|
// Standardized padding calculation across platforms
|
||||||
if (isIOS) {
|
|
||||||
paddingBottom += keyboardHeight / 4
|
// Only add safe area insets when the sheet is at full height
|
||||||
if (nativeSnapPoint === BottomSheetSnapPoint.Full) {
|
// For partial sheets, the sheet already positions above the safe area
|
||||||
paddingBottom += insets.bottom + tokens.space.md
|
const basePadding =
|
||||||
}
|
nativeSnapPoint === BottomSheetSnapPoint.Full ? insets.bottom : 0
|
||||||
paddingBottom = Math.max(paddingBottom, tokens.space._2xl)
|
|
||||||
} else {
|
// Standard buffer for all dialogs to ensure content isn't cut off
|
||||||
paddingBottom += keyboardHeight
|
const standardBuffer = tokens.space._2xl
|
||||||
if (nativeSnapPoint === BottomSheetSnapPoint.Full) {
|
|
||||||
paddingBottom += insets.top
|
// Add keyboard offset when keyboard is visible
|
||||||
}
|
// iOS handles keyboard overlays more gracefully so we use a smaller factor
|
||||||
paddingBottom +=
|
const keyboardOffset = keyboardVisible
|
||||||
Math.max(insets.bottom, tokens.space._5xl) + tokens.space._2xl
|
? isIOS
|
||||||
}
|
? keyboardHeight / 3
|
||||||
|
: keyboardHeight
|
||||||
|
: 0
|
||||||
|
|
||||||
|
// Calculate final padding
|
||||||
|
const paddingBottom = basePadding + standardBuffer + keyboardOffset
|
||||||
|
|
||||||
const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||||
if (!isAndroid) {
|
if (!isAndroid) {
|
||||||
@@ -249,10 +255,12 @@ export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<KeyboardAwareScrollView
|
<KeyboardAwareScrollView
|
||||||
|
style={{backgroundColor: 'blue'}}
|
||||||
contentContainerStyle={[
|
contentContainerStyle={[
|
||||||
a.pt_2xl,
|
a.pt_2xl,
|
||||||
a.px_xl,
|
a.px_xl,
|
||||||
{paddingBottom},
|
{paddingBottom},
|
||||||
|
{backgroundColor: 'red'},
|
||||||
contentContainerStyle,
|
contentContainerStyle,
|
||||||
]}
|
]}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
@@ -280,6 +288,23 @@ export const InnerFlatList = React.forwardRef<
|
|||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
const {nativeSnapPoint, disableDrag, setDisableDrag} = useDialogContext()
|
const {nativeSnapPoint, disableDrag, setDisableDrag} = useDialogContext()
|
||||||
|
|
||||||
|
// Customized padding for InnerFlatList
|
||||||
|
// FlatLists are typically used for more complex content like profile/card lists
|
||||||
|
// and need more bottom padding to ensure content isn't cut off when scrolling
|
||||||
|
|
||||||
|
// Enhanced buffer for FlatLists to ensure content is fully visible when scrolled to bottom
|
||||||
|
// Using 4xl space (much larger than the 2xl used in ScrollableInner)
|
||||||
|
const flatListBuffer = tokens.space._5xl
|
||||||
|
|
||||||
|
// Only add safe area insets when the sheet is at full height
|
||||||
|
const basePadding =
|
||||||
|
nativeSnapPoint === BottomSheetSnapPoint.Full
|
||||||
|
? insets.bottom + flatListBuffer
|
||||||
|
: 0
|
||||||
|
|
||||||
|
// Add additional padding for complex list components
|
||||||
|
const footerHeight = basePadding + tokens.space._2xl
|
||||||
|
|
||||||
const onScroll = (e: ReanimatedScrollEvent) => {
|
const onScroll = (e: ReanimatedScrollEvent) => {
|
||||||
'worklet'
|
'worklet'
|
||||||
if (!isAndroid) {
|
if (!isAndroid) {
|
||||||
@@ -293,13 +318,15 @@ export const InnerFlatList = React.forwardRef<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('footerHeight', footerHeight)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollProvider onScroll={onScroll}>
|
<ScrollProvider onScroll={onScroll}>
|
||||||
<List
|
<List
|
||||||
keyboardShouldPersistTaps="handled"
|
keyboardShouldPersistTaps="handled"
|
||||||
bounces={nativeSnapPoint === BottomSheetSnapPoint.Full}
|
bounces={nativeSnapPoint === BottomSheetSnapPoint.Full}
|
||||||
ListFooterComponent={
|
ListFooterComponent={
|
||||||
<View style={{height: insets.bottom + a.pt_5xl.paddingTop + 50}} />
|
<View style={{height: footerHeight, backgroundColor: 'green'}} />
|
||||||
}
|
}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {AppBskyActorDefs, sanitizeMutedWordValue} from '@atproto/api'
|
import {type AppBskyActorDefs, sanitizeMutedWordValue} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isNative} from '#/platform/detection'
|
|
||||||
import {
|
import {
|
||||||
usePreferencesQuery,
|
usePreferencesQuery,
|
||||||
useRemoveMutedWordMutation,
|
useRemoveMutedWordMutation,
|
||||||
@@ -16,7 +15,7 @@ import {
|
|||||||
native,
|
native,
|
||||||
useBreakpoints,
|
useBreakpoints,
|
||||||
useTheme,
|
useTheme,
|
||||||
ViewStyleProp,
|
type ViewStyleProp,
|
||||||
web,
|
web,
|
||||||
} from '#/alf'
|
} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
@@ -400,8 +399,6 @@ function MutedWordsInner() {
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{isNative && <View style={{height: 20}} />}
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Dialog.Close />
|
<Dialog.Close />
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {ImageStyle, useWindowDimensions, View} from 'react-native'
|
import {type ImageStyle, useWindowDimensions, View} from 'react-native'
|
||||||
import {Image} from 'expo-image'
|
import {Image} from 'expo-image'
|
||||||
import {msg, Plural, Trans} from '@lingui/macro'
|
import {msg, Plural, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {MAX_ALT_TEXT} from '#/lib/constants'
|
import {MAX_ALT_TEXT} from '#/lib/constants'
|
||||||
import {enforceLen} from '#/lib/strings/helpers'
|
import {enforceLen} from '#/lib/strings/helpers'
|
||||||
import {isAndroid, isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {ComposerImage} from '#/state/gallery'
|
import {type ComposerImage} from '#/state/gallery'
|
||||||
import {AltTextCounterWrapper} from '#/view/com/composer/AltTextCounterWrapper'
|
import {AltTextCounterWrapper} from '#/view/com/composer/AltTextCounterWrapper'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
import {DialogControlProps} from '#/components/Dialog'
|
import {type DialogControlProps} from '#/components/Dialog'
|
||||||
import * as TextField from '#/components/forms/TextField'
|
import * as TextField from '#/components/forms/TextField'
|
||||||
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
|
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
@@ -165,8 +165,6 @@ const ImageAltTextInner = ({
|
|||||||
</Button>
|
</Button>
|
||||||
</AltTextCounterWrapper>
|
</AltTextCounterWrapper>
|
||||||
</View>
|
</View>
|
||||||
{/* Maybe fix this later -h */}
|
|
||||||
{isAndroid ? <View style={{height: 300}} /> : null}
|
|
||||||
</Dialog.ScrollableInner>
|
</Dialog.ScrollableInner>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user