Fix bottom space on feeds (#2081)

* Fix bottom space on feeds

* Translate

* Handle web better
This commit is contained in:
Eric Bailey 2023-12-04 18:24:51 -06:00 committed by GitHub
parent 6e2eaa746d
commit 4f171be9bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 213 additions and 166 deletions

View file

@ -26,6 +26,7 @@ import {
pollLatest,
} from '#/state/queries/post-feed'
import {useModerationOpts} from '#/state/queries/preferences'
import {isWeb} from '#/platform/detection'
const LOADING_ITEM = {_reactKey: '__loading__'}
const EMPTY_FEED_ITEM = {_reactKey: '__empty__'}
@ -216,19 +217,25 @@ let Feed = ({
const shouldRenderEndOfFeed =
!hasNextPage && !isEmpty && !isFetching && !isError && !!renderEndOfFeed
const FeedFooter = React.useCallback(
() =>
isFetchingNextPage ? (
<View style={styles.feedFooter}>
<ActivityIndicator />
</View>
) : shouldRenderEndOfFeed ? (
renderEndOfFeed()
) : (
<View />
),
[isFetchingNextPage, shouldRenderEndOfFeed, renderEndOfFeed],
)
const FeedFooter = React.useCallback(() => {
/**
* A bit of padding at the bottom of the feed as you scroll and when you
* reach the end, so that content isn't cut off by the bottom of the
* screen.
*/
const offset = Math.max(headerOffset, 32) * (isWeb ? 1 : 2)
return isFetchingNextPage ? (
<View style={[styles.feedFooter]}>
<ActivityIndicator />
<View style={{height: offset}} />
</View>
) : shouldRenderEndOfFeed ? (
<View style={{minHeight: offset}}>{renderEndOfFeed()}</View>
) : (
<View style={{height: offset}} />
)
}, [isFetchingNextPage, shouldRenderEndOfFeed, renderEndOfFeed, headerOffset])
const scrollHandler = useAnimatedScrollHandler(onScroll || {})
return (

View file

@ -1,5 +1,5 @@
import React from 'react'
import {StyleSheet, View} from 'react-native'
import {StyleSheet, View, Dimensions} from 'react-native'
import {useNavigation} from '@react-navigation/native'
import {
FontAwesomeIcon,
@ -36,7 +36,12 @@ export function FollowingEndOfFeed() {
}, [navigation])
return (
<View style={[styles.container, pal.border]}>
<View
style={[
styles.container,
pal.border,
{minHeight: Dimensions.get('window').height * 0.75},
]}>
<View style={styles.inner}>
<Text type="xl-medium" style={[s.textCenter, pal.text]}>
You've reached the end of your feed! Find some more accounts to