From bb51af5ae9c405faafad3b9685eef545c3437adb Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Thu, 1 Sep 2022 12:00:08 -0500
Subject: Implement working screen-state management and remove extraneous loads

---
 src/view/screens/PostThread.tsx | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

(limited to 'src/view/screens/PostThread.tsx')

diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx
index 1003a40e1..8da40302b 100644
--- a/src/view/screens/PostThread.tsx
+++ b/src/view/screens/PostThread.tsx
@@ -1,32 +1,19 @@
-import React, {useEffect, useLayoutEffect} from 'react'
-import {TouchableOpacity} from 'react-native'
-import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
+import React, {useEffect} from 'react'
 import {makeRecordUri} from '../lib/strings'
 import {PostThread as PostThreadComponent} from '../com/post-thread/PostThread'
 import {ScreenParams} from '../routes'
 import {useStores} from '../../state'
-import {useLoadEffect} from '../lib/navigation'
 
-export const PostThread = ({params}: ScreenParams) => {
+export const PostThread = ({visible, params}: ScreenParams) => {
   const store = useStores()
   const {name, recordKey} = params
   const uri = makeRecordUri(name, 'blueskyweb.xyz:Posts', recordKey)
-  useLoadEffect(() => {
-    store.nav.setTitle(`Post by ${name}`)
-  }, [store.nav, name])
 
-  // TODO
-  // useLayoutEffect(() => {
-  //   navigation.setOptions({
-  //     headerShown: true,
-  //     headerTitle: 'Thread',
-  //     headerLeft: () => (
-  //       <TouchableOpacity onPress={() => navigation.goBack()}>
-  //         <FontAwesomeIcon icon="arrow-left" />
-  //       </TouchableOpacity>
-  //     ),
-  //   })
-  // }, [navigation])
+  useEffect(() => {
+    if (visible) {
+      store.nav.setTitle(`Post by ${name}`)
+    }
+  }, [visible, store.nav, name])
 
   return <PostThreadComponent uri={uri} />
 }
-- 
cgit 1.4.1

