mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 19:01:38 +03:00
adjusted contents of submitReply
This commit is contained in:
parent
fb6738237e
commit
587e4bf252
@ -67,9 +67,9 @@ export const QuickReplyModalContent = forwardRef(({
|
||||
_value = quickComment.body;
|
||||
}
|
||||
|
||||
if(inputRef.current){
|
||||
if (inputRef.current) {
|
||||
inputRef.current.setNativeProps({
|
||||
text:_value
|
||||
text: _value
|
||||
})
|
||||
setCommentValue(_value)
|
||||
}
|
||||
@ -113,7 +113,7 @@ export const QuickReplyModalContent = forwardRef(({
|
||||
|
||||
// handle submit reply
|
||||
const _submitReply = async () => {
|
||||
let stateTimer;
|
||||
|
||||
if (!commentValue) {
|
||||
return;
|
||||
}
|
||||
@ -149,14 +149,16 @@ export const QuickReplyModalContent = forwardRef(({
|
||||
parentTags,
|
||||
)
|
||||
.then(() => {
|
||||
stateTimer = setTimeout(() => {
|
||||
|
||||
setIsSending(false);
|
||||
onClose();
|
||||
//TODO: use native method to update comment value instead
|
||||
inputRef.current.setNativeProps({
|
||||
text:''
|
||||
})
|
||||
setCommentValue('');
|
||||
|
||||
if(inputRef.current){
|
||||
inputRef.current.setNativeProps({
|
||||
text: ''
|
||||
})
|
||||
}
|
||||
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
@ -181,12 +183,14 @@ export const QuickReplyModalContent = forwardRef(({
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
// delete quick comment draft cache if it exist
|
||||
if (drafts.has(draftId)) {
|
||||
dispatch(deleteDraftCacheEntry(draftId));
|
||||
}
|
||||
clearTimeout(stateTimer);
|
||||
}, 3000);
|
||||
|
||||
//close should alwasy be called at method end
|
||||
onClose();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@ -196,11 +200,11 @@ export const QuickReplyModalContent = forwardRef(({
|
||||
}),
|
||||
error.message || JSON.stringify(error),
|
||||
);
|
||||
stateTimer = setTimeout(() => {
|
||||
|
||||
|
||||
setIsSending(false);
|
||||
_addQuickCommentIntoCache(); //add comment value into cache if there is error while posting comment
|
||||
clearTimeout(stateTimer);
|
||||
}, 500);
|
||||
|
||||
});
|
||||
console.log('status : ', status);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user