feat(mobile): entries loading indicator
This commit is contained in:
@@ -37,6 +37,7 @@ import {
|
||||
import { ScreenItemContext } from "@/src/lib/navigation/ScreenItemContext"
|
||||
|
||||
import { ThemedBlurView } from "../../common/ThemedBlurView"
|
||||
import { PlatformActivityIndicator } from "../../ui/loading/PlatformActivityIndicator"
|
||||
import { getDefaultHeaderHeight } from "../utils"
|
||||
import { SetNavigationHeaderHeightContext } from "../views/NavigationHeaderContext"
|
||||
import { FakeNativeHeaderTitle } from "./FakeNativeHeaderTitle"
|
||||
@@ -150,6 +151,7 @@ export interface InternalNavigationHeaderProps
|
||||
hideableBottomHeight?: number
|
||||
headerTitleAbsolute?: boolean
|
||||
headerTitle?: FC<React.ComponentProps<typeof FakeNativeHeaderTitle>> | ReactNode
|
||||
isLoading?: boolean
|
||||
}
|
||||
|
||||
const blurThreshold = 0
|
||||
@@ -168,6 +170,7 @@ export const InternalNavigationHeader = ({
|
||||
headerTitleAbsolute,
|
||||
|
||||
promptBeforeLeave,
|
||||
isLoading,
|
||||
...rest
|
||||
}: InternalNavigationHeaderProps) => {
|
||||
const insets = useSafeAreaInsets()
|
||||
@@ -313,6 +316,11 @@ export const InternalNavigationHeader = ({
|
||||
}}
|
||||
>
|
||||
<View className="shrink" style={{ flexBasis: rightWidth }} />
|
||||
{isLoading && (
|
||||
<View className="mr-2">
|
||||
<PlatformActivityIndicator size="small" />
|
||||
</View>
|
||||
)}
|
||||
{headerTitleAbsolute ? <View /> : headerTitle}
|
||||
<View className="shrink" style={{ flexBasis: leftWidth }} />
|
||||
</Animated.View>
|
||||
|
||||
@@ -140,6 +140,7 @@ export const NavigationBlurEffectHeader = ({
|
||||
headerTitleAbsolute={headerTitleAbsolute}
|
||||
headerTitle={props.headerTitle}
|
||||
promptBeforeLeave={props.promptBeforeLeave}
|
||||
isLoading={props.isLoading}
|
||||
/>
|
||||
</SetNavigationHeaderHeightContext.Provider>
|
||||
),
|
||||
@@ -157,6 +158,7 @@ export const NavigationBlurEffectHeader = ({
|
||||
store,
|
||||
props.headerTitle,
|
||||
props.promptBeforeLeave,
|
||||
props.isLoading,
|
||||
])
|
||||
|
||||
return null
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
import { TimelineViewSelector } from "@/src/modules/screen/TimelineViewSelector"
|
||||
import { getFeed } from "@/src/store/feed/getter"
|
||||
|
||||
import { useEntryListContext, useSelectedFeedTitle } from "./atoms"
|
||||
import { useEntryListContext, useFetchEntriesControls, useSelectedFeedTitle } from "./atoms"
|
||||
|
||||
export function TimelineSelectorProvider({
|
||||
children,
|
||||
@@ -34,10 +34,13 @@ export function TimelineSelectorProvider({
|
||||
const isTimeline = screenType === "timeline"
|
||||
const isSubscriptions = screenType === "subscriptions"
|
||||
|
||||
const { isFetching } = useFetchEntriesControls()
|
||||
|
||||
return (
|
||||
<>
|
||||
<NavigationBlurEffectHeader
|
||||
title={viewTitle}
|
||||
isLoading={(isFeed || isTimeline) && isFetching}
|
||||
headerLeft={useMemo(
|
||||
() =>
|
||||
isTimeline || isSubscriptions
|
||||
|
||||
Reference in New Issue
Block a user