go back when root post is deleted in thread view (#6246)
This commit is contained in:
parent
7e80843092
commit
a5d85890dd
1 changed files with 10 additions and 1 deletions
|
|
@ -10,12 +10,15 @@ import FreezeScreen from '@components/freeze_screen';
|
|||
import PostDraft from '@components/post_draft';
|
||||
import {THREAD_ACCESSORIES_CONTAINER_NATIVE_ID} from '@constants/post_draft';
|
||||
import {useAppState} from '@hooks/device';
|
||||
import useDidUpdate from '@hooks/did_update';
|
||||
import {popTopScreen} from '@screens/navigation';
|
||||
|
||||
import ThreadPostList from './thread_post_list';
|
||||
|
||||
import type PostModel from '@typings/database/models/servers/post';
|
||||
|
||||
type ThreadProps = {
|
||||
componentId: string;
|
||||
rootPost?: PostModel;
|
||||
};
|
||||
|
||||
|
|
@ -27,11 +30,17 @@ const getStyleSheet = StyleSheet.create(() => ({
|
|||
},
|
||||
}));
|
||||
|
||||
const Thread = ({rootPost}: ThreadProps) => {
|
||||
const Thread = ({componentId, rootPost}: ThreadProps) => {
|
||||
const appState = useAppState();
|
||||
const styles = getStyleSheet();
|
||||
const postDraftRef = useRef<KeyboardTrackingViewRef>(null);
|
||||
|
||||
useDidUpdate(() => {
|
||||
if (!rootPost) {
|
||||
popTopScreen(componentId);
|
||||
}
|
||||
}, [componentId, rootPost]);
|
||||
|
||||
return (
|
||||
<FreezeScreen>
|
||||
<SafeAreaView
|
||||
|
|
|
|||
Loading…
Reference in a new issue