Skip to content

Commit

Permalink
[PAY-1247] Cap height of chat textinput on mobile (#3447)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharit-tan authored May 26, 2023
1 parent efaa425 commit 0e5d1b3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/mobile/src/screens/chat-screen/ChatTextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { useCallback, useState } from 'react'

import { chatActions } from '@audius/common'
import { chatActions, playerSelectors } from '@audius/common'
import { Platform } from 'react-native'
import { TouchableWithoutFeedback } from 'react-native-gesture-handler'
import { useDispatch } from 'react-redux'
import { useDispatch, useSelector } from 'react-redux'

import IconSend from 'app/assets/images/iconSend.svg'
import { TextInput } from 'app/components/core'
import { makeStyles } from 'app/styles'
import { spacing } from 'app/styles/spacing'

const { sendMessage } = chatActions
const { getHasTrack } = playerSelectors

const ICON_BLUR = 0.5
const ICON_FOCUS = 1
Expand All @@ -22,7 +23,7 @@ const messages = {
const useStyles = makeStyles(({ spacing, palette, typography }) => ({
composeTextContainer: {
display: 'flex',
alignItems: 'center',
alignItems: 'flex-end',
backgroundColor: palette.neutralLight10,
paddingLeft: spacing(4),
borderRadius: spacing(1)
Expand All @@ -48,6 +49,7 @@ export const ChatTextInput = ({ chatId }: ChatTextInputProps) => {
const dispatch = useDispatch()

const [inputMessage, setInputMessage] = useState('')
const hasCurrentlyPlayingTrack = useSelector(getHasTrack)

const handleSubmit = useCallback(
(message) => {
Expand Down Expand Up @@ -76,7 +78,8 @@ export const ChatTextInput = ({ chatId }: ChatTextInputProps) => {
root: styles.composeTextContainer,
input: [
styles.composeTextInput,
Platform.OS === 'ios' ? { paddingBottom: spacing(1) } : null
Platform.OS === 'ios' ? { paddingBottom: spacing(1) } : null,
{ maxHeight: hasCurrentlyPlayingTrack ? spacing(70) : spacing(80) }
]
}}
onChangeText={(text) => {
Expand Down

0 comments on commit 0e5d1b3

Please sign in to comment.