updated reply modal implementation tabContent

This commit is contained in:
Nouman Tahir 2022-07-18 17:40:11 +05:00
parent 5dc29bec52
commit f5089d335a
3 changed files with 10 additions and 9 deletions

View File

@ -5,12 +5,12 @@ import { LoadPostsOptions, TabContentProps, TabMeta } from '../services/tabbedPo
import {useSelector, useDispatch } from 'react-redux'; import {useSelector, useDispatch } from 'react-redux';
import TabEmptyView from './listEmptyView'; import TabEmptyView from './listEmptyView';
import { setInitPosts } from '../../../redux/actions/postsAction'; import { setInitPosts } from '../../../redux/actions/postsAction';
import { showReplyModal } from '../../../redux/actions/uiAction';
import { calculateTimeLeftForPostCheck } from '../services/tabbedPostsHelpers'; import { calculateTimeLeftForPostCheck } from '../services/tabbedPostsHelpers';
import { AppState, NativeScrollEvent, NativeSyntheticEvent } from 'react-native'; import { AppState, NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
import { PostsListRef } from '../../postsList/container/postsListContainer'; import { PostsListRef } from '../../postsList/container/postsListContainer';
import ScrollTopPopup from './scrollTopPopup'; import ScrollTopPopup from './scrollTopPopup';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { QuickReplyModal } from '../..';
const DEFAULT_TAB_META = { const DEFAULT_TAB_META = {
startAuthor:'', startAuthor:'',
@ -68,7 +68,6 @@ const TabContent = ({
const appState = useRef(AppState.currentState); const appState = useRef(AppState.currentState);
const postsRef = useRef(posts); const postsRef = useRef(posts);
const sessionUserRef = useRef(sessionUser); const sessionUserRef = useRef(sessionUser);
const quickReplyModalRef = useRef(null)
//init state refs; //init state refs;
postsRef.current = posts; postsRef.current = posts;
@ -335,13 +334,12 @@ const TabContent = ({
// show quick reply modal // show quick reply modal
const _showQuickReplyModal = (post:any) => { const _showQuickReplyModal = (post:any) => {
// console.log('post: ', post);
if (isLoggedIn) { if (isLoggedIn) {
quickReplyModalRef.current.show(post); dispatch(showReplyModal(post))
} else { } else {
//TODO: show proper alert message
console.log('Not LoggedIn'); console.log('Not LoggedIn');
} }
} }
return ( return (
@ -375,7 +373,6 @@ const TabContent = ({
setEnableScrollTop(false); setEnableScrollTop(false);
}} }}
/> />
<QuickReplyModal ref={quickReplyModalRef} />
</> </>
); );
}; };

View File

@ -1,4 +1,3 @@
import { State } from 'react-native-gesture-handler';
import { import {
UPDATE_ACTIVE_BOTTOM_TAB, UPDATE_ACTIVE_BOTTOM_TAB,
TOAST_NOTIFICATION, TOAST_NOTIFICATION,
@ -12,6 +11,7 @@ import {
TOGGLE_QR_MODAL, TOGGLE_QR_MODAL,
SET_DEVICE_ORIENTATION, SET_DEVICE_ORIENTATION,
SHOW_REPLY_MODAL, SHOW_REPLY_MODAL,
HIDE_REPLY_MODAL,
} from '../constants/constants'; } from '../constants/constants';
import { orientations } from '../constants/orientationsConstants'; import { orientations } from '../constants/orientationsConstants';
@ -121,7 +121,7 @@ export default function (state = initialState, action) : UiState {
replyModalVisible:true, replyModalVisible:true,
replyModalPost:action.payload replyModalPost:action.payload
} }
case HIDE_ACTION_MODAL: case HIDE_REPLY_MODAL:
return { return {
...state, ...state,
replyModalVisible:false, replyModalVisible:false,

View File

@ -25,6 +25,7 @@ import {
ForegroundNotification, ForegroundNotification,
QuickProfileModal, QuickProfileModal,
QRModal, QRModal,
QuickReplyModal,
} from '../../../components'; } from '../../../components';
// Themes (Styles) // Themes (Styles)
@ -127,10 +128,13 @@ class ApplicationScreen extends Component {
)} )}
<ForegroundNotification remoteMessage={foregroundNotificationData} /> <ForegroundNotification remoteMessage={foregroundNotificationData} />
<QuickProfileModal navigation={{ navigate }} />
<AccountsBottomSheet /> <AccountsBottomSheet />
<ActionModal /> <ActionModal />
<QuickProfileModal navigation={{ navigate }} /> <QuickReplyModal />
<QRModal /> <QRModal />
</View> </View>
); );
} }