about summary refs log tree commit diff
path: root/src/view/screens/PostThread.tsx
blob: fc804f61eaa57a29dbd6b7611a9408569a0ae6b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React, {useEffect} from 'react'
import {View} from 'react-native'
import {makeRecordUri} from '../lib/strings'
import {ViewHeader} from '../com/util/ViewHeader'
import {PostThread as PostThreadComponent} from '../com/post-thread/PostThread'
import {ScreenParams} from '../routes'
import {useStores} from '../../state'

export const PostThread = ({visible, params}: ScreenParams) => {
  const store = useStores()
  const {name, rkey} = params
  const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey)

  useEffect(() => {
    if (visible) {
      store.nav.setTitle(`Post by ${name}`)
    }
  }, [visible, store.nav, name])

  return (
    <View style={{flex: 1}}>
      <ViewHeader title="Post" subtitle={`by ${name}`} />
      <View style={{flex: 1}}>
        <PostThreadComponent uri={uri} />
      </View>
    </View>
  )
}