From 8a3f335d37091e2c90f8ae13c0eb831ad69d798f Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Thu, 27 May 2021 10:40:05 +0200 Subject: [PATCH] Fix switch page keyboard avoidance view --- package.json | 2 +- src/screens/Tabs/Me/Switch.tsx | 103 +++++++++++++++++++-------------- 2 files changed, 59 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index b824d125..cf04a80d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "native": "210511", "major": 2, "minor": 0, - "patch": 0, + "patch": 1, "expo": "41.0.0" }, "description": "tooot app for Mastodon", diff --git a/src/screens/Tabs/Me/Switch.tsx b/src/screens/Tabs/Me/Switch.tsx index c73cdb8b..151b155a 100644 --- a/src/screens/Tabs/Me/Switch.tsx +++ b/src/screens/Tabs/Me/Switch.tsx @@ -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,59 +62,66 @@ const TabMeSwitch: React.FC = () => { const scrollViewRef = useRef(null) return ( - - - - {t('me.switch.existing')} - - - {instances.length - ? instances - .slice() - .sort((a, b) => - `${a.uri}${a.account.acct}`.localeCompare( - `${b.uri}${b.account.acct}` + + + + {t('me.switch.existing')} + + + {instances.length + ? instances + .slice() + .sort((a, b) => + `${a.uri}${a.account.acct}`.localeCompare( + `${b.uri}${b.account.acct}` + ) ) - ) - .map((instance, index) => { - const localAccount = instances[instanceActive!] - return ( - - ) - }) - : null} + .map((instance, index) => { + const localAccount = instances[instanceActive!] + return ( + + ) + }) + : null} + - - - - {t('me.switch.new')} - - - - + + + {t('me.switch.new')} + + + + + ) } const styles = StyleSheet.create({ base: { - marginBottom: StyleConstants.Spacing.L + marginBottom: StyleConstants.Spacing.L * 2 }, header: { ...StyleConstants.FontStyle.M,