about summary refs log tree commit diff
path: root/src/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/view')
-rw-r--r--src/view/com/modals/ComposePost.tsx9
-rw-r--r--src/view/com/post-thread/PostThread.tsx6
-rw-r--r--src/view/com/post-thread/PostThreadItem.tsx6
-rw-r--r--src/view/com/post/Post.tsx2
-rw-r--r--src/view/com/posts/FeedItem.tsx2
-rw-r--r--src/view/screens/Home.tsx5
6 files changed, 24 insertions, 6 deletions
diff --git a/src/view/com/modals/ComposePost.tsx b/src/view/com/modals/ComposePost.tsx
index 510900b60..cecc478f7 100644
--- a/src/view/com/modals/ComposePost.tsx
+++ b/src/view/com/modals/ComposePost.tsx
@@ -16,7 +16,13 @@ const WARNING_TEXT_LENGTH = 200
 const DANGER_TEXT_LENGTH = 255
 export const snapPoints = ['100%']
 
-export function Component({replyTo}: {replyTo?: string}) {
+export function Component({
+  replyTo,
+  onPost,
+}: {
+  replyTo?: string
+  onPost?: () => void
+}) {
   const store = useStores()
   const [error, setError] = useState('')
   const [text, setText] = useState('')
@@ -72,6 +78,7 @@ export function Component({replyTo}: {replyTo?: string}) {
       )
       return
     }
+    onPost?.()
     store.shell.closeModal()
     Toast.show(`Your ${replyTo ? 'reply' : 'post'} has been published`, {
       duration: Toast.durations.LONG,
diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx
index 5bd379fed..8a0ddab5d 100644
--- a/src/view/com/post-thread/PostThread.tsx
+++ b/src/view/com/post-thread/PostThread.tsx
@@ -70,7 +70,11 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) {
   // =
   const posts = view.thread ? Array.from(flattenThread(view.thread)) : []
   const renderItem = ({item}: {item: PostThreadViewPostModel}) => (
-    <PostThreadItem item={item} onPressShare={onPressShare} />
+    <PostThreadItem
+      item={item}
+      onPressShare={onPressShare}
+      onPostReply={onRefresh}
+    />
   )
   return (
     <FlatList
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index d28017e44..ef1324bfb 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -20,9 +20,11 @@ const PARENT_REPLY_LINE_LENGTH = 8
 export const PostThreadItem = observer(function PostThreadItem({
   item,
   onPressShare,
+  onPostReply,
 }: {
   item: PostThreadViewPostModel
   onPressShare: (_uri: string) => void
+  onPostReply: () => void
 }) {
   const store = useStores()
   const record = item.record as unknown as PostType.Record
@@ -47,7 +49,9 @@ export const PostThreadItem = observer(function PostThreadItem({
   const repostsTitle = 'Reposts of this post'
 
   const onPressReply = () => {
-    store.shell.openModal(new ComposePostModel(item.uri))
+    store.shell.openModal(
+      new ComposePostModel({replyTo: item.uri, onPost: onPostReply}),
+    )
   }
   const onPressToggleRepost = () => {
     item
diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx
index 4cd35659f..752a054b4 100644
--- a/src/view/com/post/Post.tsx
+++ b/src/view/com/post/Post.tsx
@@ -72,7 +72,7 @@ export const Post = observer(function Post({uri}: {uri: string}) {
     replyHref = `/profile/${urip.hostname}/post/${urip.recordKey}`
   }
   const onPressReply = () => {
-    store.shell.openModal(new ComposePostModel(item.uri))
+    store.shell.openModal(new ComposePostModel({replyTo: item.uri}))
   }
   const onPressToggleRepost = () => {
     item
diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx
index c24762730..b29470d2c 100644
--- a/src/view/com/posts/FeedItem.tsx
+++ b/src/view/com/posts/FeedItem.tsx
@@ -40,7 +40,7 @@ export const FeedItem = observer(function FeedItem({
   }, [record.reply])
 
   const onPressReply = () => {
-    store.shell.openModal(new ComposePostModel(item.uri))
+    store.shell.openModal(new ComposePostModel({replyTo: item.uri}))
   }
   const onPressToggleRepost = () => {
     item
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx
index 5b4f1011d..dbf1eb29a 100644
--- a/src/view/screens/Home.tsx
+++ b/src/view/screens/Home.tsx
@@ -31,7 +31,10 @@ export const Home = observer(function Home({visible}: ScreenParams) {
   }, [visible, store])
 
   const onComposePress = () => {
-    store.shell.openModal(new ComposePostModel())
+    store.shell.openModal(new ComposePostModel({onPost: onCreatePost}))
+  }
+  const onCreatePost = () => {
+    feedView?.loadLatest()
   }
 
   return (