From 3fe58877c074766b0c25ac9a66492548431be839 Mon Sep 17 00:00:00 2001 From: hyochan Date: Wed, 15 Jan 2020 04:07:28 +0900 Subject: [PATCH] Differentiate keyboard offset for android and ios --- src/components/screen/Message.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/screen/Message.tsx b/src/components/screen/Message.tsx index d6ecc15d1..d060e1793 100644 --- a/src/components/screen/Message.tsx +++ b/src/components/screen/Message.tsx @@ -1,4 +1,4 @@ -import { Image, TouchableOpacity, View } from 'react-native'; +import { Image, Platform, TouchableOpacity, View } from 'react-native'; import { MessageProps, MessageType } from '../../types'; import React, { useState } from 'react'; import { @@ -15,7 +15,7 @@ import { Ionicons } from '@expo/vector-icons'; import { MainStackNavigationProps } from '../navigation/MainStackNavigator'; import MessageListItem from '../shared/MessageListItem'; import { getString } from '../../../STRINGS'; -import { isIPhoneXSize } from '../../utils/Styles'; +import { isIphoneX } from '../../utils/Styles'; import styled from 'styled-components/native'; import { useProfileContext } from '../../providers/ProfileModalProvider'; import { useThemeContext } from '@dooboo-ui/native-theme'; @@ -123,9 +123,12 @@ function Message(): React.ReactElement { borderColor={theme.lineColor} backgroundColor={theme.background} fontColor={theme.fontColor} - keyboardOffset={isIPhoneXSize - ? Constants.statusBarHeight + 40 - : Constants.statusBarHeight} + keyboardOffset={Platform.select({ + ios: isIphoneX + ? Constants.statusBarHeight + 40 + : Constants.statusBarHeight, + android: Constants.statusBarHeight + 52, + })} message={textToSend} placeholder={getString('WRITE_MESSAGE')} placeholderTextColor={theme.placeholder}