Browse Source

Fixed several bugs

merge-requests/367/merge
Oksana Stepanenko 2 years ago committed by Coder
parent
commit
9974fa4607
  1. 24
      src/modules/chats/atoms/chat-card-info.atom.tsx
  2. 4
      src/modules/groups/smart-components/groups-slider-list.smart-component.tsx
  3. 25
      src/shared/components/plugins/chat/chat-item-audio.component.tsx

24
src/modules/chats/atoms/chat-card-info.atom.tsx

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
import { $size, Txt } from '@/shared'
import { useTheme } from '@/shared/hooks/use-theme.hook'
import { PartialTheme } from '@/shared/themes/interfaces'
import _ from 'lodash'
import React, { FC, useMemo } from 'react'
import { StyleSheet, View } from 'react-native'
@ -19,24 +20,7 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => { @@ -19,24 +20,7 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => {
if (!message) return 'ще немає повідомлень.'
const sliceMessageOnNewLines = message.split('\n')
const newLines = sliceMessageOnNewLines.length
if (message.length > LENGTH_STRING_TO_RENDER) {
const preparedMessage = message.substr(0, LENGTH_STRING_TO_RENDER)
return `${preparedMessage}...`
}
if (newLines > ALLOWED_NEW_LINES) {
const preparedMessage = sliceMessageOnNewLines
.splice(0, ALLOWED_NEW_LINES)
.join('\n')
return `${preparedMessage}...`
}
return message
return sliceMessageOnNewLines.join(' ')
}, [message])
return (
@ -45,7 +29,9 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => { @@ -45,7 +29,9 @@ export const ChatCardInfo: FC<IProps> = ({ label, message }) => {
{label}
</Txt>
<Txt style={styles.message}>{messageToRender}</Txt>
<Txt numberOfLines={3} style={styles.message}>
{messageToRender}
</Txt>
</View>
)
}

4
src/modules/groups/smart-components/groups-slider-list.smart-component.tsx

@ -101,7 +101,9 @@ export const GroupsSliderList: FC<GroupsSliderListProps> = ({ @@ -101,7 +101,9 @@ export const GroupsSliderList: FC<GroupsSliderListProps> = ({
})
}
onPressInfo={() =>
console.log('i press group info', item.name)
nav.navigate(RouteKey.GroupTasks, {
groupData: item,
})
}
/>
</View>

25
src/shared/components/plugins/chat/chat-item-audio.component.tsx

@ -111,14 +111,33 @@ export const ChatItemAudio: FC<ChatItemAudioProps> = props => { @@ -111,14 +111,33 @@ export const ChatItemAudio: FC<ChatItemAudioProps> = props => {
value={currentPosition}
maximumValue={audioDuration}
minimumValue={0}
onSlidingComplete={position =>
onSlidingStart={async position => {
await mediaService.removePlayBackListener()
setCurrentPosition(position[0])
}}
onSlidingComplete={position => {
setCurrentPosition(position[0])
mediaService.seekToPlayer(position[0])
}
mediaService.addPlayBackListener(e => {
setDuration(e.duration)
setCurrentPosition(e.currentPosition)
if (e.currentPosition === e.duration) {
setIsPlying(false)
setCurrentPosition(0)
mediaService.onStopPlay()
}
})
}}
thumbStyle={styles.thumbStyle}
thumbTouchSize={{
width: $size(30),
width: $size(25),
height: $size(30),
}}
onValueChange={async position =>
setCurrentPosition(position[0])
}
debugTouchArea={true}
minimumTrackTintColor={
chats.voiceMsg.progressLine.$activeBg
}

Loading…
Cancel
Save