Browse Source

FIX | Fix net status component styles for android, disable copy pinned image message in offline mode

fix/offline
Oksana Stepanenko 2 years ago
parent
commit
2df665948a
  1. 4
      src/modules/chats/hooks/use-pined-messages.hook.ts
  2. 5
      src/modules/root/components/net-status.component.tsx

4
src/modules/chats/hooks/use-pined-messages.hook.ts

@ -10,6 +10,7 @@ import _ from 'lodash' @@ -10,6 +10,7 @@ import _ from 'lodash'
import { useCallback, useEffect, useState } from 'react'
import Clipboard from '@react-native-community/clipboard'
import { chatMessageManager } from '@/managers/chat-message.manager'
import { useNetInfo } from '@react-native-community/netinfo'
interface IProps {
messages: IChatMessage[]
@ -18,6 +19,7 @@ interface IProps { @@ -18,6 +19,7 @@ interface IProps {
}
export const usePinedMessages = ({ messages, role, onPress }: IProps) => {
const { isConnected } = useNetInfo()
const [activeInd, setActiveInd] = useState(null)
const nav = useNav()
@ -69,7 +71,7 @@ export const usePinedMessages = ({ messages, role, onPress }: IProps) => { @@ -69,7 +71,7 @@ export const usePinedMessages = ({ messages, role, onPress }: IProps) => {
]
const copyEnablesTypes = [MessageType.Text, MessageType.Image]
const canCopy = copyEnablesTypes.includes(messages[activeInd].type)
const canCopy = isConnected ? copyEnablesTypes.includes(messages[activeInd].type) : messages[activeInd].type === MessageType.Text
if (!canCopy) options.shift()

5
src/modules/root/components/net-status.component.tsx

@ -48,7 +48,10 @@ export const NetStatus: FC<INetStatusProps> = ({ status }) => { @@ -48,7 +48,10 @@ export const NetStatus: FC<INetStatusProps> = ({ status }) => {
styles.container,
{
paddingBottom: 0,
marginBottom: $size(-25),
marginBottom: Platform.select({
ios: $size(-25),
android: 0,
}),
backgroundColor: 'transparent',
},
]}>

Loading…
Cancel
Save