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