cleaned up quickReplyModal with inputSupportModal

This commit is contained in:
noumantahir 2022-06-24 18:05:42 +05:00
parent 02ece3d2de
commit 73d6964933

View File

@ -1,10 +1,7 @@
import React, { useImperativeHandle, useRef, useState } from 'react';
import { View as AnimatedView } from 'react-native-animatable'
import { forwardRef } from 'react';
import { Portal } from 'react-native-portalize';
import { QuickReplyModalContent } from './quickReplyModalContent';
import styles from './quickReplyModalStyles';
import { KeyboardAvoidingView, Platform, View } from 'react-native';
import { InputSupportModal } from '../organisms';
export interface QuickReplyModalProps {
fetchPost?: any;
@ -30,7 +27,12 @@ const QuickReplyModal = ({ fetchPost }: QuickReplyModalProps, ref) => {
setVisible(false);
}
const _renderContent = () => (
return (
<InputSupportModal
visible={visible && !!selectedPost}
onClose={_onClose}
>
<QuickReplyModalContent
fetchPost={fetchPost}
selectedPost={selectedPost}
@ -38,36 +40,8 @@ const QuickReplyModal = ({ fetchPost }: QuickReplyModalProps, ref) => {
onClose={_onClose}
handleCloseRef={handleCloseRef}
/>
)
</InputSupportModal>
return (
<Portal>
{
visible && (
<AnimatedView
style={styles.container}
duration={300}
animation='fadeInUp'>
{selectedPost && (
<>
<View style={styles.container} onTouchEnd={_onClose} />
{
Platform.select({
ios: (
<KeyboardAvoidingView style={styles.container} behavior="padding">
{_renderContent()}
</KeyboardAvoidingView>
),
android: <View style={styles.container}>{_renderContent()}</View>,
})
}
</>
)}
</AnimatedView>
)
}
</Portal>
);
};