This commit is contained in:
Zhiyuan Zheng 2021-03-11 23:12:17 +01:00
parent b21194ca5a
commit 83d472bc4a
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
2 changed files with 15 additions and 9 deletions

View File

@ -343,8 +343,7 @@ const ScreenCompose: React.FC<ScreenComposeProp> = ({
return (
<KeyboardAvoidingView
style={styles.base}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={Platform.OS === 'android' ? 30 : 0}
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
>
<SafeAreaView
style={styles.base}

View File

@ -9,11 +9,12 @@ import {
} from '@utils/slices/instancesSlice'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useContext, useState } from 'react'
import React, { useCallback, useContext, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
Dimensions,
Modal,
Platform,
Pressable,
StyleSheet,
Text,
@ -41,6 +42,12 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
draft => draft.timestamp !== timestamp
)
useEffect(() => {
if (instanceDrafts?.length === 0) {
navigation.goBack()
}
}, [instanceDrafts?.length])
const actionWidth =
StyleConstants.Font.Size.L + StyleConstants.Spacing.Global.PagePadding * 4
@ -156,18 +163,18 @@ const ComposeDraftsListRoot: React.FC<Props> = ({ timestamp }) => {
return (
<>
<PanGestureHandler enabled={true}>
<PanGestureHandler enabled={Platform.OS === 'ios'}>
<SwipeListView
data={instanceDrafts}
renderItem={renderItem}
renderHiddenItem={renderHiddenItem}
disableRightSwipe={true}
rightOpenValue={-actionWidth}
previewRowKey={
instanceDrafts?.length
? instanceDrafts[0].timestamp.toString()
: undefined
}
// previewRowKey={
// instanceDrafts?.length
// ? instanceDrafts[0].timestamp.toString()
// : undefined
// }
// previewDuration={350}
previewOpenValue={-actionWidth / 2}
ItemSeparatorComponent={ComponentSeparator}