diff options
Diffstat (limited to 'src/view/screens/stacks/PostThread.tsx')
-rw-r--r-- | src/view/screens/stacks/PostThread.tsx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/view/screens/stacks/PostThread.tsx b/src/view/screens/stacks/PostThread.tsx new file mode 100644 index 000000000..485a2e49a --- /dev/null +++ b/src/view/screens/stacks/PostThread.tsx @@ -0,0 +1,38 @@ +import React, {useLayoutEffect} from 'react' +import {TouchableOpacity} from 'react-native' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {makeRecordUri} from '../../lib/strings' +import {Shell} from '../../shell' +import type {RootTabsScreenProps} from '../../routes/types' +import {PostThread as PostThreadComponent} from '../../com/post-thread/PostThread' + +export const PostThread = ({ + navigation, + route, +}: RootTabsScreenProps<'PostThread'>) => { + const {name, recordKey} = route.params + const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey) + + useLayoutEffect(() => { + navigation.setOptions({ + headerShown: true, + headerTitle: 'Thread', + headerLeft: () => ( + <TouchableOpacity onPress={() => navigation.goBack()}> + <FontAwesomeIcon icon="arrow-left" /> + </TouchableOpacity> + ), + }) + }, [navigation]) + + const onNavigateContent = (screen: string, props: Record<string, string>) => { + // @ts-ignore it's up to the callers to supply correct params -prf + navigation.push(screen, props) + } + + return ( + <Shell> + <PostThreadComponent uri={uri} onNavigateContent={onNavigateContent} /> + </Shell> + ) +} |