import React, { PropsWithChildren } from 'react'; import { StyleSheet, View } from 'react-native'; import { filterTypingUsers } from './utils/filterTypingUsers'; import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext'; import { useTheme } from '../../contexts/themeContext/ThemeContext'; import { ThreadContextValue, useThreadContext } from '../../contexts/threadContext/ThreadContext'; import { TypingContextValue, useTypingContext } from '../../contexts/typingContext/TypingContext'; import { primitives } from '../../theme'; const styles = StyleSheet.create({ container: { paddingVertical: primitives.spacingXs, paddingHorizontal: primitives.spacingMd, width: '100%', }, }); type TypingIndicatorContainerPropsWithContext = Pick & Pick & Pick; const TypingIndicatorContainerWithContext = ( props: PropsWithChildren, ) => { const { children, client, thread, typing } = props; const { theme: { messageList: { typingIndicatorContainer }, }, } = useTheme(); const typingUsers = filterTypingUsers({ client, thread, typing }); if (!typingUsers.length) { return null; } return ( {children} ); }; export type TypingIndicatorContainerProps = PropsWithChildren< Partial >; export const TypingIndicatorContainer = (props: TypingIndicatorContainerProps) => { const { typing } = useTypingContext(); const { client } = useChatContext(); const { thread } = useThreadContext(); return ; }; TypingIndicatorContainer.displayName = 'TypingIndicatorContainer{messageList{typingIndicatorContainer}}';