// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, {useRef} from 'react'; import {StyleSheet, View} from 'react-native'; import {KeyboardTrackingViewRef} from 'react-native-keyboard-tracking-view'; import {Edge, SafeAreaView} from 'react-native-safe-area-context'; 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; }; const edges: Edge[] = ['left', 'right']; const getStyleSheet = StyleSheet.create(() => ({ flex: { flex: 1, }, })); const Thread = ({componentId, rootPost}: ThreadProps) => { const appState = useAppState(); const styles = getStyleSheet(); const postDraftRef = useRef(null); useDidUpdate(() => { if (!rootPost) { popTopScreen(componentId); } }, [componentId, rootPost]); return ( {Boolean(rootPost?.id) && <> } ); }; export default Thread;