import React, { useEffect, useState } from 'react';
import { StyleSheet, Text } from 'react-native';
import PropTypes from 'prop-types';
import RocketChat from '../../lib/rocketchat';
import { withTheme } from '../../theme';
import sharedStyles from '../Styles';
import { themes } from '../../constants/colors';
import I18n from '../../i18n';
import CustomFields from './CustomFields';
import Item from './Item';
import Timezone from './Timezone';
const styles = StyleSheet.create({
title: {
fontSize: 16,
paddingHorizontal: 20,
...sharedStyles.textMedium
}
});
const Title = ({ title, theme }) => {title};
Title.propTypes = {
title: PropTypes.string,
theme: PropTypes.string
};
const Livechat = ({ room, roomUser, theme }) => {
const [department, setDepartment] = useState({});
const getDepartment = async id => {
if (id) {
const result = await RocketChat.getDepartmentInfo(id);
if (result.success) {
setDepartment(result.department);
}
}
};
const getRoom = () => {
if (room.departmentId) {
getDepartment(room.departmentId);
}
};
useEffect(() => {
getRoom();
}, [room]);
return (
<>
- email.address).reduce((ret, item) => `${ret}${item}\n`)}
theme={theme}
/>
- phone.phoneNumber).reduce((ret, item) => `${ret}${item}\n`)}
theme={theme}
/>
>
);
};
Livechat.propTypes = {
room: PropTypes.object,
roomUser: PropTypes.object,
theme: PropTypes.string
};
export default withTheme(Livechat);