feat: introduce PlatformActivityIndicator for consistent loading indicators across mobile components
Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { cn } from "@follow/utils"
|
||||
import { useEffect } from "react"
|
||||
import type { PressableProps } from "react-native"
|
||||
import { ActivityIndicator } from "react-native"
|
||||
import Animated, {
|
||||
cancelAnimation,
|
||||
interpolateColor,
|
||||
@@ -13,6 +12,7 @@ import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
import { accentColor } from "@/src/theme/colors"
|
||||
|
||||
import { PlatformActivityIndicator } from "../ui/loading/PlatformActivityIndicator"
|
||||
import { ReAnimatedPressable } from "./AnimatedComponents"
|
||||
|
||||
export function SubmitButton({
|
||||
@@ -43,10 +43,13 @@ export function SubmitButton({
|
||||
{...props}
|
||||
disabled={disabled}
|
||||
style={[buttonStyle, props.style]}
|
||||
className={cn("h-[48] flex-row items-center justify-center rounded-2xl", props.className)}
|
||||
className={cn(
|
||||
"flex h-[48] flex-row items-center justify-center rounded-2xl",
|
||||
props.className,
|
||||
)}
|
||||
>
|
||||
{isLoading ? (
|
||||
<ActivityIndicator className="text-white" />
|
||||
<PlatformActivityIndicator color="white" />
|
||||
) : (
|
||||
<Animated.Text className="text-center text-xl font-semibold" style={textStyle}>
|
||||
{title}
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
import { StackScreenHeaderPortal } from "@/src/lib/navigation/StackScreenHeaderPortal"
|
||||
import { useColor } from "@/src/theme/colors"
|
||||
|
||||
import { RotateableLoading } from "../../common/RotateableLoading"
|
||||
import { PlatformActivityIndicator } from "../../ui/loading/PlatformActivityIndicator"
|
||||
import { UINavigationHeaderActionButton } from "./NavigationHeader"
|
||||
|
||||
const HeaderCloseButton = () => {
|
||||
@@ -61,7 +61,7 @@ export const HeaderSubmitButton = ({
|
||||
return (
|
||||
<UINavigationHeaderActionButton onPress={onPress} disabled={!isValid || isLoading}>
|
||||
{isLoading ? (
|
||||
<RotateableLoading size={20} color={withOpacity(label, 0.5)} />
|
||||
<PlatformActivityIndicator size="small" color={withOpacity(label, 0.5)} />
|
||||
) : (
|
||||
<CheckLineIcon height={20} width={20} color={isValid ? label : withOpacity(label, 0.5)} />
|
||||
)}
|
||||
@@ -82,7 +82,7 @@ export const HeaderSubmitTextButton = ({
|
||||
<UINavigationHeaderActionButton onPress={onPress} disabled={!isValid || isLoading}>
|
||||
{isLoading && (
|
||||
<View className="absolute inset-y-0 right-2 items-center justify-center">
|
||||
<RotateableLoading size={20} color={withOpacity(labelColor, 0.5)} />
|
||||
<PlatformActivityIndicator size="small" color={withOpacity(labelColor, 0.5)} />
|
||||
</View>
|
||||
)}
|
||||
<Text
|
||||
|
||||
@@ -5,12 +5,13 @@ import { useAtom } from "jotai"
|
||||
import * as React from "react"
|
||||
import { useEffect } from "react"
|
||||
import type { ViewProps } from "react-native"
|
||||
import { ActivityIndicator, TouchableOpacity, View } from "react-native"
|
||||
import { TouchableOpacity, View } from "react-native"
|
||||
|
||||
import { useUISettingKey } from "@/src/atoms/settings/ui"
|
||||
import { BugCuteReIcon } from "@/src/icons/bug_cute_re"
|
||||
import type { EntryModel, EntryWithTranslation } from "@/src/store/entry/types"
|
||||
|
||||
import { PlatformActivityIndicator } from "../../ui/loading/PlatformActivityIndicator"
|
||||
import { sharedWebViewHeightAtom } from "./atom"
|
||||
import { htmlUrl } from "./constants"
|
||||
import { prepareEntryRenderWebView, SharedWebViewModule } from "./index"
|
||||
@@ -119,7 +120,7 @@ export function EntryContentWebView(props: EntryContentWebViewProps) {
|
||||
<Portal>
|
||||
{(showReadability ? !entry.readabilityContent : !entry.content) && (
|
||||
<View className="absolute inset-0 items-center justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)}
|
||||
</Portal>
|
||||
|
||||
@@ -3,13 +3,14 @@ import type { FC, PropsWithChildren } from "react"
|
||||
import * as React from "react"
|
||||
import { Fragment } from "react"
|
||||
import type { PressableProps, ViewProps } from "react-native"
|
||||
import { ActivityIndicator, Pressable, StyleSheet, Text, View } from "react-native"
|
||||
import { Pressable, StyleSheet, Text, View } from "react-native"
|
||||
import Animated, { FadeIn, FadeOut } from "react-native-reanimated"
|
||||
|
||||
import { CheckFilledIcon } from "@/src/icons/check_filled"
|
||||
import { MingcuteRightLine } from "@/src/icons/mingcute_right_line"
|
||||
import { accentColor, useColor } from "@/src/theme/colors"
|
||||
|
||||
import { PlatformActivityIndicator } from "../loading/PlatformActivityIndicator"
|
||||
import {
|
||||
GROUPED_ICON_TEXT_GAP,
|
||||
GROUPED_LIST_ITEM_PADDING,
|
||||
@@ -344,7 +345,7 @@ export const GroupedPlainButtonCell: FC<
|
||||
export const GroupedInsetActivityIndicatorCell: FC = () => {
|
||||
return (
|
||||
<GroupedInsetListBaseCell className="flex-1 items-center justify-center py-4">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</GroupedInsetListBaseCell>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { FC } from "react"
|
||||
import type { ActivityIndicatorProps } from "react-native"
|
||||
import { ActivityIndicator, Platform } from "react-native"
|
||||
|
||||
import { RotateableLoading } from "../../common/RotateableLoading"
|
||||
|
||||
export const PlatformActivityIndicator: FC<
|
||||
Omit<ActivityIndicatorProps, "color"> & {
|
||||
color?: string
|
||||
}
|
||||
> = (props) => {
|
||||
return Platform.OS === "ios" ? (
|
||||
<ActivityIndicator {...props} />
|
||||
) : (
|
||||
<RotateableLoading color={props.color} size={props.size === "small" ? 20 : 36} />
|
||||
)
|
||||
}
|
||||
@@ -1,18 +1,12 @@
|
||||
import { BlurView } from "expo-blur"
|
||||
import type { FC } from "react"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Platform,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from "react-native"
|
||||
import { Platform, Pressable, StyleSheet, TouchableOpacity, View } from "react-native"
|
||||
import RootSiblings from "react-native-root-siblings"
|
||||
|
||||
import { FullWindowOverlay } from "../components/common/FullWindowOverlay"
|
||||
import { RotateableLoading } from "../components/common/RotateableLoading"
|
||||
import { PlatformActivityIndicator } from "../components/ui/loading/PlatformActivityIndicator"
|
||||
import { CloseCuteReIcon } from "../icons/close_cute_re"
|
||||
|
||||
class LoadingStatic {
|
||||
@@ -60,7 +54,7 @@ const LoadingContainer: FC<{
|
||||
<View className="border-non-opaque-separator relative overflow-hidden rounded-2xl border p-12">
|
||||
<BlurView style={StyleSheet.absoluteFillObject} tint="systemChromeMaterialDark" />
|
||||
{Platform.OS === "ios" ? (
|
||||
<ActivityIndicator size={"large"} color="white" />
|
||||
<PlatformActivityIndicator size={"large"} color="white" />
|
||||
) : (
|
||||
<RotateableLoading />
|
||||
)}
|
||||
|
||||
@@ -8,14 +8,7 @@ import type { FC } from "react"
|
||||
import { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import type { ScrollView } from "react-native"
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Animated,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
useWindowDimensions,
|
||||
View,
|
||||
} from "react-native"
|
||||
import { Animated, Text, TouchableOpacity, useWindowDimensions, View } from "react-native"
|
||||
import type { PanGestureHandlerGestureEvent } from "react-native-gesture-handler"
|
||||
import { PanGestureHandler } from "react-native-gesture-handler"
|
||||
|
||||
@@ -24,6 +17,7 @@ import {
|
||||
useBottomTabBarHeight,
|
||||
useRegisterNavigationScrollView,
|
||||
} from "@/src/components/layouts/tabbar/hooks"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import type { TabComponent } from "@/src/components/ui/tabview/TabView"
|
||||
import { apiClient } from "@/src/lib/api-fetch"
|
||||
|
||||
@@ -202,7 +196,7 @@ const Tab: TabComponent = ({ tab, isSelected, ...rest }) => {
|
||||
}, [animatedY, isSelected])
|
||||
|
||||
if (isLoading) {
|
||||
return <ActivityIndicator className="flex-1 items-center justify-center" />
|
||||
return <PlatformActivityIndicator className="flex-1 items-center justify-center" />
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { withOpacity } from "@follow/utils"
|
||||
import { useMemo } from "react"
|
||||
import { ActivityIndicator, Text, View } from "react-native"
|
||||
import { Text, View } from "react-native"
|
||||
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { SadCuteReIcon } from "@/src/icons/sad_cute_re"
|
||||
import { useColor } from "@/src/theme/colors"
|
||||
|
||||
@@ -15,7 +16,7 @@ export const useDataSkeleton = (isLoading: boolean, data: any) => {
|
||||
<BaseSearchPageRootView className="items-center justify-center">
|
||||
<View className="-mt-72" />
|
||||
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</BaseSearchPageRootView>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ import { useTypeScriptHappyCallback } from "@follow/hooks"
|
||||
import type { MasonryFlashListProps } from "@shopify/flash-list"
|
||||
import type { ElementRef } from "react"
|
||||
import { forwardRef } from "react"
|
||||
import { ActivityIndicator, View } from "react-native"
|
||||
import { View } from "react-native"
|
||||
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { useFetchEntriesControls } from "@/src/modules/screen/atoms"
|
||||
|
||||
import { TimelineSelectorMasonryList } from "../screen/TimelineSelectorList"
|
||||
@@ -41,7 +42,7 @@ export const EntryListContentPicture = forwardRef<
|
||||
ListFooterComponent={
|
||||
hasNextPage ? (
|
||||
<View className="h-20 items-center justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
) : null
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FeedViewType } from "@follow/constants"
|
||||
import { tracker } from "@follow/tracker"
|
||||
import { cn, formatEstimatedMins, formatTimeToSeconds } from "@follow/utils"
|
||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||
import { ActivityIndicator, StyleSheet, Text, TouchableOpacity, View } from "react-native"
|
||||
import { StyleSheet, Text, TouchableOpacity, View } from "react-native"
|
||||
import ReAnimated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated"
|
||||
|
||||
import { useUISettingKey } from "@/src/atoms/settings/ui"
|
||||
@@ -11,6 +11,7 @@ import { preloadWebViewEntry } from "@/src/components/native/webview/EntryConten
|
||||
import { RelativeDateTime } from "@/src/components/ui/datetime/RelativeDateTime"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
import { Image } from "@/src/components/ui/image/Image"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { ItemPressableStyle } from "@/src/components/ui/pressable/enum"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable"
|
||||
import { gentleSpringPreset } from "@/src/constants/spring"
|
||||
@@ -190,7 +191,7 @@ export function EntryNormalItem({ entryId, extraData }: { entryId: string; extra
|
||||
{isPlaying ? (
|
||||
<PauseCuteFiIcon color="white" width={24} height={24} />
|
||||
) : isLoading ? (
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
) : (
|
||||
<PlayCuteFiIcon color="white" width={24} height={24} />
|
||||
)}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { cn } from "@follow/utils"
|
||||
import type { FC } from "react"
|
||||
import { createContext, memo, useContext, useState } from "react"
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Animated,
|
||||
Easing,
|
||||
ScrollView,
|
||||
@@ -19,6 +18,7 @@ import { BottomTabBarHeightContext } from "@/src/components/layouts/tabbar/conte
|
||||
import { NavigationHeaderHeightContext } from "@/src/components/layouts/views/NavigationHeaderContext"
|
||||
import { AccordionItem } from "@/src/components/ui/accordion/AccordionItem"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable"
|
||||
import { MingcuteRightLine } from "@/src/icons/mingcute_right_line"
|
||||
import { useNavigation } from "@/src/lib/navigation/hooks"
|
||||
@@ -220,7 +220,7 @@ const SubscriptionItem = memo(({ id, className }: { id: string; className?: stri
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FeedViewType } from "@follow/constants"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useEffect, useState } from "react"
|
||||
import { Controller, useForm } from "react-hook-form"
|
||||
import { ActivityIndicator, Text, View } from "react-native"
|
||||
import { Text, View } from "react-native"
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
||||
import { z } from "zod"
|
||||
|
||||
@@ -17,6 +17,7 @@ import { FormSwitch } from "@/src/components/ui/form/Switch"
|
||||
import { TextField } from "@/src/components/ui/form/TextField"
|
||||
import { GroupedInsetListCard } from "@/src/components/ui/grouped/GroupedList"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { useCanDismiss, useNavigation } from "@/src/lib/navigation/hooks"
|
||||
import { useSetModalScreenOptions } from "@/src/lib/navigation/ScreenOptionsContext"
|
||||
import { FeedViewSelector } from "@/src/modules/feed/view-selector"
|
||||
@@ -40,7 +41,7 @@ export function FollowFeed(props: { id: string }) {
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -56,7 +57,7 @@ export function FollowUrl(props: { url: string }) {
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { useEffect } from "react"
|
||||
import { Controller, useForm } from "react-hook-form"
|
||||
import { ActivityIndicator, Alert, StyleSheet, Text, View } from "react-native"
|
||||
import { Alert, StyleSheet, Text, View } from "react-native"
|
||||
import { z } from "zod"
|
||||
|
||||
import { HeaderSubmitTextButton } from "@/src/components/layouts/header/HeaderElements"
|
||||
@@ -17,6 +17,7 @@ import { FormSwitch } from "@/src/components/ui/form/Switch"
|
||||
import { TextField } from "@/src/components/ui/form/TextField"
|
||||
import { GroupedInsetListCard } from "@/src/components/ui/grouped/GroupedList"
|
||||
import { IconWithFallback } from "@/src/components/ui/icon/fallback-icon"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { PowerIcon } from "@/src/icons/power"
|
||||
import { apiClient } from "@/src/lib/api-fetch"
|
||||
import { useNavigation, useScreenIsInSheetModal } from "@/src/lib/navigation/hooks"
|
||||
@@ -41,7 +42,7 @@ export const FollowList = (props: { id: string }) => {
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import type { PropsWithChildren } from "react"
|
||||
import { ActivityIndicator, Pressable, Text, TouchableOpacity, View } from "react-native"
|
||||
import { Pressable, Text, TouchableOpacity, View } from "react-native"
|
||||
import { ScrollView } from "react-native-gesture-handler"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
import { UserAvatar } from "@/src/components/ui/avatar/UserAvatar"
|
||||
import { GroupedInsetListNavigationLinkIcon } from "@/src/components/ui/grouped/GroupedList"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { DocmentCuteReIcon } from "@/src/icons/docment_cute_re"
|
||||
import { FileImportCuteReIcon } from "@/src/icons/file_import_cute_re"
|
||||
import { ListCheck2CuteReIcon } from "@/src/icons/list_check_2_cute_re"
|
||||
@@ -110,7 +111,7 @@ export const EditProfileSection = () => {
|
||||
if (!whoami) {
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as FileSystem from "expo-file-system"
|
||||
import type { FC } from "react"
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { ActivityIndicator, Alert, Text, View } from "react-native"
|
||||
import { Alert, Text, View } from "react-native"
|
||||
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
GroupedInsetListSectionHeader,
|
||||
GroupedPlainButtonCell,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { getDbPath } from "@/src/database"
|
||||
import { AppleCuteFiIcon } from "@/src/icons/apple_cute_fi"
|
||||
import { GithubCuteFiIcon } from "@/src/icons/github_cute_fi"
|
||||
@@ -225,7 +226,7 @@ const AuthenticationSection = () => {
|
||||
))
|
||||
) : isLoading ? (
|
||||
<View className="flex h-12 flex-1 items-center justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
) : null}
|
||||
</GroupedInsetListCard>
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { withOpacity } from "@follow/utils"
|
||||
import { useCallback } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import type { ListRenderItem } from "react-native"
|
||||
import { ActivityIndicator, Text, View } from "react-native"
|
||||
import { Text, View } from "react-native"
|
||||
import Animated, { LinearTransition } from "react-native-reanimated"
|
||||
import { useColor, useColors } from "react-native-uikit-colors"
|
||||
import { useColors } from "react-native-uikit-colors"
|
||||
|
||||
import { RotateableLoading } from "@/src/components/common/RotateableLoading"
|
||||
import { SwipeableGroupProvider, SwipeableItem } from "@/src/components/common/SwipeableItem"
|
||||
import { UINavigationHeaderActionButton } from "@/src/components/layouts/header/NavigationHeader"
|
||||
import { HeaderSubmitTextButton } from "@/src/components/layouts/header/HeaderElements"
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
@@ -18,9 +16,9 @@ import {
|
||||
GroupedInsetListCard,
|
||||
GroupedPlainButtonCell,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable"
|
||||
import { Switch } from "@/src/components/ui/switch/Switch"
|
||||
import { CheckLineIcon } from "@/src/icons/check_line"
|
||||
import { Magic2CuteFiIcon } from "@/src/icons/magic_2_cute_fi"
|
||||
import { useNavigation } from "@/src/lib/navigation/hooks"
|
||||
import {
|
||||
@@ -79,7 +77,7 @@ export const ActionsScreen = () => {
|
||||
</SwipeableGroupProvider>
|
||||
) : isLoading && rules.length === 0 ? (
|
||||
<View className="my-4">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
) : null}
|
||||
</GroupedInsetListCard>
|
||||
@@ -105,15 +103,14 @@ const NewRuleButton = () => {
|
||||
|
||||
const SaveRuleButton = ({ disabled }: { disabled?: boolean }) => {
|
||||
const { mutate, isPending } = useUpdateActionsMutation()
|
||||
const label = useColor("label")
|
||||
|
||||
return (
|
||||
<UINavigationHeaderActionButton onPress={mutate} disabled={disabled || isPending}>
|
||||
{isPending ? (
|
||||
<RotateableLoading size={20} color={withOpacity(label, 0.5)} />
|
||||
) : (
|
||||
<CheckLineIcon height={20} width={20} color={disabled ? withOpacity(label, 0.5) : label} />
|
||||
)}
|
||||
</UINavigationHeaderActionButton>
|
||||
<HeaderSubmitTextButton
|
||||
label="Save"
|
||||
isValid={!disabled}
|
||||
onPress={mutate}
|
||||
isLoading={isPending}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -159,7 +156,7 @@ const ListItemCellImpl: ListRenderItem<ActionRule> = ({ item: rule }) => {
|
||||
]}
|
||||
>
|
||||
<ItemPressable
|
||||
className="flex-row justify-between p-4"
|
||||
className="flex flex-row justify-between p-4"
|
||||
onPress={() => navigation.pushControllerView(EditRuleScreen, { index: rule.index })}
|
||||
>
|
||||
<Text className="text-label text-base">{rule.name}</Text>
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import type { FC } from "react"
|
||||
import { useState } from "react"
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
TouchableWithoutFeedback,
|
||||
View,
|
||||
} from "react-native"
|
||||
import { Text, TouchableOpacity, TouchableWithoutFeedback, View } from "react-native"
|
||||
import { KeyboardController } from "react-native-keyboard-controller"
|
||||
|
||||
import { HeaderSubmitTextButton } from "@/src/components/layouts/header/HeaderElements"
|
||||
@@ -23,6 +17,7 @@ import {
|
||||
GroupedInsetListNavigationLink,
|
||||
GroupedOutlineDescription,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { CheckCircleCuteReIcon } from "@/src/icons/check_circle_cute_re"
|
||||
import { CloseCircleFillIcon } from "@/src/icons/close_circle_fill"
|
||||
import { useNavigation } from "@/src/lib/navigation/hooks"
|
||||
@@ -42,7 +37,7 @@ export const EditProfileScreen = () => {
|
||||
if (!whoami) {
|
||||
return (
|
||||
<View className="flex-1 items-center justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createContext, createElement, useCallback, useContext, useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import type { ListRenderItem } from "react-native"
|
||||
import { ActivityIndicator, Image, StyleSheet, Text, View } from "react-native"
|
||||
import { Image, StyleSheet, Text, View } from "react-native"
|
||||
import Animated, { LinearTransition } from "react-native-reanimated"
|
||||
import { useColor, useColors } from "react-native-uikit-colors"
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
GroupedInsetListCard,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable"
|
||||
import { views } from "@/src/constants/views"
|
||||
import { AddCuteReIcon } from "@/src/icons/add_cute_re"
|
||||
@@ -90,7 +91,7 @@ export const ListsScreen = () => {
|
||||
)}
|
||||
{isLoading && lists.length === 0 && (
|
||||
<View className="mt-1">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)}
|
||||
</GroupedInsetListCard>
|
||||
|
||||
@@ -2,7 +2,6 @@ import { useMutation } from "@tanstack/react-query"
|
||||
import { useCallback, useState } from "react"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
import { RotateableLoading } from "@/src/components/common/RotateableLoading"
|
||||
import {
|
||||
NavigationBlurEffectHeader,
|
||||
SafeNavigationScrollView,
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListSectionHeader,
|
||||
} from "@/src/components/ui/grouped/GroupedList"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { CheckLineIcon } from "@/src/icons/check_line"
|
||||
import { changePassword } from "@/src/lib/auth"
|
||||
|
||||
@@ -48,7 +48,7 @@ export const ResetPassword = () => {
|
||||
label="Save"
|
||||
normalIcon={
|
||||
isPending ? (
|
||||
<RotateableLoading color={labelColor} />
|
||||
<PlatformActivityIndicator size="small" color={labelColor} />
|
||||
) : (
|
||||
<CheckLineIcon height={18} width={18} color={labelColor} />
|
||||
)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { cn } from "@follow/utils"
|
||||
import { memo, useContext } from "react"
|
||||
import { ActivityIndicator, Text, View } from "react-native"
|
||||
import { Text, View } from "react-native"
|
||||
import Animated, { FadeOutUp } from "react-native-reanimated"
|
||||
|
||||
import { GROUPED_ICON_TEXT_GAP, GROUPED_LIST_MARGIN } from "@/src/components/ui/grouped/constants"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { ItemPressableStyle } from "@/src/components/ui/pressable/enum"
|
||||
import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable"
|
||||
import { useNavigation } from "@/src/lib/navigation/hooks"
|
||||
@@ -40,7 +41,7 @@ export const SubscriptionItem = memo(
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View className="mt-24 flex-1 flex-row items-start justify-center">
|
||||
<ActivityIndicator />
|
||||
<PlatformActivityIndicator />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { requireNativeView } from "expo"
|
||||
import { useEffect, useMemo } from "react"
|
||||
import { ActivityIndicator, View } from "react-native"
|
||||
import { View } from "react-native"
|
||||
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import type { apiClient } from "@/src/lib/api-fetch"
|
||||
import type { NavigationControllerView } from "@/src/lib/navigation/types"
|
||||
import { toast } from "@/src/lib/toast"
|
||||
@@ -42,7 +43,7 @@ function ProfileScreenImpl(props: { userId: string }) {
|
||||
|
||||
return (
|
||||
<View className="bg-system-grouped-background flex-1">
|
||||
{isLoading && <ActivityIndicator className="mt-24" size={28} />}
|
||||
{isLoading && <PlatformActivityIndicator className="mt-24" size={28} />}
|
||||
{!isLoading && subscriptions && <SubscriptionList subscriptions={subscriptions.data} />}
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { Fragment, useCallback, useEffect, useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import {
|
||||
ActivityIndicator,
|
||||
FlatList,
|
||||
Image,
|
||||
Share,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from "react-native"
|
||||
import { FlatList, Image, Share, Text, TouchableOpacity, View } from "react-native"
|
||||
import Animated, {
|
||||
interpolate,
|
||||
useAnimatedScrollHandler,
|
||||
@@ -37,6 +29,7 @@ import {
|
||||
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
|
||||
import type { FeedIconRequiredFeed } from "@/src/components/ui/icon/feed-icon"
|
||||
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
|
||||
import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator"
|
||||
import { Share3CuteReIcon } from "@/src/icons/share_3_cute_re"
|
||||
import type { apiClient } from "@/src/lib/api-fetch"
|
||||
import type { NavigationControllerView } from "@/src/lib/navigation/types"
|
||||
@@ -126,7 +119,7 @@ function ProfileScreenImpl(props: { userId: string }) {
|
||||
>
|
||||
<UserHeaderBanner scrollY={scrollY} userId={props.userId} />
|
||||
|
||||
{isLoading && <ActivityIndicator className="mt-24" size={28} />}
|
||||
{isLoading && <PlatformActivityIndicator className="mt-24" size={28} />}
|
||||
{!isLoading && subscriptions && <SubscriptionList subscriptions={subscriptions.data} />}
|
||||
</ReAnimatedScrollView>
|
||||
|
||||
@@ -134,7 +127,7 @@ function ProfileScreenImpl(props: { userId: string }) {
|
||||
style={useAnimatedStyle(() => ({
|
||||
opacity: interpolate(headerOpacity.value, [0, 1], [1, 0]),
|
||||
}))}
|
||||
className="absolute top-5 w-full flex-row items-center justify-between px-4"
|
||||
className="absolute top-5 flex w-full flex-row items-center justify-between px-4"
|
||||
>
|
||||
<View />
|
||||
<TouchableOpacity onPress={openShareUrl}>
|
||||
@@ -255,7 +248,7 @@ const SubscriptionList = ({ subscriptions }: { subscriptions: Subscription[] })
|
||||
}
|
||||
const renderListItems = ({ item }: { item: PickedListModel }) => (
|
||||
<View
|
||||
className="bg-secondary-system-grouped-background h-12 flex-row items-center"
|
||||
className="bg-secondary-system-grouped-background flex h-12 flex-row items-center"
|
||||
style={{ paddingHorizontal: GROUPED_LIST_ITEM_PADDING }}
|
||||
>
|
||||
<View className="overflow-hidden rounded">
|
||||
@@ -273,7 +266,7 @@ const renderListItems = ({ item }: { item: PickedListModel }) => (
|
||||
|
||||
const renderFeedItems = ({ item }: { item: PickedFeedModel }) => (
|
||||
<View
|
||||
className="bg-secondary-system-grouped-background h-12 flex-row items-center"
|
||||
className="bg-secondary-system-grouped-background flex h-12 flex-row items-center"
|
||||
style={{ paddingHorizontal: GROUPED_LIST_ITEM_PADDING }}
|
||||
>
|
||||
<View className="overflow-hidden rounded">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Alert, View } from "react-native"
|
||||
import { ActivityIndicator, Alert, View } from "react-native"
|
||||
|
||||
import { RotateableLoading } from "./components/common/RotateableLoading"
|
||||
import { Navigation } from "./lib/navigation/Navigation"
|
||||
import { NavigationSitemapRegistry } from "./lib/navigation/sitemap/registry"
|
||||
import type { NavigationControllerView } from "./lib/navigation/types"
|
||||
@@ -42,6 +43,7 @@ export function registerSitemap() {
|
||||
return Promise.resolve()
|
||||
},
|
||||
}),
|
||||
LoadingComponentDemo,
|
||||
].forEach((Component) => {
|
||||
NavigationSitemapRegistry.registerByComponent(Component, void 0, {
|
||||
stackPresentation: "push",
|
||||
@@ -61,3 +63,24 @@ function screenHoC<P extends object>(Component: React.ComponentType<P>, props: P
|
||||
Wrapper.displayName = `ScreenHoC(${Component.name})`
|
||||
return Wrapper
|
||||
}
|
||||
|
||||
const LoadingComponentDemo = () => {
|
||||
return (
|
||||
<View className="flex flex-1 items-center justify-center">
|
||||
<View className="flex flex-row gap-2">
|
||||
<ActivityIndicator size={"small"} />
|
||||
<RotateableLoading size={20} />
|
||||
</View>
|
||||
|
||||
<View className="flex flex-row gap-2">
|
||||
<ActivityIndicator size={"small"} color="red" />
|
||||
<RotateableLoading size={20} color="red" />
|
||||
</View>
|
||||
|
||||
<View className="flex flex-row gap-2">
|
||||
<ActivityIndicator size={"large"} color="red" />
|
||||
<RotateableLoading size={36} color="red" />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user