diff options
author | Eric Bailey <git@esb.lol> | 2023-11-07 13:37:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-07 11:37:47 -0800 |
commit | bfe196bac5e618bfbeab4f6fabef3e5a18194868 (patch) | |
tree | f3fd74b8472f5bcd3bbcf3b111a0f19b059de404 /src/view/screens/PostThread.tsx | |
parent | 7158157f5fe07b8f97842736ea87b598baabb7da (diff) | |
download | voidsky-bfe196bac5e618bfbeab4f6fabef3e5a18194868.tar.zst |
Extract shell state into separate context (#1824)
* WIP * Add shell state * Integrate new shell state for drawer and minimal shell mode * Replace isDrawerSwipeDisabled * Split shell state into separate contexts to avoid needless re-renders * Fix typo --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/screens/PostThread.tsx')
-rw-r--r-- | src/view/screens/PostThread.tsx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx index 8bb279be8..0bdd06269 100644 --- a/src/view/screens/PostThread.tsx +++ b/src/view/screens/PostThread.tsx @@ -15,6 +15,7 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context' import {clamp} from 'lodash' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {logger} from '#/logger' +import {useMinimalShellMode, useSetMinimalShellMode} from '#/state/shell' const SHELL_FOOTER_HEIGHT = 44 @@ -22,6 +23,8 @@ type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostThread'> export const PostThreadScreen = withAuthRequired( observer(function PostThreadScreenImpl({route}: Props) { const store = useStores() + const minimalShellMode = useMinimalShellMode() + const setMinimalShellMode = useSetMinimalShellMode() const safeAreaInsets = useSafeAreaInsets() const {name, rkey} = route.params const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) @@ -33,7 +36,7 @@ export const PostThreadScreen = withAuthRequired( useFocusEffect( React.useCallback(() => { - store.shell.setMinimalShellMode(false) + setMinimalShellMode(false) const threadCleanup = view.registerListeners() InteractionManager.runAfterInteractions(() => { @@ -47,7 +50,7 @@ export const PostThreadScreen = withAuthRequired( return () => { threadCleanup() } - }, [store, view]), + }, [view, setMinimalShellMode]), ) const onPressReply = React.useCallback(() => { @@ -80,7 +83,7 @@ export const PostThreadScreen = withAuthRequired( treeView={!!store.preferences.thread.lab_treeViewEnabled} /> </View> - {isMobile && !store.shell.minimalShellMode && ( + {isMobile && !minimalShellMode && ( <View style={[ styles.prompt, |