Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor minimal shell mode to refcounting (#10319)

authored by

Samuel Newman and committed by
GitHub
3153ea43 6d53459e

+152 -393
+13 -2
src/components/Layout/index.tsx
··· 1 1 import {forwardRef, memo, useContext, useMemo} from 'react' 2 - import {StyleSheet, View, type ViewProps, type ViewStyle} from 'react-native' 3 - import {type StyleProp} from 'react-native' 2 + import { 3 + type StyleProp, 4 + StyleSheet, 5 + View, 6 + type ViewProps, 7 + type ViewStyle, 8 + } from 'react-native' 4 9 import { 5 10 KeyboardAwareScrollView, 6 11 type KeyboardAwareScrollViewProps, ··· 11 16 } from 'react-native-reanimated' 12 17 import {useSafeAreaInsets} from 'react-native-safe-area-context' 13 18 19 + import {useEnableMinimalShellModeForScreen} from '#/state/shell' 14 20 import {useShellLayout} from '#/state/shell/shell-layout' 15 21 import { 16 22 atoms as a, ··· 30 36 export type ScreenProps = React.ComponentProps<typeof View> & { 31 37 style?: StyleProp<ViewStyle> 32 38 noInsetTop?: boolean 39 + minimalShell?: boolean 33 40 } 34 41 35 42 /** ··· 38 45 export const Screen = memo(function Screen({ 39 46 style, 40 47 noInsetTop, 48 + minimalShell = false, 41 49 ...props 42 50 }: ScreenProps) { 43 51 const {top} = useSafeAreaInsets() 52 + 53 + useEnableMinimalShellModeForScreen({enabled: minimalShell}) 54 + 44 55 return ( 45 56 <> 46 57 {IS_WEB && <WebCenterBorders />}
+1 -4
src/screens/Bookmarks/index.tsx
··· 23 23 } from '#/lib/routes/types' 24 24 import {useBookmarkMutation} from '#/state/queries/bookmarks/useBookmarkMutation' 25 25 import {useBookmarksQuery} from '#/state/queries/bookmarks/useBookmarksQuery' 26 - import {useSetMinimalShellMode} from '#/state/shell' 27 26 import {Post} from '#/view/com/post/Post' 28 27 import {EmptyState} from '#/view/com/util/EmptyState' 29 28 import {List} from '#/view/com/util/List' ··· 43 42 type Props = NativeStackScreenProps<CommonNavigatorParams, 'Bookmarks'> 44 43 45 44 export function BookmarksScreen({}: Props) { 46 - const setMinimalShellMode = useSetMinimalShellMode() 47 45 const ax = useAnalytics() 48 46 49 47 useFocusEffect( 50 48 useCallback(() => { 51 - setMinimalShellMode(false) 52 49 ax.metric('bookmarks:view', {}) 53 - }, [setMinimalShellMode, ax]), 50 + }, [ax]), 54 51 ) 55 52 56 53 return (
+3 -8
src/screens/FindContactsFlowScreen.tsx
··· 1 - import {useCallback, useLayoutEffect, useState} from 'react' 1 + import {useState} from 'react' 2 2 import {LayoutAnimationConfig} from 'react-native-reanimated' 3 3 import {msg} from '@lingui/core/macro' 4 4 import {useLingui} from '@lingui/react' ··· 8 8 type AllNavigatorParams, 9 9 type NativeStackScreenProps, 10 10 } from '#/lib/routes/types' 11 - import {useSetMinimalShellMode} from '#/state/shell' 11 + import {useEnableMinimalShellMode} from '#/state/shell' 12 12 import {ErrorScreen} from '#/view/com/util/error/ErrorScreen' 13 13 import {FindContactsFlow} from '#/components/contacts/FindContactsFlow' 14 14 import {useFindContactsFlowState} from '#/components/contacts/state' ··· 36 36 }) 37 37 }) 38 38 39 - const setMinimalShellMode = useSetMinimalShellMode() 40 - const effect = useCallback(() => { 41 - setMinimalShellMode(true) 42 - return () => setMinimalShellMode(false) 43 - }, [setMinimalShellMode]) 44 - useLayoutEffect(effect) 39 + useEnableMinimalShellMode() 45 40 46 41 return ( 47 42 <Layout.Screen>
+3 -16
src/screens/Hashtag.tsx
··· 4 4 import {msg} from '@lingui/core/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 import {Trans} from '@lingui/react/macro' 7 - import {useFocusEffect} from '@react-navigation/native' 8 7 import {type NativeStackScreenProps} from '@react-navigation/native-stack' 9 8 10 9 import {HITSLOP_10} from '#/lib/constants' ··· 17 16 import {enforceLen} from '#/lib/strings/helpers' 18 17 import {useSearchPostsQuery} from '#/state/queries/search-posts' 19 18 import {useSession} from '#/state/session' 20 - import {useSetMinimalShellMode} from '#/state/shell' 21 19 import {useLoggedOutViewControls} from '#/state/shell/logged-out' 22 20 import {useCloseAllActiveElements} from '#/state/util' 23 21 import {Pager} from '#/view/com/pager/Pager' ··· 79 77 }, [tag, author]) 80 78 81 79 const [activeTab, setActiveTab] = useState(0) 82 - const setMinimalShellMode = useSetMinimalShellMode() 83 80 84 - useFocusEffect( 85 - useCallback(() => { 86 - setMinimalShellMode(false) 87 - }, [setMinimalShellMode]), 88 - ) 89 - 90 - const onPageSelected = useCallback( 91 - (index: number) => { 92 - setMinimalShellMode(false) 93 - setActiveTab(index) 94 - }, 95 - [setMinimalShellMode], 96 - ) 81 + const onPageSelected = (index: number) => { 82 + setActiveTab(index) 83 + } 97 84 98 85 const sections = useMemo(() => { 99 86 return [
+2 -10
src/screens/Log.tsx
··· 1 - import {useCallback, useState} from 'react' 1 + import {useState} from 'react' 2 2 import {LayoutAnimation, Pressable, View} from 'react-native' 3 3 import {msg} from '@lingui/core/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 import {Trans} from '@lingui/react/macro' 6 - import {useFocusEffect} from '@react-navigation/native' 7 6 8 7 import {useGetTimeAgo} from '#/lib/hooks/useTimeAgo' 9 8 import { ··· 11 10 type NativeStackScreenProps, 12 11 } from '#/lib/routes/types' 13 12 import {getEntries} from '#/logger/logDump' 14 - import {useSetMinimalShellMode, useTickEveryMinute} from '#/state/shell' 13 + import {useTickEveryMinute} from '#/state/shell' 15 14 import {atoms as a, useTheme} from '#/alf' 16 15 import { 17 16 ChevronBottom_Stroke2_Corner0_Rounded as ChevronBottomIcon, ··· 28 27 >) { 29 28 const t = useTheme() 30 29 const {_} = useLingui() 31 - const setMinimalShellMode = useSetMinimalShellMode() 32 30 const [expanded, setExpanded] = useState<string[]>([]) 33 31 const timeAgo = useGetTimeAgo() 34 32 const tick = useTickEveryMinute() 35 - 36 - useFocusEffect( 37 - useCallback(() => { 38 - setMinimalShellMode(false) 39 - }, [setMinimalShellMode]), 40 - ) 41 33 42 34 const toggler = (id: string) => () => { 43 35 LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
+2 -6
src/screens/Messages/Conversation.tsx
··· 30 30 import {useModerationOpts} from '#/state/preferences/moderation-opts' 31 31 import {useConvoQuery} from '#/state/queries/messages/conversation' 32 32 import {useSession} from '#/state/session' 33 - import {useSetMinimalShellMode} from '#/state/shell' 34 33 import {MessagesList} from '#/screens/Messages/components/MessagesList' 35 34 import {atoms as a, useTheme, web} from '#/alf' 36 35 import {AgeRestrictedScreen} from '#/components/ageAssurance/AgeRestrictedScreen' ··· 70 69 } 71 70 72 71 export function MessagesConversationScreenInner({route}: Props) { 73 - const setMinimalShellMode = useSetMinimalShellMode() 74 - 75 72 const convoId = route.params.conversation 76 73 const {setCurrentConvoId} = useCurrentConvoId() 77 74 78 75 useFocusEffect( 79 76 useCallback(() => { 80 77 setCurrentConvoId(convoId) 81 - setMinimalShellMode(true) 82 78 83 79 return () => { 84 80 setCurrentConvoId(undefined) 85 - setMinimalShellMode(false) 86 81 } 87 - }, [convoId, setCurrentConvoId, setMinimalShellMode]), 82 + }, [convoId, setCurrentConvoId]), 88 83 ) 89 84 90 85 return ( 91 86 <Layout.Screen 87 + minimalShell 92 88 testID="convoScreen" 93 89 noInsetTop={IS_LIQUID_GLASS} 94 90 style={web([{minHeight: 0}, a.flex_1])}>
-9
src/screens/Moderation/index.tsx
··· 4 4 import {msg} from '@lingui/core/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 import {Trans} from '@lingui/react/macro' 7 - import {useFocusEffect} from '@react-navigation/native' 8 7 9 8 import {getLabelingServiceTitle, isAppLabeler} from '#/lib/moderation' 10 9 import { ··· 21 20 usePreferencesSetAdultContentMutation, 22 21 } from '#/state/queries/preferences' 23 22 import {isNonConfigurableModerationAuthority} from '#/state/session/additional-moderation-authorities' 24 - import {useSetMinimalShellMode} from '#/state/shell' 25 23 import {atoms as a, useBreakpoints, useTheme, type ViewStyleProp} from '#/alf' 26 24 import * as Admonition from '#/components/Admonition' 27 25 import {AgeAssuranceAdmonition} from '#/components/ageAssurance/AgeAssuranceAdmonition' ··· 161 159 }) { 162 160 const {_} = useLingui() 163 161 const t = useTheme() 164 - const setMinimalShellMode = useSetMinimalShellMode() 165 162 const {gtMobile} = useBreakpoints() 166 163 const {mutedWordsDialogControl} = useGlobalDialogsControlContext() 167 164 const { ··· 196 193 }) 197 194 } 198 195 } 199 - 200 - useFocusEffect( 201 - useCallback(() => { 202 - setMinimalShellMode(false) 203 - }, [setMinimalShellMode]), 204 - ) 205 196 206 197 const {mutateAsync: setAdultContentPref, variables: optimisticAdultContent} = 207 198 usePreferencesSetAdultContentMutation()
-10
src/screens/Post/PostLikedBy.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {Plural, Trans} from '@lingui/react/macro' 3 - import {useFocusEffect} from '@react-navigation/native' 4 2 5 3 import { 6 4 type CommonNavigatorParams, ··· 8 6 } from '#/lib/routes/types' 9 7 import {makeRecordUri} from '#/lib/strings/url-helpers' 10 8 import {usePostQuery} from '#/state/queries/post' 11 - import {useSetMinimalShellMode} from '#/state/shell' 12 9 import {PostLikedBy as PostLikedByComponent} from '#/view/com/post-thread/PostLikedBy' 13 10 import * as Layout from '#/components/Layout' 14 11 15 12 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostLikedBy'> 16 13 export const PostLikedByScreen = ({route}: Props) => { 17 - const setMinimalShellMode = useSetMinimalShellMode() 18 14 const {name, rkey} = route.params 19 15 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 20 16 const {data: post} = usePostQuery(uri) ··· 23 19 if (post) { 24 20 likeCount = post.likeCount 25 21 } 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 22 33 23 return ( 34 24 <Layout.Screen>
-10
src/screens/Post/PostQuotes.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {Plural, Trans} from '@lingui/react/macro' 3 - import {useFocusEffect} from '@react-navigation/native' 4 2 5 3 import { 6 4 type CommonNavigatorParams, ··· 8 6 } from '#/lib/routes/types' 9 7 import {makeRecordUri} from '#/lib/strings/url-helpers' 10 8 import {usePostQuery} from '#/state/queries/post' 11 - import {useSetMinimalShellMode} from '#/state/shell' 12 9 import {PostQuotes as PostQuotesComponent} from '#/view/com/post-thread/PostQuotes' 13 10 import * as Layout from '#/components/Layout' 14 11 15 12 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostQuotes'> 16 13 export const PostQuotesScreen = ({route}: Props) => { 17 - const setMinimalShellMode = useSetMinimalShellMode() 18 14 const {name, rkey} = route.params 19 15 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 20 16 const {data: post} = usePostQuery(uri) ··· 23 19 if (post) { 24 20 quoteCount = post.quoteCount 25 21 } 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 22 33 23 return ( 34 24 <Layout.Screen>
-10
src/screens/Post/PostRepostedBy.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {Plural, Trans} from '@lingui/react/macro' 3 - import {useFocusEffect} from '@react-navigation/native' 4 2 5 3 import { 6 4 type CommonNavigatorParams, ··· 8 6 } from '#/lib/routes/types' 9 7 import {makeRecordUri} from '#/lib/strings/url-helpers' 10 8 import {usePostQuery} from '#/state/queries/post' 11 - import {useSetMinimalShellMode} from '#/state/shell' 12 9 import {PostRepostedBy as PostRepostedByComponent} from '#/view/com/post-thread/PostRepostedBy' 13 10 import * as Layout from '#/components/Layout' 14 11 ··· 16 13 export const PostRepostedByScreen = ({route}: Props) => { 17 14 const {name, rkey} = route.params 18 15 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 19 - const setMinimalShellMode = useSetMinimalShellMode() 20 16 const {data: post} = usePostQuery(uri) 21 17 22 18 let quoteCount 23 19 if (post) { 24 20 quoteCount = post.repostCount 25 21 } 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 22 33 23 return ( 34 24 <Layout.Screen>
+5 -14
src/screens/Profile/KnownFollowers.tsx
··· 1 - import {useCallback, useMemo, useState} from 'react' 1 + import {useMemo, useState} from 'react' 2 2 import {type AppBskyActorDefs} from '@atproto/api' 3 3 import {msg} from '@lingui/core/macro' 4 4 import {useLingui} from '@lingui/react' 5 - import {useFocusEffect} from '@react-navigation/native' 6 5 7 6 import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' 8 7 import { ··· 13 12 import {logger} from '#/logger' 14 13 import {useProfileKnownFollowersQuery} from '#/state/queries/known-followers' 15 14 import {useResolveDidQuery} from '#/state/queries/resolve-uri' 16 - import {useSetMinimalShellMode} from '#/state/shell' 17 15 import {ProfileCardWithFollowBtn} from '#/view/com/profile/ProfileCard' 18 16 import {List} from '#/view/com/util/List' 19 17 import {ViewHeader} from '#/view/com/util/ViewHeader' ··· 46 44 > 47 45 export const ProfileKnownFollowersScreen = ({route}: Props) => { 48 46 const {_} = useLingui() 49 - const setMinimalShellMode = useSetMinimalShellMode() 50 47 const initialNumToRender = useInitialNumToRender() 51 48 52 49 const {name} = route.params ··· 67 64 refetch, 68 65 } = useProfileKnownFollowersQuery(resolvedDid) 69 66 70 - const onRefresh = useCallback(async () => { 67 + const onRefresh = async () => { 71 68 setIsPTRing(true) 72 69 try { 73 70 await refetch() ··· 75 72 logger.error('Failed to refresh followers', {message: err}) 76 73 } 77 74 setIsPTRing(false) 78 - }, [refetch, setIsPTRing]) 75 + } 79 76 80 - const onEndReached = useCallback(async () => { 77 + const onEndReached = async () => { 81 78 if (isFetchingNextPage || !hasNextPage || !!error) return 82 79 try { 83 80 await fetchNextPage() 84 81 } catch (err) { 85 82 logger.error('Failed to load more followers', {message: err}) 86 83 } 87 - }, [isFetchingNextPage, hasNextPage, error, fetchNextPage]) 84 + } 88 85 89 86 const followers = useMemo(() => { 90 87 if (data?.pages) { ··· 94 91 }, [data]) 95 92 96 93 const isError = Boolean(resolveError || error) 97 - 98 - useFocusEffect( 99 - useCallback(() => { 100 - setMinimalShellMode(false) 101 - }, [setMinimalShellMode]), 102 - ) 103 94 104 95 if (followers.length < 1) { 105 96 return (
-10
src/screens/Profile/ProfileFollowers.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {Plural} from '@lingui/react/macro' 3 - import {useFocusEffect} from '@react-navigation/native' 4 2 5 3 import { 6 4 type CommonNavigatorParams, ··· 9 7 import {sanitizeDisplayName} from '#/lib/strings/display-names' 10 8 import {useProfileQuery} from '#/state/queries/profile' 11 9 import {useResolveDidQuery} from '#/state/queries/resolve-uri' 12 - import {useSetMinimalShellMode} from '#/state/shell' 13 10 import {ProfileFollowers as ProfileFollowersComponent} from '#/view/com/profile/ProfileFollowers' 14 11 import * as Layout from '#/components/Layout' 15 12 16 13 type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileFollowers'> 17 14 export const ProfileFollowersScreen = ({route}: Props) => { 18 15 const {name} = route.params 19 - const setMinimalShellMode = useSetMinimalShellMode() 20 16 21 17 const {data: resolvedDid} = useResolveDidQuery(name) 22 18 const {data: profile} = useProfileQuery({ 23 19 did: resolvedDid, 24 20 }) 25 - 26 - useFocusEffect( 27 - useCallback(() => { 28 - setMinimalShellMode(false) 29 - }, [setMinimalShellMode]), 30 - ) 31 21 32 22 return ( 33 23 <Layout.Screen testID="profileFollowersScreen">
-10
src/screens/Profile/ProfileFollows.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {Plural} from '@lingui/react/macro' 3 - import {useFocusEffect} from '@react-navigation/native' 4 2 5 3 import { 6 4 type CommonNavigatorParams, ··· 9 7 import {sanitizeDisplayName} from '#/lib/strings/display-names' 10 8 import {useProfileQuery} from '#/state/queries/profile' 11 9 import {useResolveDidQuery} from '#/state/queries/resolve-uri' 12 - import {useSetMinimalShellMode} from '#/state/shell' 13 10 import {ProfileFollows as ProfileFollowsComponent} from '#/view/com/profile/ProfileFollows' 14 11 import * as Layout from '#/components/Layout' 15 12 16 13 type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileFollows'> 17 14 export const ProfileFollowsScreen = ({route}: Props) => { 18 15 const {name} = route.params 19 - const setMinimalShellMode = useSetMinimalShellMode() 20 16 21 17 const {data: resolvedDid} = useResolveDidQuery(name) 22 18 const {data: profile} = useProfileQuery({ 23 19 did: resolvedDid, 24 20 }) 25 - 26 - useFocusEffect( 27 - useCallback(() => { 28 - setMinimalShellMode(false) 29 - }, [setMinimalShellMode]), 30 - ) 31 21 32 22 return ( 33 23 <Layout.Screen testID="profileFollowsScreen">
-10
src/screens/Profile/ProfileLabelerLikedBy.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {msg} from '@lingui/core/macro' 3 2 import {useLingui} from '@lingui/react' 4 - import {useFocusEffect} from '@react-navigation/native' 5 3 6 4 import { 7 5 type CommonNavigatorParams, 8 6 type NativeStackScreenProps, 9 7 } from '#/lib/routes/types' 10 8 import {makeRecordUri} from '#/lib/strings/url-helpers' 11 - import {useSetMinimalShellMode} from '#/state/shell' 12 9 import {ViewHeader} from '#/view/com/util/ViewHeader' 13 10 import * as Layout from '#/components/Layout' 14 11 import {LikedByList} from '#/components/LikedByList' ··· 16 13 export function ProfileLabelerLikedByScreen({ 17 14 route, 18 15 }: NativeStackScreenProps<CommonNavigatorParams, 'ProfileLabelerLikedBy'>) { 19 - const setMinimalShellMode = useSetMinimalShellMode() 20 16 const {name: handleOrDid} = route.params 21 17 const uri = makeRecordUri(handleOrDid, 'app.bsky.labeler.service', 'self') 22 18 const {_} = useLingui() 23 - 24 - useFocusEffect( 25 - useCallback(() => { 26 - setMinimalShellMode(false) 27 - }, [setMinimalShellMode]), 28 - ) 29 19 30 20 return ( 31 21 <Layout.Screen>
+1 -9
src/screens/ProfileList/index.tsx
··· 10 10 import {msg} from '@lingui/core/macro' 11 11 import {useLingui} from '@lingui/react' 12 12 import {Trans} from '@lingui/react/macro' 13 - import {useFocusEffect, useIsFocused} from '@react-navigation/native' 13 + import {useIsFocused} from '@react-navigation/native' 14 14 import {useQueryClient} from '@tanstack/react-query' 15 15 16 16 import {useOpenComposer} from '#/lib/hooks/useOpenComposer' ··· 31 31 import {useResolveUriQuery} from '#/state/queries/resolve-uri' 32 32 import {truncateAndInvalidate} from '#/state/queries/util' 33 33 import {useSession} from '#/state/session' 34 - import {useSetMinimalShellMode} from '#/state/shell' 35 34 import {PagerWithHeader} from '#/view/com/pager/PagerWithHeader' 36 35 import {FAB} from '#/view/com/util/fab/FAB' 37 36 import {type ListRef} from '#/view/com/util/List' ··· 155 154 const {_} = useLingui() 156 155 const queryClient = useQueryClient() 157 156 const {openComposer} = useOpenComposer() 158 - const setMinimalShellMode = useSetMinimalShellMode() 159 157 const {currentAccount} = useSession() 160 158 const {rkey} = route.params 161 159 const feedSectionRef = useRef<SectionRef>(null) ··· 175 173 }, [list, moderationOpts]) 176 174 177 175 useSetTitle(isHidden ? _(msg`List Hidden`) : list.name) 178 - 179 - useFocusEffect( 180 - useCallback(() => { 181 - setMinimalShellMode(false) 182 - }, [setMinimalShellMode]), 183 - ) 184 176 185 177 const onChangeMembers = () => { 186 178 if (isCurateList) {
+2 -17
src/screens/SavedFeeds.tsx
··· 1 - import {useCallback, useState} from 'react' 1 + import {useState} from 'react' 2 2 import {View} from 'react-native' 3 3 import type Animated from 'react-native-reanimated' 4 4 import {useAnimatedRef, useScrollViewOffset} from 'react-native-reanimated' ··· 7 7 import {msg} from '@lingui/core/macro' 8 8 import {useLingui} from '@lingui/react' 9 9 import {Trans} from '@lingui/react/macro' 10 - import {useFocusEffect, useNavigation} from '@react-navigation/native' 10 + import {useNavigation} from '@react-navigation/native' 11 11 import {type NativeStackScreenProps} from '@react-navigation/native-stack' 12 12 13 13 import {RECOMMENDED_SAVED_FEEDS, TIMELINE_SAVED_FEED} from '#/lib/constants' ··· 23 23 usePreferencesQuery, 24 24 } from '#/state/queries/preferences' 25 25 import {type UsePreferencesQueryResponse} from '#/state/queries/preferences/types' 26 - import {useSetMinimalShellMode} from '#/state/shell' 27 26 import {FeedSourceCard} from '#/view/com/feeds/FeedSourceCard' 28 27 import {NoFollowingFeed} from '#/screens/Feeds/NoFollowingFeed' 29 28 import {NoSavedFeedsOfAnyType} from '#/screens/Feeds/NoSavedFeedsOfAnyType' ··· 66 65 const t = useTheme() 67 66 const {_} = useLingui() 68 67 const {gtMobile} = useBreakpoints() 69 - const setMinimalShellMode = useSetMinimalShellMode() 70 68 const {mutateAsync: overwriteSavedFeeds, isPending: isOverwritePending} = 71 69 useOverwriteSavedFeedsMutation() 72 70 const navigation = useNavigation<NavigationProp>() ··· 87 85 const noFollowingFeed = 88 86 currentFeeds.every(f => f.type !== 'timeline') && !noSavedFeedsOfAnyType 89 87 const [isDragging, setIsDragging] = useState(false) 90 - 91 - useFocusEffect( 92 - useCallback(() => { 93 - setMinimalShellMode(false) 94 - }, [setMinimalShellMode]), 95 - ) 96 88 97 89 const onSaveChanges = async () => { 98 90 try { ··· 259 251 const t = useTheme() 260 252 const {_} = useLingui() 261 253 const {gtMobile} = useBreakpoints() 262 - const setMinimalShellMode = useSetMinimalShellMode() 263 254 const {mutateAsync: overwriteSavedFeeds, isPending: isOverwritePending} = 264 255 useOverwriteSavedFeedsMutation() 265 256 const navigation = useNavigation<NavigationProp>() ··· 273 264 const noSavedFeedsOfAnyType = pinnedFeeds.length + unpinnedFeeds.length === 0 274 265 const noFollowingFeed = 275 266 currentFeeds.every(f => f.type !== 'timeline') && !noSavedFeedsOfAnyType 276 - 277 - useFocusEffect( 278 - useCallback(() => { 279 - setMinimalShellMode(false) 280 - }, [setMinimalShellMode]), 281 - ) 282 267 283 268 const onSaveChanges = async () => { 284 269 try {
+4 -12
src/screens/Search/Shell.tsx
··· 27 27 useProfilesQuery, 28 28 } from '#/state/queries/profile' 29 29 import {useSession} from '#/state/session' 30 - import {useSetMinimalShellMode} from '#/state/shell' 31 30 import { 32 31 makeSearchQuery, 33 32 type Params, ··· 87 86 const route = useRoute() 88 87 const textInput = useRef<TextInput>(null) 89 88 const {t: l} = useLingui() 90 - const setMinimalShellMode = useSetMinimalShellMode() 91 89 const {currentAccount} = useSession() 92 90 const queryClient = useQueryClient() 93 91 ··· 288 286 289 287 useFocusEffect( 290 288 useCallback(() => { 291 - setMinimalShellMode(false) 292 289 return listenSoftReset(onSoftReset) 293 - }, [onSoftReset, setMinimalShellMode]), 290 + }, [onSoftReset]), 294 291 ) 295 292 296 293 const onSearchInputFocus = useCallback(() => { ··· 481 478 focusSearchInput: (tab?: TabParam) => void 482 479 }): React.ReactNode => { 483 480 const t = useTheme() 484 - const setMinimalShellMode = useSetMinimalShellMode() 485 481 const {hasSession} = useSession() 486 482 const {gtTablet} = useBreakpoints() 487 483 488 - const onPageSelected = useCallback( 489 - (index: number) => { 490 - setMinimalShellMode(false) 491 - setActiveTab(index) 492 - }, 493 - [setActiveTab, setMinimalShellMode], 494 - ) 484 + const onPageSelected = (index: number) => { 485 + setActiveTab(index) 486 + } 495 487 496 488 return queryWithParams ? ( 497 489 <SearchResults
+3 -14
src/screens/StarterPack/Wizard/index.tsx
··· 1 - import {useCallback, useEffect} from 'react' 1 + import {useEffect} from 'react' 2 2 import {Keyboard, View} from 'react-native' 3 3 import {KeyboardAwareScrollView} from 'react-native-keyboard-controller' 4 4 import {useSafeAreaInsets} from 'react-native-safe-area-context' ··· 13 13 import {msg} from '@lingui/core/macro' 14 14 import {useLingui} from '@lingui/react' 15 15 import {Plural, Trans} from '@lingui/react/macro' 16 - import {useFocusEffect, useNavigation} from '@react-navigation/native' 16 + import {useNavigation} from '@react-navigation/native' 17 17 import {type NativeStackScreenProps} from '@react-navigation/native-stack' 18 18 19 19 import {STARTER_PACK_MAX_SIZE} from '#/lib/constants' ··· 39 39 useStarterPackQuery, 40 40 } from '#/state/queries/starter-packs' 41 41 import {useSession} from '#/state/session' 42 - import {useSetMinimalShellMode} from '#/state/shell' 43 42 import {UserAvatar} from '#/view/com/util/UserAvatar' 44 43 import { 45 44 useWizardState, ··· 132 131 133 132 return ( 134 133 <Layout.Screen 134 + minimalShell 135 135 testID="starterPackWizardScreen" 136 136 style={web([{minHeight: 0}, a.flex_1])}> 137 137 <Provider ··· 169 169 const navigation = useNavigation<NavigationProp>() 170 170 const ax = useAnalytics() 171 171 const {_} = useLingui() 172 - const setMinimalShellMode = useSetMinimalShellMode() 173 172 const [state, dispatch] = useWizardState() 174 173 const {currentAccount} = useSession() 175 174 ··· 184 183 gestureEnabled: false, 185 184 }) 186 185 }, [navigation]) 187 - 188 - useFocusEffect( 189 - useCallback(() => { 190 - setMinimalShellMode(true) 191 - 192 - return () => { 193 - setMinimalShellMode(false) 194 - } 195 - }, [setMinimalShellMode]), 196 - ) 197 186 198 187 const getDefaultName = () => { 199 188 const displayName = createSanitizedDisplayName(currentProfile!, true)
+3 -16
src/screens/Topic.tsx
··· 3 3 import {type AppBskyFeedDefs} from '@atproto/api' 4 4 import {msg} from '@lingui/core/macro' 5 5 import {useLingui} from '@lingui/react' 6 - import {useFocusEffect} from '@react-navigation/native' 7 6 import {type NativeStackScreenProps} from '@react-navigation/native-stack' 8 7 9 8 import {HITSLOP_10} from '#/lib/constants' ··· 14 13 import {cleanError} from '#/lib/strings/errors' 15 14 import {enforceLen} from '#/lib/strings/helpers' 16 15 import {useSearchPostsQuery} from '#/state/queries/search-posts' 17 - import {useSetMinimalShellMode} from '#/state/shell' 18 16 import {Pager} from '#/view/com/pager/Pager' 19 17 import {TabBar} from '#/view/com/pager/TabBar' 20 18 import {Post} from '#/view/com/post/Post' ··· 50 48 }, [topic]) 51 49 52 50 const [activeTab, setActiveTab] = useState(0) 53 - const setMinimalShellMode = useSetMinimalShellMode() 54 51 55 - useFocusEffect( 56 - useCallback(() => { 57 - setMinimalShellMode(false) 58 - }, [setMinimalShellMode]), 59 - ) 60 - 61 - const onPageSelected = useCallback( 62 - (index: number) => { 63 - setMinimalShellMode(false) 64 - setActiveTab(index) 65 - }, 66 - [setMinimalShellMode], 67 - ) 52 + const onPageSelected = (index: number) => { 53 + setActiveTab(index) 54 + } 68 55 69 56 const sections = useMemo(() => { 70 57 return [
+2 -6
src/screens/VideoFeed/index.tsx
··· 75 75 } from '#/state/queries/post-feed' 76 76 import {useProfileFollowMutationQueue} from '#/state/queries/profile' 77 77 import {useSession} from '#/state/session' 78 - import {useSetMinimalShellMode} from '#/state/shell' 79 78 import {useSetLightStatusBar} from '#/state/shell/light-status-bar' 80 79 import {List} from '#/view/com/util/List' 81 80 import {UserAvatar} from '#/view/com/util/UserAvatar' ··· 131 130 const {params} = useRoute<RouteProp<CommonNavigatorParams, 'VideoFeed'>>() 132 131 133 132 const t = useTheme() 134 - const setMinShellMode = useSetMinimalShellMode() 135 133 useFocusEffect( 136 134 useCallback(() => { 137 - setMinShellMode(true) 138 135 setSystemUITheme('lightbox', t) 139 136 return () => { 140 - setMinShellMode(false) 141 137 setSystemUITheme('theme', t) 142 138 } 143 - }, [setMinShellMode, t]), 139 + }, [t]), 144 140 ) 145 141 146 142 const isFocused = useIsFocused() ··· 148 144 149 145 return ( 150 146 <ThemeProvider theme="dark"> 151 - <Layout.Screen noInsetTop style={{backgroundColor: 'black'}}> 147 + <Layout.Screen minimalShell noInsetTop style={{backgroundColor: 'black'}}> 152 148 <KeepAwake /> 153 149 <View 154 150 style={[
+5 -1
src/state/shell/index.tsx
··· 11 11 useIsDrawerSwipeDisabled, 12 12 useSetDrawerSwipeDisabled, 13 13 } from './drawer-swipe-disabled' 14 - export {useMinimalShellMode, useSetMinimalShellMode} from './minimal-mode' 14 + export { 15 + useEnableMinimalShellMode, 16 + useEnableMinimalShellModeForScreen, 17 + useMinimalShellMode, 18 + } from './minimal-mode' 15 19 export {useOnboardingDispatch, useOnboardingState} from './onboarding' 16 20 export {useTickEveryMinute} from './tick-every-minute' 17 21
+80 -30
src/state/shell/minimal-mode.tsx
··· 1 - import {createContext, useCallback, useContext, useMemo} from 'react' 1 + import { 2 + createContext, 3 + useCallback, 4 + useContext, 5 + useEffect, 6 + useMemo, 7 + useRef, 8 + } from 'react' 2 9 import { 3 10 type SharedValue, 4 11 useSharedValue, 5 12 withSpring, 6 13 } from 'react-native-reanimated' 14 + import {useFocusEffect} from '@react-navigation/native' 7 15 8 16 type StateContext = { 9 17 headerMode: SharedValue<number> 10 18 footerMode: SharedValue<number> 11 19 } 12 - type SetContext = (v: boolean) => void 20 + type SetContext = { 21 + add: () => void 22 + subtract: () => void 23 + } 13 24 14 - const stateContext = createContext<StateContext>({ 15 - headerMode: { 16 - value: 0, 17 - addListener() {}, 18 - removeListener() {}, 19 - modify() {}, 20 - get() { 21 - return 0 22 - }, 23 - set() {}, 24 - }, 25 - footerMode: { 26 - value: 0, 27 - addListener() {}, 28 - removeListener() {}, 29 - modify() {}, 30 - get() { 31 - return 0 32 - }, 33 - set() {}, 34 - }, 35 - }) 25 + const stateContext = createContext<StateContext | null>(null) 36 26 stateContext.displayName = 'MinimalModeStateContext' 37 - const setContext = createContext<SetContext>((_: boolean) => {}) 27 + const setContext = createContext<SetContext | null>(null) 38 28 setContext.displayName = 'MinimalModeSetContext' 39 29 40 30 export function Provider({children}: React.PropsWithChildren<{}>) { 41 31 const headerMode = useSharedValue(0) 42 32 const footerMode = useSharedValue(0) 43 - const setMode = useCallback( 33 + 34 + const setModeWorklet = useCallback( 44 35 (v: boolean) => { 45 36 'worklet' 46 37 headerMode.set(() => ··· 56 47 }, 57 48 [headerMode, footerMode], 58 49 ) 50 + 51 + // defaults to "visible", if the count is >0 it gets hidden 52 + const countRef = useRef(0) 53 + const add = useCallback(() => { 54 + // 0 -> 1 = hide 55 + if (countRef.current === 0) setModeWorklet(true) 56 + 57 + countRef.current += 1 58 + }, [setModeWorklet]) 59 + const subtract = useCallback(() => { 60 + // 1 -> 0 = show 61 + if (countRef.current === 1) setModeWorklet(false) 62 + 63 + // count must never go below 0 64 + if (countRef.current > 0) countRef.current -= 1 65 + }, [setModeWorklet]) 66 + 67 + const setters = useMemo( 68 + () => ({ 69 + add, 70 + subtract, 71 + }), 72 + [add, subtract], 73 + ) 74 + 59 75 const value = useMemo( 60 76 () => ({ 61 77 headerMode, ··· 65 81 ) 66 82 return ( 67 83 <stateContext.Provider value={value}> 68 - <setContext.Provider value={setMode}>{children}</setContext.Provider> 84 + <setContext.Provider value={setters}>{children}</setContext.Provider> 69 85 </stateContext.Provider> 70 86 ) 71 87 } 72 88 73 89 export function useMinimalShellMode() { 74 - return useContext(stateContext) 90 + const context = useContext(stateContext) 91 + if (!context) 92 + throw new Error( 93 + 'useMinimalShellMode must be used within a MinimalModeProvider', 94 + ) 95 + return context 96 + } 97 + 98 + export function useMinimalShellModeSetters() { 99 + const context = useContext(setContext) 100 + if (!context) 101 + throw new Error( 102 + 'useMinimalShellModeSetters must be used within a MinimalModeProvider', 103 + ) 104 + return context 75 105 } 76 106 77 - export function useSetMinimalShellMode() { 78 - return useContext(setContext) 107 + export function useEnableMinimalShellMode({enabled} = {enabled: true}) { 108 + const setters = useMinimalShellModeSetters() 109 + useEffect(() => { 110 + if (enabled) { 111 + setters.add() 112 + return () => setters.subtract() 113 + } 114 + }, [enabled, setters]) 115 + } 116 + 117 + export function useEnableMinimalShellModeForScreen( 118 + {enabled} = {enabled: true}, 119 + ) { 120 + const setters = useMinimalShellModeSetters() 121 + useFocusEffect( 122 + useCallback(() => { 123 + if (enabled) { 124 + setters.add() 125 + return () => setters.subtract() 126 + } 127 + }, [enabled, setters]), 128 + ) 79 129 }
+2 -6
src/view/com/auth/LoggedOut.tsx
··· 13 13 useLoggedOutView, 14 14 useLoggedOutViewControls, 15 15 } from '#/state/shell/logged-out' 16 - import {useSetMinimalShellMode} from '#/state/shell/minimal-mode' 16 + import {useEnableMinimalShellMode} from '#/state/shell/minimal-mode' 17 17 import {ErrorBoundary} from '#/view/com/util/ErrorBoundary' 18 18 import {Login} from '#/screens/Login' 19 19 import {Signup} from '#/screens/Signup' ··· 37 37 const ax = useAnalytics() 38 38 const t = useTheme() 39 39 const insets = useSafeAreaInsets() 40 - const setMinimalShellMode = useSetMinimalShellMode() 40 + useEnableMinimalShellMode() 41 41 const {requestedAccountSwitchTo} = useLoggedOutView() 42 42 const [screenState, setScreenState] = useState<ScreenState>(() => { 43 43 if (requestedAccountSwitchTo === 'new') { ··· 67 67 }, 68 68 }) 69 69 }, [accounts, agent, queryClient]) 70 - 71 - useEffect(() => { 72 - setMinimalShellMode(true) 73 - }, [setMinimalShellMode]) 74 70 75 71 const onPressDismiss = useCallback(() => { 76 72 if (onDismiss) {
+1 -4
src/view/com/feeds/FeedPage.tsx
··· 30 30 } from '#/state/queries/post-feed' 31 31 import {truncateAndInvalidate} from '#/state/queries/util' 32 32 import {useSession} from '#/state/session' 33 - import {useSetMinimalShellMode} from '#/state/shell' 34 33 import {useHeaderOffset} from '#/components/hooks/useHeaderOffset' 35 34 import {useAnalytics} from '#/analytics' 36 35 import {IS_NATIVE} from '#/env' ··· 70 69 const queryClient = useQueryClient() 71 70 const {openComposer} = useOpenComposer() 72 71 const [isScrolledDown, setIsScrolledDown] = useState(false) 73 - const setMinimalShellMode = useSetMinimalShellMode() 74 72 const headerOffset = useHeaderOffset() 75 73 const feedFeedback = useFeedFeedback(feedInfo, hasSession) 76 74 const scrollElRef = useRef<ListMethods>(null) ··· 95 93 animated: IS_NATIVE, 96 94 offset: -headerOffset, 97 95 }) 98 - setMinimalShellMode(false) 99 - }, [headerOffset, setMinimalShellMode]) 96 + }, [headerOffset]) 100 97 101 98 const onSoftReset = useCallback(() => { 102 99 const isScreenFocused =
-10
src/view/screens/CommunityGuidelines.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {View} from 'react-native' 3 2 import {msg} from '@lingui/core/macro' 4 3 import {useLingui} from '@lingui/react' 5 4 import {Trans} from '@lingui/react/macro' 6 - import {useFocusEffect} from '@react-navigation/native' 7 5 8 6 import {usePalette} from '#/lib/hooks/usePalette' 9 7 import { ··· 11 9 type NativeStackScreenProps, 12 10 } from '#/lib/routes/types' 13 11 import {s} from '#/lib/styles' 14 - import {useSetMinimalShellMode} from '#/state/shell' 15 12 import {TextLink} from '#/view/com/util/Link' 16 13 import {Text} from '#/view/com/util/text/Text' 17 14 import {ScrollView} from '#/view/com/util/Views' ··· 25 22 export const CommunityGuidelinesScreen = (_props: Props) => { 26 23 const pal = usePalette('default') 27 24 const {_} = useLingui() 28 - const setMinimalShellMode = useSetMinimalShellMode() 29 - 30 - useFocusEffect( 31 - useCallback(() => { 32 - setMinimalShellMode(false) 33 - }, [setMinimalShellMode]), 34 - ) 35 25 36 26 return ( 37 27 <Layout.Screen>
-10
src/view/screens/CopyrightPolicy.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {View} from 'react-native' 3 2 import {msg} from '@lingui/core/macro' 4 3 import {useLingui} from '@lingui/react' 5 4 import {Trans} from '@lingui/react/macro' 6 - import {useFocusEffect} from '@react-navigation/native' 7 5 8 6 import {usePalette} from '#/lib/hooks/usePalette' 9 7 import { ··· 11 9 type NativeStackScreenProps, 12 10 } from '#/lib/routes/types' 13 11 import {s} from '#/lib/styles' 14 - import {useSetMinimalShellMode} from '#/state/shell' 15 12 import {TextLink} from '#/view/com/util/Link' 16 13 import {Text} from '#/view/com/util/text/Text' 17 14 import {ScrollView} from '#/view/com/util/Views' ··· 22 19 export const CopyrightPolicyScreen = (_props: Props) => { 23 20 const pal = usePalette('default') 24 21 const {_} = useLingui() 25 - const setMinimalShellMode = useSetMinimalShellMode() 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 22 33 23 return ( 34 24 <Layout.Screen>
-9
src/view/screens/Feeds.tsx
··· 4 4 import {msg} from '@lingui/core/macro' 5 5 import {useLingui} from '@lingui/react' 6 6 import {Trans} from '@lingui/react/macro' 7 - import {useFocusEffect} from '@react-navigation/native' 8 7 import debounce from 'lodash.debounce' 9 8 10 9 import {useOpenComposer} from '#/lib/hooks/useOpenComposer' ··· 24 23 useSearchPopularFeedsMutation, 25 24 } from '#/state/queries/feed' 26 25 import {useSession} from '#/state/session' 27 - import {useSetMinimalShellMode} from '#/state/shell' 28 26 import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' 29 27 import {FAB} from '#/view/com/util/fab/FAB' 30 28 import {List, type ListMethods} from '#/view/com/util/List' ··· 126 124 hasNextPage: hasNextPopularFeedsPage, 127 125 } = useGetPopularFeedsQuery() 128 126 const {_} = useLingui() 129 - const setMinimalShellMode = useSetMinimalShellMode() 130 127 const { 131 128 data: searchResults, 132 129 mutate: search, ··· 192 189 hasNextPopularFeedsPage, 193 190 fetchNextPopularFeedsPage, 194 191 ]) 195 - 196 - useFocusEffect( 197 - useCallback(() => { 198 - setMinimalShellMode(false) 199 - }, [setMinimalShellMode]), 200 - ) 201 192 202 193 const items = useMemo(() => { 203 194 let slices: FlatlistSlice[] = []
+14 -9
src/view/screens/Home.tsx
··· 1 1 import {useCallback, useEffect, useLayoutEffect, useMemo, useRef} from 'react' 2 2 import {ActivityIndicator, StyleSheet} from 'react-native' 3 + import {withSpring} from 'react-native-reanimated' 3 4 import {useFocusEffect} from '@react-navigation/native' 4 5 5 6 import {PROD_DEFAULT_FEED} from '#/lib/constants' ··· 20 21 import {usePreferencesQuery} from '#/state/queries/preferences' 21 22 import {type UsePreferencesQueryResponse} from '#/state/queries/preferences/types' 22 23 import {useSession} from '#/state/session' 23 - import {useSetMinimalShellMode} from '#/state/shell' 24 + import {useMinimalShellMode} from '#/state/shell' 24 25 import {useLoggedOutViewControls} from '#/state/shell/logged-out' 25 26 import {useSelectedFeed, useSetSelectedFeed} from '#/state/shell/selected-feed' 26 27 import {FeedPage} from '#/view/com/feeds/FeedPage' ··· 138 139 }, [selectedIndex]) 139 140 140 141 const {hasSession} = useSession() 141 - const setMinimalShellMode = useSetMinimalShellMode() 142 + const {headerMode} = useMinimalShellMode() 143 + const showHeader = useCallback(() => { 144 + 'worklet' 145 + headerMode.set(() => withSpring(0, {overshootClamping: true})) 146 + }, [headerMode]) 147 + 142 148 useFocusEffect( 143 149 useCallback(() => { 144 - setMinimalShellMode(false) 145 - }, [setMinimalShellMode]), 150 + return () => showHeader() 151 + }, [showHeader]), 146 152 ) 147 153 148 154 useFocusEffect( ··· 160 166 161 167 const onPageSelected = useCallback( 162 168 (index: number) => { 163 - setMinimalShellMode(false) 169 + showHeader() 164 170 const maybeFeed = allFeeds[index] 165 171 166 172 // Mutate the ref before setting state to avoid the imperative syncing effect ··· 176 182 }) 177 183 } 178 184 }, 179 - [ax, setSelectedFeed, setMinimalShellMode, allFeeds], 185 + [ax, setSelectedFeed, showHeader, allFeeds], 180 186 ) 181 187 182 188 const onPressSelected = useCallback(() => { ··· 187 193 (state: 'idle' | 'dragging' | 'settling') => { 188 194 'worklet' 189 195 if (state === 'dragging') { 190 - setMinimalShellMode(false) 196 + showHeader() 191 197 } 192 198 }, 193 - [setMinimalShellMode], 199 + [showHeader], 194 200 ) 195 201 196 202 const [demoMode] = useDemoMode() ··· 247 253 ref={pagerRef} 248 254 testID="homeScreen" 249 255 onPageSelected={onPageSelected} 250 - onPageScrollStateChanged={onPageScrollStateChanged} 251 256 renderTabBar={renderTabBar} 252 257 initialPage={selectedIndex}> 253 258 <FeedPage
+1 -9
src/view/screens/Lists.tsx
··· 3 3 import {msg} from '@lingui/core/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 import {Trans} from '@lingui/react/macro' 6 - import {useFocusEffect, useNavigation} from '@react-navigation/native' 6 + import {useNavigation} from '@react-navigation/native' 7 7 8 8 import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerification' 9 9 import { ··· 11 11 type NativeStackScreenProps, 12 12 type NavigationProp, 13 13 } from '#/lib/routes/types' 14 - import {useSetMinimalShellMode} from '#/state/shell' 15 14 import {MyLists} from '#/view/com/lists/MyLists' 16 15 import {atoms as a} from '#/alf' 17 16 import {Button, ButtonIcon, ButtonText} from '#/components/Button' ··· 23 22 type Props = NativeStackScreenProps<CommonNavigatorParams, 'Lists'> 24 23 export function ListsScreen({}: Props) { 25 24 const {_} = useLingui() 26 - const setMinimalShellMode = useSetMinimalShellMode() 27 25 const navigation = useNavigation<NavigationProp>() 28 26 const requireEmailVerification = useRequireEmailVerification() 29 27 const createListDialogControl = useDialogControl() 30 - 31 - useFocusEffect( 32 - useCallback(() => { 33 - setMinimalShellMode(false) 34 - }, [setMinimalShellMode]), 35 - ) 36 28 37 29 const onPressNewList = useCallback(() => { 38 30 createListDialogControl.open()
-9
src/view/screens/ModerationBlockedAccounts.tsx
··· 2 2 import {type StyleProp, View, type ViewStyle} from 'react-native' 3 3 import {type AppBskyActorDefs as ActorDefs} from '@atproto/api' 4 4 import {Trans} from '@lingui/react/macro' 5 - import {useFocusEffect} from '@react-navigation/native' 6 5 import {type NativeStackScreenProps} from '@react-navigation/native-stack' 7 6 8 7 import {type CommonNavigatorParams} from '#/lib/routes/types' ··· 10 9 import {logger} from '#/logger' 11 10 import {useModerationOpts} from '#/state/preferences/moderation-opts' 12 11 import {useMyBlockedAccountsQuery} from '#/state/queries/my-blocked-accounts' 13 - import {useSetMinimalShellMode} from '#/state/shell' 14 12 import {ErrorScreen} from '#/view/com/util/error/ErrorScreen' 15 13 import {List} from '#/view/com/util/List' 16 14 import {atoms as a, useTheme} from '#/alf' ··· 25 23 > 26 24 export function ModerationBlockedAccounts({}: Props) { 27 25 const t = useTheme() 28 - const setMinimalShellMode = useSetMinimalShellMode() 29 26 const moderationOpts = useModerationOpts() 30 27 31 28 const [isPTRing, setIsPTRing] = useState(false) ··· 46 43 } 47 44 return [] 48 45 }, [data]) 49 - 50 - useFocusEffect( 51 - useCallback(() => { 52 - setMinimalShellMode(false) 53 - }, [setMinimalShellMode]), 54 - ) 55 46 56 47 const onRefresh = useCallback(async () => { 57 48 setIsPTRing(true)
+1 -9
src/view/screens/ModerationModlists.tsx
··· 3 3 import {msg} from '@lingui/core/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 import {Trans} from '@lingui/react/macro' 6 - import {useFocusEffect, useNavigation} from '@react-navigation/native' 6 + import {useNavigation} from '@react-navigation/native' 7 7 8 8 import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerification' 9 9 import { ··· 11 11 type NativeStackScreenProps, 12 12 type NavigationProp, 13 13 } from '#/lib/routes/types' 14 - import {useSetMinimalShellMode} from '#/state/shell' 15 14 import {MyLists} from '#/view/com/lists/MyLists' 16 15 import {atoms as a} from '#/alf' 17 16 import {Button, ButtonIcon, ButtonText} from '#/components/Button' ··· 23 22 type Props = NativeStackScreenProps<CommonNavigatorParams, 'ModerationModlists'> 24 23 export function ModerationModlistsScreen({}: Props) { 25 24 const {_} = useLingui() 26 - const setMinimalShellMode = useSetMinimalShellMode() 27 25 const navigation = useNavigation<NavigationProp>() 28 26 const requireEmailVerification = useRequireEmailVerification() 29 27 const createListDialogControl = useDialogControl() 30 - 31 - useFocusEffect( 32 - useCallback(() => { 33 - setMinimalShellMode(false) 34 - }, [setMinimalShellMode]), 35 - ) 36 28 37 29 const onPressNewList = useCallback(() => { 38 30 createListDialogControl.open()
-9
src/view/screens/ModerationMutedAccounts.tsx
··· 2 2 import {type StyleProp, View, type ViewStyle} from 'react-native' 3 3 import {type AppBskyActorDefs as ActorDefs} from '@atproto/api' 4 4 import {Trans} from '@lingui/react/macro' 5 - import {useFocusEffect} from '@react-navigation/native' 6 5 import {type NativeStackScreenProps} from '@react-navigation/native-stack' 7 6 8 7 import {type CommonNavigatorParams} from '#/lib/routes/types' ··· 10 9 import {logger} from '#/logger' 11 10 import {useModerationOpts} from '#/state/preferences/moderation-opts' 12 11 import {useMyMutedAccountsQuery} from '#/state/queries/my-muted-accounts' 13 - import {useSetMinimalShellMode} from '#/state/shell' 14 12 import {ErrorScreen} from '#/view/com/util/error/ErrorScreen' 15 13 import {List} from '#/view/com/util/List' 16 14 import {atoms as a, useTheme} from '#/alf' ··· 26 24 export function ModerationMutedAccounts({}: Props) { 27 25 const t = useTheme() 28 26 const moderationOpts = useModerationOpts() 29 - const setMinimalShellMode = useSetMinimalShellMode() 30 27 31 28 const [isPTRing, setIsPTRing] = useState(false) 32 29 const { ··· 46 43 } 47 44 return [] 48 45 }, [data]) 49 - 50 - useFocusEffect( 51 - useCallback(() => { 52 - setMinimalShellMode(false) 53 - }, [setMinimalShellMode]), 54 - ) 55 46 56 47 const onRefresh = useCallback(async () => { 57 48 setIsPTRing(true)
+1 -13
src/view/screens/NotFound.tsx
··· 3 3 import {msg} from '@lingui/core/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 import {Trans} from '@lingui/react/macro' 6 - import { 7 - StackActions, 8 - useFocusEffect, 9 - useNavigation, 10 - } from '@react-navigation/native' 6 + import {StackActions, useNavigation} from '@react-navigation/native' 11 7 12 8 import {usePalette} from '#/lib/hooks/usePalette' 13 9 import {type NavigationProp} from '#/lib/routes/types' 14 10 import {s} from '#/lib/styles' 15 - import {useSetMinimalShellMode} from '#/state/shell' 16 11 import {Button} from '#/view/com/util/forms/Button' 17 12 import {Text} from '#/view/com/util/text/Text' 18 13 import {ViewHeader} from '#/view/com/util/ViewHeader' ··· 22 17 const pal = usePalette('default') 23 18 const {_} = useLingui() 24 19 const navigation = useNavigation<NavigationProp>() 25 - const setMinimalShellMode = useSetMinimalShellMode() 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 20 33 21 const canGoBack = navigation.canGoBack() 34 22 const onPressHome = useCallback(() => {
+2 -6
src/view/screens/Notifications.tsx
··· 23 23 useUnreadNotificationsApi, 24 24 } from '#/state/queries/notifications/unread' 25 25 import {truncateAndInvalidate} from '#/state/queries/util' 26 - import {useSetMinimalShellMode} from '#/state/shell' 27 26 import {NotificationFeed} from '#/view/com/notifications/NotificationFeed' 28 27 import {Pager} from '#/view/com/pager/Pager' 29 28 import {TabBar} from '#/view/com/pager/TabBar' ··· 187 186 setIsLoadingLatest: (v: boolean) => void 188 187 }) { 189 188 const {_} = useLingui() 190 - const setMinimalShellMode = useSetMinimalShellMode() 191 189 const [isScrolledDown, setIsScrolledDown] = useState(false) 192 190 const scrollElRef = useRef<ListMethods>(null) 193 191 const queryClient = useQueryClient() ··· 198 196 // = 199 197 const scrollToTop = useCallback(() => { 200 198 scrollElRef.current?.scrollToOffset({animated: IS_NATIVE, offset: 0}) 201 - setMinimalShellMode(false) 202 - }, [scrollElRef, setMinimalShellMode]) 199 + }, [scrollElRef]) 203 200 204 201 const onPressLoadLatest = useCallback(() => { 205 202 scrollToTop() ··· 242 239 useFocusEffect( 243 240 useCallback(() => { 244 241 if (isFocusedAndActive) { 245 - setMinimalShellMode(false) 246 242 logger.debug('NotificationsScreen: Focus') 247 243 onFocusCheckLatest() 248 244 } 249 - }, [setMinimalShellMode, onFocusCheckLatest, isFocusedAndActive]), 245 + }, [onFocusCheckLatest, isFocusedAndActive]), 250 246 ) 251 247 252 248 useEffect(() => {
-12
src/view/screens/PostThread.tsx
··· 1 - import {useCallback} from 'react' 2 - import {useFocusEffect} from '@react-navigation/native' 3 - 4 1 import { 5 2 type CommonNavigatorParams, 6 3 type NativeStackScreenProps, 7 4 } from '#/lib/routes/types' 8 5 import {makeRecordUri} from '#/lib/strings/url-helpers' 9 - import {useSetMinimalShellMode} from '#/state/shell' 10 6 import {PostThread} from '#/screens/PostThread' 11 7 import * as Layout from '#/components/Layout' 12 8 13 9 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostThread'> 14 10 export function PostThreadScreen({route}: Props) { 15 - const setMinimalShellMode = useSetMinimalShellMode() 16 - 17 11 const {name, rkey} = route.params 18 12 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 19 - 20 - useFocusEffect( 21 - useCallback(() => { 22 - setMinimalShellMode(false) 23 - }, [setMinimalShellMode]), 24 - ) 25 13 26 14 return ( 27 15 <Layout.Screen testID="postThreadScreen">
-10
src/view/screens/PrivacyPolicy.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {View} from 'react-native' 3 2 import {msg} from '@lingui/core/macro' 4 3 import {useLingui} from '@lingui/react' 5 4 import {Trans} from '@lingui/react/macro' 6 - import {useFocusEffect} from '@react-navigation/native' 7 5 8 6 import {usePalette} from '#/lib/hooks/usePalette' 9 7 import { ··· 11 9 type NativeStackScreenProps, 12 10 } from '#/lib/routes/types' 13 11 import {s} from '#/lib/styles' 14 - import {useSetMinimalShellMode} from '#/state/shell' 15 12 import {TextLink} from '#/view/com/util/Link' 16 13 import {Text} from '#/view/com/util/text/Text' 17 14 import {ScrollView} from '#/view/com/util/Views' ··· 22 19 export const PrivacyPolicyScreen = (_props: Props) => { 23 20 const pal = usePalette('default') 24 21 const {_} = useLingui() 25 - const setMinimalShellMode = useSetMinimalShellMode() 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 22 33 23 return ( 34 24 <Layout.Screen>
+1 -4
src/view/screens/Profile.tsx
··· 34 34 import {useProfileQuery} from '#/state/queries/profile' 35 35 import {useResolveDidQuery} from '#/state/queries/resolve-uri' 36 36 import {useAgent, useSession} from '#/state/session' 37 - import {useSetMinimalShellMode} from '#/state/shell' 38 37 import {ProfileFeedgens} from '#/view/com/feeds/ProfileFeedgens' 39 38 import {ProfileLists} from '#/view/com/lists/ProfileLists' 40 39 import {PagerWithHeader} from '#/view/com/pager/PagerWithHeader' ··· 175 174 }) { 176 175 const profile = useProfileShadow(profileUnshadowed) 177 176 const {hasSession, currentAccount} = useSession() 178 - const setMinimalShellMode = useSetMinimalShellMode() 179 177 const {openComposer} = useOpenComposer() 180 178 const navigation = useNavigation<NavigationProp>() 181 179 const requireEmailVerification = useRequireEmailVerification() ··· 317 315 318 316 useFocusEffect( 319 317 useCallback(() => { 320 - setMinimalShellMode(false) 321 318 return listenSoftReset(() => { 322 319 scrollSectionToTop(currentPage) 323 320 }) 324 - }, [setMinimalShellMode, currentPage, scrollSectionToTop]), 321 + }, [currentPage, scrollSectionToTop]), 325 322 ) 326 323 327 324 // events
-10
src/view/screens/ProfileFeedLikedBy.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {Trans} from '@lingui/react/macro' 3 - import {useFocusEffect} from '@react-navigation/native' 4 2 5 3 import { 6 4 type CommonNavigatorParams, 7 5 type NativeStackScreenProps, 8 6 } from '#/lib/routes/types' 9 7 import {makeRecordUri} from '#/lib/strings/url-helpers' 10 - import {useSetMinimalShellMode} from '#/state/shell' 11 8 import {PostLikedBy as PostLikedByComponent} from '#/view/com/post-thread/PostLikedBy' 12 9 import * as Layout from '#/components/Layout' 13 10 14 11 type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileFeedLikedBy'> 15 12 export const ProfileFeedLikedByScreen = ({route}: Props) => { 16 - const setMinimalShellMode = useSetMinimalShellMode() 17 13 const {name, rkey} = route.params 18 14 const uri = makeRecordUri(name, 'app.bsky.feed.generator', rkey) 19 - 20 - useFocusEffect( 21 - useCallback(() => { 22 - setMinimalShellMode(false) 23 - }, [setMinimalShellMode]), 24 - ) 25 15 26 16 return ( 27 17 <Layout.Screen testID="postLikedByScreen">
-10
src/view/screens/Support.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {msg} from '@lingui/core/macro' 3 2 import {useLingui} from '@lingui/react' 4 3 import {Trans} from '@lingui/react/macro' 5 - import {useFocusEffect} from '@react-navigation/native' 6 4 7 5 import {HELP_DESK_URL} from '#/lib/constants' 8 6 import {usePalette} from '#/lib/hooks/usePalette' ··· 11 9 type NativeStackScreenProps, 12 10 } from '#/lib/routes/types' 13 11 import {s} from '#/lib/styles' 14 - import {useSetMinimalShellMode} from '#/state/shell' 15 12 import {TextLink} from '#/view/com/util/Link' 16 13 import {Text} from '#/view/com/util/text/Text' 17 14 import {ViewHeader} from '#/view/com/util/ViewHeader' ··· 21 18 type Props = NativeStackScreenProps<CommonNavigatorParams, 'Support'> 22 19 export const SupportScreen = (_props: Props) => { 23 20 const pal = usePalette('default') 24 - const setMinimalShellMode = useSetMinimalShellMode() 25 21 const {_} = useLingui() 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 22 33 23 return ( 34 24 <Layout.Screen>
-10
src/view/screens/TermsOfService.tsx
··· 1 - import {useCallback} from 'react' 2 1 import {View} from 'react-native' 3 2 import {msg} from '@lingui/core/macro' 4 3 import {useLingui} from '@lingui/react' 5 4 import {Trans} from '@lingui/react/macro' 6 - import {useFocusEffect} from '@react-navigation/native' 7 5 8 6 import {usePalette} from '#/lib/hooks/usePalette' 9 7 import { ··· 11 9 type NativeStackScreenProps, 12 10 } from '#/lib/routes/types' 13 11 import {s} from '#/lib/styles' 14 - import {useSetMinimalShellMode} from '#/state/shell' 15 12 import {TextLink} from '#/view/com/util/Link' 16 13 import {Text} from '#/view/com/util/text/Text' 17 14 import {ScrollView} from '#/view/com/util/Views' ··· 21 18 type Props = NativeStackScreenProps<CommonNavigatorParams, 'TermsOfService'> 22 19 export const TermsOfServiceScreen = (_props: Props) => { 23 20 const pal = usePalette('default') 24 - const setMinimalShellMode = useSetMinimalShellMode() 25 21 const {_} = useLingui() 26 - 27 - useFocusEffect( 28 - useCallback(() => { 29 - setMinimalShellMode(false) 30 - }, [setMinimalShellMode]), 31 - ) 32 22 33 23 return ( 34 24 <Layout.Screen>