|
|
|
@ -1,7 +1,7 @@
@@ -1,7 +1,7 @@
|
|
|
|
|
import { $size } from '@/shared/helpers' |
|
|
|
|
import { useTheme } from '@/shared/hooks' |
|
|
|
|
import { PartialTheme } from '@/shared/themes/interfaces' |
|
|
|
|
import React, { FC } from 'react' |
|
|
|
|
import React, { FC, useMemo } from 'react' |
|
|
|
|
import { |
|
|
|
|
ActivityIndicator, |
|
|
|
|
Platform, |
|
|
|
@ -10,7 +10,7 @@ import {
@@ -10,7 +10,7 @@ import {
|
|
|
|
|
TouchableOpacity, |
|
|
|
|
View, |
|
|
|
|
} from 'react-native' |
|
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context' |
|
|
|
|
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' |
|
|
|
|
import { IconComponent } from '../../elements' |
|
|
|
|
import { KeyboardSpacer } from '../../tools' |
|
|
|
|
import { ChatSendButton } from './chat-send-button.component' |
|
|
|
@ -24,6 +24,12 @@ interface ChatBarProps {
@@ -24,6 +24,12 @@ interface ChatBarProps {
|
|
|
|
|
|
|
|
|
|
export const ChatBar: FC<ChatBarProps> = props => { |
|
|
|
|
const { styles, theme } = useTheme(createStyles) |
|
|
|
|
const insets = useSafeAreaInsets() |
|
|
|
|
|
|
|
|
|
const paddingBottom = useMemo(() => { |
|
|
|
|
if (insets.bottom > 15) return insets.bottom |
|
|
|
|
else return 15 |
|
|
|
|
}, [insets]) |
|
|
|
|
|
|
|
|
|
const renderRightPart = () => { |
|
|
|
|
if (props.isSending) { |
|
|
|
@ -39,22 +45,23 @@ export const ChatBar: FC<ChatBarProps> = props => {
@@ -39,22 +45,23 @@ export const ChatBar: FC<ChatBarProps> = props => {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return ( |
|
|
|
|
<View style={styles.container}> |
|
|
|
|
<SafeAreaView edges={['bottom']}> |
|
|
|
|
<View style={styles.row}> |
|
|
|
|
<TextInput |
|
|
|
|
multiline={true} |
|
|
|
|
placeholder="Повідомлення..." |
|
|
|
|
style={styles.input} |
|
|
|
|
value={props.message} |
|
|
|
|
onChangeText={val => props.onChangeMessage(val)} |
|
|
|
|
/> |
|
|
|
|
{renderRightPart()} |
|
|
|
|
</View> |
|
|
|
|
{Platform.OS === 'ios' ? ( |
|
|
|
|
<KeyboardSpacer clearSpace={true} /> |
|
|
|
|
) : null} |
|
|
|
|
</SafeAreaView> |
|
|
|
|
<View style={[styles.container, { paddingBottom: paddingBottom }]}> |
|
|
|
|
{/* <SafeAreaView edges={['bottom']}> */} |
|
|
|
|
<View style={styles.row}> |
|
|
|
|
<TextInput |
|
|
|
|
multiline={true} |
|
|
|
|
placeholder="Повідомлення..." |
|
|
|
|
style={styles.input} |
|
|
|
|
value={props.message} |
|
|
|
|
onChangeText={val => props.onChangeMessage(val)} |
|
|
|
|
placeholderTextColor={theme?.$secondaryText} |
|
|
|
|
/> |
|
|
|
|
{renderRightPart()} |
|
|
|
|
</View> |
|
|
|
|
{Platform.OS === 'ios' ? ( |
|
|
|
|
<KeyboardSpacer clearSpace={true} /> |
|
|
|
|
) : null} |
|
|
|
|
{/* </SafeAreaView> */} |
|
|
|
|
</View> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
@ -72,7 +79,7 @@ const createStyles = (theme: PartialTheme) =>
@@ -72,7 +79,7 @@ const createStyles = (theme: PartialTheme) =>
|
|
|
|
|
fontSize: $size(14, 12), |
|
|
|
|
lineHeight: $size(20), |
|
|
|
|
color: theme?.$secondaryText, |
|
|
|
|
minHeight: 50, |
|
|
|
|
maxHeight: 200, |
|
|
|
|
paddingTop: 15, |
|
|
|
|
paddingLeft: 15, |
|
|
|
|
paddingBottom: 10, |
|
|
|
@ -80,9 +87,9 @@ const createStyles = (theme: PartialTheme) =>
@@ -80,9 +87,9 @@ const createStyles = (theme: PartialTheme) =>
|
|
|
|
|
container: { |
|
|
|
|
paddingHorizontal: 20, |
|
|
|
|
paddingTop: 15, |
|
|
|
|
borderTopColor: '#EAEAEA', |
|
|
|
|
borderTopColor: theme?.chats?.bar?.$border, |
|
|
|
|
borderTopWidth: 1, |
|
|
|
|
paddingBottom: 15, |
|
|
|
|
paddingBottom: 0, |
|
|
|
|
}, |
|
|
|
|
row: { |
|
|
|
|
flexDirection: 'row', |
|
|
|
|