Fix switch page keyboard avoidance view

This commit is contained in:
Zhiyuan Zheng 2021-05-27 10:40:05 +02:00
parent 8a56e3a4f0
commit 8a3f335d37
2 changed files with 59 additions and 46 deletions

View File

@ -4,7 +4,7 @@
"native": "210511",
"major": 2,
"minor": 0,
"patch": 0,
"patch": 1,
"expo": "41.0.0"
},
"description": "tooot app for Mastodon",

View File

@ -13,7 +13,13 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text, View } from 'react-native'
import {
KeyboardAvoidingView,
Platform,
StyleSheet,
Text,
View
} from 'react-native'
import { ScrollView } from 'react-native-gesture-handler'
import { useQueryClient } from 'react-query'
import { useDispatch, useSelector } from 'react-redux'
@ -56,12 +62,18 @@ const TabMeSwitch: React.FC = () => {
const scrollViewRef = useRef<ScrollView>(null)
return (
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
>
<ScrollView
ref={scrollViewRef}
style={styles.base}
keyboardShouldPersistTaps='always'
>
<View style={[styles.firstSection, { borderBottomColor: theme.border }]}>
<View
style={[styles.firstSection, { borderBottomColor: theme.border }]}
>
<Text style={[styles.header, { color: theme.primaryDefault }]}>
{t('me.switch.existing')}
</Text>
@ -103,12 +115,13 @@ const TabMeSwitch: React.FC = () => {
/>
</View>
</ScrollView>
</KeyboardAvoidingView>
)
}
const styles = StyleSheet.create({
base: {
marginBottom: StyleConstants.Spacing.L
marginBottom: StyleConstants.Spacing.L * 2
},
header: {
...StyleConstants.FontStyle.M,